-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug with raw string handling #162
Comments
Odd minimal reprex works treesitter::text_parse('r"( () )"', treesitter.r::language())
#> <tree_sitter_node>
#>
#> ── Text ────────────────────────────────────────────────────────────────────────
#> r"( () )"
#>
#> ── S-Expression ────────────────────────────────────────────────────────────────
#> (program [(0, 0), (0, 9)]
#> (string [(0, 0), (0, 9)])
#> ) works treesitter::text_parse('r"(() )"', treesitter.r::language())
#> <tree_sitter_node>
#>
#> ── Text ────────────────────────────────────────────────────────────────────────
#> r"(() )"
#>
#> ── S-Expression ────────────────────────────────────────────────────────────────
#> (program [(0, 0), (0, 8)]
#> (string [(0, 0), (0, 8)])
#> ) doesnt work treesitter::text_parse('r"(())"', treesitter.r::language())
#> <tree_sitter_node>
#>
#> ── Text ────────────────────────────────────────────────────────────────────────
#> r"(())"
#>
#> ── S-Expression ────────────────────────────────────────────────────────────────
#> (program [(0, 0), (0, 7)]
#> (identifier [(0, 0), (0, 1)])
#> (string [(0, 1), (0, 7)]
#> "\"" [(0, 1), (0, 2)]
#> content: (string_content [(0, 2), (0, 6)])
#> "\"" [(0, 6), (0, 7)]
#> )
#> ) doesnt work treesitter::text_parse('r"( ())"', treesitter.r::language())
#> <tree_sitter_node>
#>
#> ── Text ────────────────────────────────────────────────────────────────────────
#> r"( ())"
#>
#> ── S-Expression ────────────────────────────────────────────────────────────────
#> (program [(0, 0), (0, 8)]
#> (identifier [(0, 0), (0, 1)])
#> (string [(0, 1), (0, 8)]
#> "\"" [(0, 1), (0, 2)]
#> content: (string_content [(0, 2), (0, 7)])
#> "\"" [(0, 7), (0, 8)]
#> )
#> ) so the trailing double |
Ah, got it. It's a bad interaction of calling
Lines 328 to 352 in a0d3e33
I imagine that if we change this to a while loop and only increment in the body, it should work. Probably need to add an |
A few more test cases r"((\d+))" # -> yellow wave under the "r"
stringr::str_extract("foo123", r"((\d+))") # -> red wave under the "r" |
The text was updated successfully, but these errors were encountered: