Skip to content

Commit 9f944ed

Browse files
committed
WIP
1 parent d772790 commit 9f944ed

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Diff for: corpus/argument.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ nvim_buf_detach_event[{buf}]
117117
(word))
118118
(line
119119
(word)
120-
(optional_arg
121-
(word)))))
120+
(argument
121+
(word))
122+
(word))))
122123

123124
================================================================================
124125
NOT an argument

Diff for: grammar.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = grammar({
2828
_atom: ($) => choice(
2929
$.word,
3030
$._atom_common,
31+
$._args,
3132
),
3233
word: ($) => choice(
3334
token(prec(-1, /[^,(\[\n\t ]+/)),
@@ -37,6 +38,7 @@ module.exports = grammar({
3738
_atom_noli: ($) => choice(
3839
alias($.word_noli, $.word),
3940
$._atom_common,
41+
// $._args,
4042
),
4143
word_noli: ($) => choice(
4244
// Lines contained by line_li must not start with a listitem symbol.
@@ -58,7 +60,7 @@ module.exports = grammar({
5860
),
5961

6062
// Explicit special cases: these are plaintext, not errors.
61-
_word_common: () => choice(
63+
_word_common: () => prec.left(choice(
6264
// NOT tag: isolated "*".
6365
'*',
6466
// NOT optionlink: '
@@ -83,7 +85,7 @@ module.exports = grammar({
8385
// NOT codeblock: random ">" in middle of the motherflippin text.
8486
'>',
8587
',',
86-
),
88+
)),
8789

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

0 commit comments

Comments
 (0)