Skip to content

Commit

Permalink
Pull unary plus into its own production.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Feb 24, 2016
1 parent 35c3fad commit 922b678
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const PREC = {
UNARY_MINUS: 75,
EXPONENTIAL: 80,
COMPLEMENT: 85,
UNARY_PLUS: 85,
LITERAL: 100,
};

Expand Down Expand Up @@ -215,7 +216,8 @@ module.exports = grammar({

exponential: $ => prec.right(PREC.EXPONENTIAL, seq($._expression, '**', $._expression)),

complement: $ => prec.right(PREC.COMPLEMENT, seq(choice('!', '~', '+'), $._expression)),
unary_plus: $ => prec.right(PREC.UNARY_PLUS, seq('+', $._expression)),
complement: $ => prec.right(PREC.COMPLEMENT, seq(choice('!', '~'), $._expression)),

_block_variable: $ => choice($._lhs, $._mlhs),
_mlhs: $ => choice(
Expand Down

0 comments on commit 922b678

Please sign in to comment.