Skip to content

Parsing problem #5985

Open
Open

Description

@jarauh

The following perfectly legal R code, when saved to a .R-file and opened with RStudio, is marked red:

paste0("a",
if (TRUE) "
for
" else "
b
")

In line 4, the second " gets a red wiggly line with mouse over:

unexpected token '" b "'

System details

RStudio Edition : Desktop
RStudio Version : 1.2.5001
OS Version      : Windows 10

Activity

  1. ronblum commented on Jan 9, 2020

    @ronblum
    Contributor

    @jarauh Thank you for reporting the issue! We'll review it as we continue development of RStudio.

    Confirmed in RStudio Desktop 1.2.5033 on MacOS 10.15 and RStudio Server 1.2.5033 on Red Hat 7. Also, the issue is due to the if/else clause; the following works fine.

    paste0("a",
    "
    b
    ")
    
  2. GreatEmerald commented on Jun 3, 2020

    @GreatEmerald

    I'm not sure if it's the same issue, but I also ran into a similar problem with formulas, here is the reprex in my case:

    formula = if (FALSE) a~b else b~a

    It also says unexpected token 'b' but is perfectly valid code.

  3. added this to the v1.4 milestone on Jun 8, 2020
  4. modified the milestones: v1.4, Later on Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions