Skip to content

Commit

Permalink
feat: support optional arguments {arg}?
Browse files Browse the repository at this point in the history
  • Loading branch information
clason committed Feb 29, 2024
1 parent 40fcd50 commit b63be26
Show file tree
Hide file tree
Showing 6 changed files with 4,157 additions and 4,042 deletions.
9 changes: 8 additions & 1 deletion corpus/arguments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ argument: {arg}
tuple: {arg,arg}
keycode: CTRL-R {CTRL-R} {register CTRL-F}
list of { uri:string, name: string } tables
optional argument: {arg}?


--------------------------------------------------------------------------------
Expand Down Expand Up @@ -38,7 +39,12 @@ list of { uri:string, name: string } tables
(word)
(word)
(word)
(word))))
(word))
(line
(word)
(word)
(argument
(word)))))

================================================================================
multiple arguments on the same line
Expand Down Expand Up @@ -211,3 +217,4 @@ EXTERNAL *netrw-externapp* {{{2
(tag
(word))
(word)))))

2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ module.exports = grammar({
// Inline code (may contain whitespace!): `foo bar`
codespan: ($) => _word($, /[^``\n]+/, '`', '`'),
// Argument: {arg} (no whitespace allowed)
argument: ($) => _word($, /[^}\n\t ]+/, '{', '}'),
argument: ($) => seq(_word($, /[^}\n\t ]+/, '{', '}'), optional(token.immediate('?'))),
},
});

Expand Down
59 changes: 39 additions & 20 deletions src/grammar.json

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

4 changes: 4 additions & 0 deletions src/node-types.json

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

Loading

0 comments on commit b63be26

Please sign in to comment.