Skip to content

Commit

Permalink
Merge #108 argument in "vim.foo({bar})"
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmk authored Jun 25, 2023
2 parents 755b801 + 4531955 commit 8c0469d
Show file tree
Hide file tree
Showing 11 changed files with 4,310 additions and 4,017 deletions.
52 changes: 49 additions & 3 deletions corpus/arguments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ list of { uri:string, name: string } tables
(word)
(word)
(word)
(word)
(word))))

================================================================================
Expand All @@ -61,13 +62,61 @@ multiple arguments on the same line
argument in parentheses
================================================================================
({aaa})
vim.foo({bar})
vim.foo( {bar})
nvim_foo({bar})
nvim_foo({bar},{baz})
nvim_foo({bar}, {baz})
nvim_buf_detach_event[{buf}]


--------------------------------------------------------------------------------

(help_file
(block
(line
(word)
(argument
(word))
(word))
(line
(word)
(word)
(argument
(word))
(word))
(line
(word)
(word)
(argument
(word))
(word))
(line
(word)
(word)
(argument
(word))
(word))
(line
(word)
(word)
(argument
(word))
(word)
(argument
(word))
(word))
(line
(word)
(word)
(argument
(word))
(word)
(argument
(word))
(word))
(line
(word)
(word)
(argument
(word))
Expand Down Expand Up @@ -103,8 +152,6 @@ EXTERNAL *netrw-externapp* {{{2
(word)
(word)
(word)
(word)
(word)
(word))
(line
(word)
Expand Down Expand Up @@ -138,7 +185,6 @@ EXTERNAL *netrw-externapp* {{{2
(word)
(word)
(word)
(word)
(word))
(line
(word)
Expand Down
34 changes: 19 additions & 15 deletions corpus/codeblock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ To test for a non-empty string, use empty(): >
(word)
(word)
(word)
(word)
(word))
(line
(word)
Expand All @@ -352,6 +353,8 @@ To test for a non-empty string, use empty(): >
(word)
(word)
(word)
(word)
(word)
(codeblock
(code
(line))))))
Expand Down Expand Up @@ -393,6 +396,7 @@ codeblock stop and start on same line
(tag
(word)))
(line
(word)
(word)
(word)
(word))
Expand Down Expand Up @@ -437,7 +441,7 @@ Not a language annotation: >lua is not at EOL
(word)
(word))
(line
(word)))
(word)))
(block
(line
(word)
Expand All @@ -447,18 +451,18 @@ Not a language annotation: >lua is not at EOL
(word)
(word))
(line
(word)))
(word)))
(block
(line
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word))
(line
(word))))
(line
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word))
(line
(word))))
1 change: 1 addition & 0 deletions corpus/heading3-column_heading.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()*
(word))))
(block
(line
(word)
(word)
(argument
(word))
Expand Down
1 change: 1 addition & 0 deletions corpus/line_block.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ li continues
(line))
(line_li
(line
(word)
(word))
(line)
(line
Expand Down
3 changes: 2 additions & 1 deletion corpus/optionlink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Regular / :help /[
(word)
(word))
(line
(word)
(word)
(word)
(word))
Expand All @@ -101,7 +102,6 @@ Regular / :help /[
(word)
(argument
(word))
(word)
(word))
(line
(word)
Expand All @@ -120,6 +120,7 @@ Regular / :help /[
(word)
(word)
(word)
(word)
(word))))

================================================================================
Expand Down
2 changes: 2 additions & 0 deletions corpus/taglink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Hello |world| hello
(taglink
(word))
(word)
(word)
(word)
(word))
(line
(taglink
Expand Down
7 changes: 7 additions & 0 deletions corpus/url.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,11 @@ markdown: [https://neovim.io/doc/user/#yay](https://neovim.io/doc/user/#yay).
(word))
(line
(word)
(word)
(url
(word))
(word)
(word)
(url
(word))
(word))))
12 changes: 5 additions & 7 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ module.exports = grammar({
$._atom_common,
),
word: ($) => choice(
// Try the more-restrictive pattern at higher relative precedence, so that things like
// "foo({a})" parse as "(word) (argument)" instead of "(word)".
token(prec(-1, /[^\n\t{ ][^\n\t ]*/)),
token(prec(-2, /[^\n\t ]+/)),
token(prec(-1, /[^,(\[\n\t ]+/)),
$._word_common,
),

Expand All @@ -43,7 +40,7 @@ module.exports = grammar({
),
word_noli: ($) => choice(
// Lines contained by line_li must not start with a listitem symbol.
token(prec(-1, /[^-•\n\t ][^\n\t ]*/)),
token(prec(-1, /[^-•\n\t ][^(\[\n\t ]*/)),
token(prec(-1, /[-•][^\n\t ]+/)),
$._word_common,
),
Expand Down Expand Up @@ -76,14 +73,15 @@ module.exports = grammar({
'|',
// NOT argument:
'{',
'}',
'{}',
/\{\{+[0-9]*/,

'(',
/\w+\(/,
'[',
'~',
// NOT codeblock: random ">" in middle of the motherflippin text.
'>',
',',
),

keycode: () => choice(
Expand Down
27 changes: 8 additions & 19 deletions src/grammar.json

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

8 changes: 8 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 8c0469d

Please sign in to comment.