-
Notifications
You must be signed in to change notification settings - Fork 71
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
Fails to create parseable code #1093
Comments
Thanks. Would you mind searching for the part of the code that causes the trouble, i.e. binary search on the expression level? That is, trying if styler also fails if you only style first half of the code, if yes, first 1/4, if no 2/4 etc. |
My first guess was this is #991 but my quick scroll didn't see the exact culprit. |
Reprex: styler::style_text("'\\1'")
#> Error in `value[[3L]]()`:
#> ! Styling resulted in code that isn't parsable. This should not happen. Please file a bug report on GitHub (https://github.com/r-lib/styler/issues) using a reprex.
#> Backtrace:
#> ▆
#> 1. ├─styler::style_text("'\\1'")
#> 2. │ └─styler (local) transformer(text) at styler/R/ui-styling.R:217:2
#> 3. │ └─text %>% ... at styler/R/transform-files.R:120:6
#> 4. └─styler:::parse_transform_serialize_r(...)
#> 5. └─styler:::verify_roundtrip(text, text_out, parsable_only = !parse_tree_must_be_identical(transformers)) at styler/R/transform-files.R:287:2
#> 6. └─rlang::with_handlers(...) at styler/R/transform-files.R:416:4
#> 7. └─base::tryCatch(.expr, error = `<fn>`)
#> 8. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 9. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#> 10. └─value[[3L]](cond)
#> 11. └─rlang::abort(...) at styler/R/transform-files.R:419:8 Created on 2023-02-05 with reprex v2.0.2 |
indeed a dupe of #991. @flying-sheep, the workaround is to use three-digit octal escapes, i.e. |
Click here for contents of
tests/testthat/test_escaping.r
Created on 2023-01-26 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: