From 6c8d8b8f05f8ed9f58987371c059afeff8fe3d36 Mon Sep 17 00:00:00 2001 From: Nat Mote Date: Tue, 17 May 2022 15:07:02 -0700 Subject: [PATCH] Increase dynamic precedence of call --- grammar.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/grammar.js b/grammar.js index 302b7a4..4b79ca1 100644 --- a/grammar.js +++ b/grammar.js @@ -59,6 +59,11 @@ const PRECS = { comment: -3, lambda: -3, }; + +const DYNAMIC_PRECS = { + call: 1, +}; + const DEC_DIGITS = token(sep1(/[0-9]+/, /_+/)); const HEX_DIGITS = token(sep1(/[0-9a-fA-F]+/, /_+/)); const OCT_DIGITS = token(sep1(/[0-7]+/, /_+/)); @@ -756,7 +761,11 @@ module.exports = grammar({ ), expr_hack_at_ternary_binary_call_suffix: ($) => prec(PRECS.call_suffix, $.value_arguments), - call_expression: ($) => prec(PRECS.call, seq($._expression, $.call_suffix)), + call_expression: ($) => + prec( + PRECS.call, + prec.dynamic(DYNAMIC_PRECS.call, seq($._expression, $.call_suffix)) + ), _primary_expression: ($) => choice( $.tuple_expression,