Skip to content

Commit

Permalink
Propagate prec.right
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Jun 30, 2024
1 parent 06a5237 commit 0c7adb8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const PREC = {
using_directive: 2,
control: 1,
stable_type_id: 2,
then: 2,
while: 2,
assign: 3,
case: 3,
Expand Down Expand Up @@ -1134,14 +1135,17 @@ module.exports = grammar({
),

_if_condition: $ =>
choice(
$.parenthesized_expression,
$._then_condition,
prec.right(
PREC.then,
choice(
$.parenthesized_expression,
$._then_condition,
)
),

_then_condition: $ =>
prec.right(
PREC.control,
PREC.then,
seq($._indentable_expression, "then"),
),

Expand Down

0 comments on commit 0c7adb8

Please sign in to comment.