Skip to content

Commit 689338e

Browse files
committed
Add visit_and to parser
1 parent b3e0e4c commit 689338e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/syntax_tree/translation/parser.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,18 @@ def visit_begin(node)
468468
end
469469
end
470470

471+
# Visit a AndNode node.
472+
def visit_and(node)
473+
s(
474+
:and,
475+
[visit(node.left), visit(node.right)],
476+
smap_operator(
477+
srange_find_between(node.left, node.right, node.operator.to_s),
478+
srange_node(node)
479+
)
480+
)
481+
end
482+
471483
# Visit a Binary node.
472484
def visit_binary(node)
473485
case node.operator
@@ -482,9 +494,9 @@ def visit_binary(node)
482494
else
483495
visit(canonical_binary(node))
484496
end
485-
when :"=>", :"&&", :and, :"||", :or
497+
when :"=>", :"||", :or
486498
s(
487-
{ "=>": :match_as, "&&": :and, "||": :or }.fetch(
499+
{ "=>": :match_as, "||": :or }.fetch(
488500
node.operator,
489501
node.operator
490502
),

0 commit comments

Comments
 (0)