Skip to content

Commit

Permalink
Fix parsing of command
Browse files Browse the repository at this point in the history
Allow for the alternative syntax to write commands: ^'command_name'.
  • Loading branch information
CabalCrow committed May 23, 2024
1 parent 24d79a1 commit 9277d2f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,14 +1188,20 @@ module.exports = grammar({

command: ($) =>
seq(
field("head", seq(optional(PUNC().caret), $.cmd_identifier)),
choice(
field("head", seq(optional(PUNC().caret), $.cmd_identifier)),
field("head", seq(PUNC().caret, $.val_string)),
),
prec.dynamic(10, repeat($._cmd_arg)),
),

_command_parenthesized_body: ($) =>
prec.right(
seq(
field("head", seq(optional(PUNC().caret), $.cmd_identifier)),
choice(
field("head", seq(optional(PUNC().caret), $.cmd_identifier)),
field("head", seq(PUNC().caret, $.val_string)),
),
prec.dynamic(10, repeat(seq(optional("\n"), $._cmd_arg))),
optional("\n"),
),
Expand Down

0 comments on commit 9277d2f

Please sign in to comment.