diff options
-rw-r--r-- | lib/prism/translation/parser/lexer.rb | 5 | ||||
-rw-r--r-- | test/prism/ruby/parser_test.rb | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/prism/translation/parser/lexer.rb b/lib/prism/translation/parser/lexer.rb index a2d4e84a13..687b4f6043 100644 --- a/lib/prism/translation/parser/lexer.rb +++ b/lib/prism/translation/parser/lexer.rb @@ -825,6 +825,11 @@ module Prism quote == "/" || quote.start_with?("%r") end + # Regexp allow interpolation but are handled differently during unescaping + def regexp?(quote) + quote == "/" || quote.start_with?("%r") + end + # Determine if the string is part of a %-style array. def percent_array?(quote) quote.start_with?("%w", "%W", "%i", "%I") diff --git a/test/prism/ruby/parser_test.rb b/test/prism/ruby/parser_test.rb index 4a6ba17aa7..b5cc45b824 100644 --- a/test/prism/ruby/parser_test.rb +++ b/test/prism/ruby/parser_test.rb @@ -74,6 +74,7 @@ module Prism # Contains an escaped multibyte character. This is supposed to drop to backslash "seattlerb/regexp_escape_extended.txt", +<<<<<<< HEAD # https://github.com/whitequark/parser/issues/1020 # These contain consecutive \r characters, followed by \n. Prism only receives @@ -82,12 +83,21 @@ module Prism "seattlerb/heredoc_with_extra_carriage_returns_windows.txt", "seattlerb/heredoc_with_only_carriage_returns_windows.txt", "seattlerb/heredoc_with_only_carriage_returns.txt", +======= +>>>>>>> e1c75f304b (Better handle regexp in the parser translator) ] # These files are either failing to parse or failing to translate, so we'll # skip them for now. skip_all = skip_incorrect | [ "unescaping.txt", +<<<<<<< HEAD +======= + "seattlerb/heredoc_with_extra_carriage_returns_windows.txt", + "seattlerb/heredoc_with_only_carriage_returns_windows.txt", + "seattlerb/heredoc_with_only_carriage_returns.txt", + "seattlerb/pctW_lineno.txt", +>>>>>>> e1c75f304b (Better handle regexp in the parser translator) "seattlerb/regexp_esc_C_slash.txt", ] |