Skip to content

Commit e2b9e9a

Browse files
committed
Support parsing with AndNode
1 parent 70f2e4b commit e2b9e9a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/syntax_tree/parser.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -893,12 +893,22 @@ def on_binary(left, operator, right)
893893
operator = tokens.delete(operator).value
894894
end
895895

896-
Binary.new(
897-
left: left,
898-
operator: operator,
899-
right: right,
900-
location: left.location.to(right.location)
901-
)
896+
case operator
897+
when :"&&", :and
898+
AndNode.new(
899+
left: left,
900+
operator: operator,
901+
right: right,
902+
location: left.location.to(right.location)
903+
)
904+
else
905+
Binary.new(
906+
left: left,
907+
operator: operator,
908+
right: right,
909+
location: left.location.to(right.location)
910+
)
911+
end
902912
end
903913

904914
# :call-seq:

0 commit comments

Comments
 (0)