Skip to content

Commit

Permalink
unary: Change name of operand to operand
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwac committed Oct 1, 2024
1 parent 3109c7b commit fd5d5c9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module.exports = grammar({
assignment: $ => seq(field("left", choice($.access, $.identifier)), "=", field("right", $.expression)),

unary_operator: _ => choice("-", "!"),
unary_expression: $ => seq(field("operator", $.unary_operator), field("expression", $.expression)),
unary_expression: $ => seq(field("operator", $.unary_operator), field("operand", $.expression)),

power_operator: _ => "**",
multiplicative_operator: _ => choice("*", "/", "%"),
Expand Down
2 changes: 1 addition & 1 deletion src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 17 additions & 15 deletions src/parser.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/corpus/unary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Unary operators
(expression
(unary_expression
operator: (unary_operator)
expression: (expression
operand: (expression
(literal
(number)
)
Expand All @@ -33,7 +33,7 @@ Unary operators
right: (expression
(unary_expression
operator: (unary_operator)
expression: (expression
operand: (expression
(literal
(number)
)
Expand Down

0 comments on commit fd5d5c9

Please sign in to comment.