Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmk committed Jun 25, 2023
1 parent d772790 commit 9f944ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions corpus/argument.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ nvim_buf_detach_event[{buf}]
(word))
(line
(word)
(optional_arg
(word)))))
(argument
(word))
(word))))

================================================================================
NOT an argument
Expand Down
7 changes: 5 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = grammar({
_atom: ($) => choice(
$.word,
$._atom_common,
$._args,
),
word: ($) => choice(
token(prec(-1, /[^,(\[\n\t ]+/)),
Expand All @@ -37,6 +38,7 @@ module.exports = grammar({
_atom_noli: ($) => choice(
alias($.word_noli, $.word),
$._atom_common,
// $._args,
),
word_noli: ($) => choice(
// Lines contained by line_li must not start with a listitem symbol.
Expand All @@ -58,7 +60,7 @@ module.exports = grammar({
),

// Explicit special cases: these are plaintext, not errors.
_word_common: () => choice(
_word_common: () => prec.left(choice(
// NOT tag: isolated "*".
'*',
// NOT optionlink: '
Expand All @@ -83,7 +85,7 @@ module.exports = grammar({
// NOT codeblock: random ">" in middle of the motherflippin text.
'>',
',',
),
)),

keycode: () => choice(
/<[-a-zA-Z0-9_]+>/,
Expand Down Expand Up @@ -210,6 +212,7 @@ module.exports = grammar({
// Inline code (may contain whitespace!): `foo bar`
codespan: ($) => _word($, /[^``\n]+/, '`', '`'),
// Argument: {arg} (no whitespace allowed)
_args: ($) => seq('[', $.argument, repeat1(seq(optional(','), $.argument)), ']'),
argument: ($) => _word($, /[^}\n\t ]+/, '{', '}'),
// Optional argument: [arg] (no whitespace allowed)
optional_arg: ($) => _word($, /[^\]\n\t ]+/, '[', ']'),
Expand Down

0 comments on commit 9f944ed

Please sign in to comment.