Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle matching current line
  • Loading branch information
kddnewton committed Feb 18, 2023
commit 4057dfa17c3fc80ed8b4b11722e97fd53de50cf2
16 changes: 16 additions & 0 deletions lib/syntax_tree/translation/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2387,6 +2387,22 @@ def visit_unary(node)
srange_node(node)
)
)
elsif node.operator == "!" && node.statement.is_a?(RegexpLiteral)
s(
:send,
[
s(
:match_current_line,
[visit(node.statement)],
smap(srange_node(node.statement))
),
:!
],
smap_send_bare(
srange_length(node.start_char, 1),
srange_node(node)
)
)
else
visit(canonical_unary(node))
end
Expand Down
1 change: 0 additions & 1 deletion test/translation/parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class ParserTest < Minitest::Test
"test_dedenting_heredoc:399",
"test_slash_newline_in_heredocs:7194",
"test_parser_slash_slash_n_escaping_in_literals:*",
"test_cond_match_current_line:4801",
"test_forwarded_restarg:*",
"test_forwarded_kwrestarg:*",
"test_forwarded_argument_with_restarg:*",
Expand Down