diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-05-31 14:35:11 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-05-31 19:31:53 +0000 |
| commit | 63ea77916a2996db97edd3d9803765e83faf966c (patch) | |
| tree | 3dd218a87f55a45da99ec614594d8b1113d1cb93 | |
| parent | 1b392ba7c65a360f282049f0cbad2be4cffba433 (diff) | |
[ruby/prism] Match % strings in parser
https://github.com/ruby/prism/commit/840185110f
| -rw-r--r-- | lib/prism/translation/parser/compiler.rb | 2 | ||||
| -rw-r--r-- | test/prism/ruby/parser_test.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/prism/translation/parser/compiler.rb b/lib/prism/translation/parser/compiler.rb index 8206d598d2..74cffc0abb 100644 --- a/lib/prism/translation/parser/compiler.rb +++ b/lib/prism/translation/parser/compiler.rb @@ -1689,6 +1689,8 @@ module Prism builder.string_compose(token(node.opening_loc), children, closing) elsif node.opening == "?" builder.character([node.unescaped, srange(node.location)]) + elsif node.opening&.start_with?("%") && node.unescaped.empty? + builder.string_compose(token(node.opening_loc), [], token(node.closing_loc)) else content_lines = node.content.lines unescaped_lines = node.unescaped.lines diff --git a/test/prism/ruby/parser_test.rb b/test/prism/ruby/parser_test.rb index d264d13b35..b3a4a80cda 100644 --- a/test/prism/ruby/parser_test.rb +++ b/test/prism/ruby/parser_test.rb @@ -68,13 +68,11 @@ module Prism "seattlerb/heredoc_with_only_carriage_returns.txt", "seattlerb/masgn_double_paren.txt", "seattlerb/parse_line_heredoc_hardnewline.txt", - "seattlerb/pct_nl.txt", "seattlerb/pctW_lineno.txt", "seattlerb/regexp_esc_C_slash.txt", "seattlerb/TestRubyParserShared.txt", "unparser/corpus/literal/assignment.txt", "unparser/corpus/literal/block.txt", - "unparser/corpus/literal/def.txt", "unparser/corpus/literal/dstr.txt", "unparser/corpus/literal/literal.txt", "unparser/corpus/literal/pattern.txt", |
