Skip to content

Commit

Permalink
fix: unclosed "{", argument with whitespace #41
Browse files Browse the repository at this point in the history
fix #34
fix #38
fix #39
fix #40
  • Loading branch information
justinmk authored Oct 14, 2022
1 parent bf6a269 commit 22d5dcd
Show file tree
Hide file tree
Showing 5 changed files with 4,883 additions and 3,811 deletions.
73 changes: 67 additions & 6 deletions corpus/arguments.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
================================================================================
simple argument
argument
================================================================================
This in an argument: {arg}
argument: {arg}
argument: {arg arg}
CTRL-R CTRL-R {register CTRL-F}
list of { uri:string, name: string } tables


--------------------------------------------------------------------------------
Expand All @@ -10,11 +13,26 @@ This in an argument: {arg}
(block
(line
(word)
(argument
(word)))
(line
(word)
(argument
(word)))
(line
(word)
(word)
(keycode)
(argument
(word)))))
(word)))
(line
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word))))

================================================================================
multiple arguments on the same line
Expand Down Expand Up @@ -54,6 +72,14 @@ argument in parentheses
NOT an argument
================================================================================
{foo "{bar}" `{baz}` |{baz| } {}
foo { bar
{ {} foo{{ foo{{{
{{
{{{
{ } foo
, inside { }:
\} literal } x
\{ literal { x

===============
3. Netrw *netrw-ref* {{{1
Expand All @@ -66,15 +92,50 @@ EXTERNAL *netrw-externapp* {{{2
(help_file
(block
(line
(word)
(ERROR
(word))
(argument
(word)
(MISSING "}"))
(word))
(word)
(codespan
(word))
(taglink
(word))
(word)
(word))
(line
(word)
(word)
(word))
(line
(word)
(word)
(word)
(word))
(line
(word))
(line
(word))
(line
(word)
(word)
(word))
(line
(word)
(word)
(word)
(word)
(word))
(line
(word)
(word)
(word)
(word))
(line
(word)
(word)
(word)
(word)))
(block
(line
Expand Down
8 changes: 5 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ module.exports = grammar({
seq('|', /[^|\n\t ]+/),
// NOT taglink: "||".
/\|\|*/,
// NOT argument: "{}".
/\{\}/,
// NOT argument:
'{',
'}',
'{}',
/\{\{+[0-9]*/,
'(',
/\w+\(/,
Expand Down Expand Up @@ -201,7 +203,7 @@ module.exports = grammar({
// Inline code (may contain whitespace!): `foo bar`
codespan: ($) => _word($, /[^``\n]+/, '`', '`'),
// Argument: {arg}
argument: ($) => _word($, /[^{}\n\t ]+/, '{', '}'),
argument: ($) => _word($, /[^{}\n\t ][^{}\n\t]*/, '{', '}'),
},
});

Expand Down
14 changes: 11 additions & 3 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,16 @@
"value": "\\|\\|*"
},
{
"type": "PATTERN",
"value": "\\{\\}"
"type": "STRING",
"value": "{"
},
{
"type": "STRING",
"value": "}"
},
{
"type": "STRING",
"value": "{}"
},
{
"type": "PATTERN",
Expand Down Expand Up @@ -893,7 +901,7 @@
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "PATTERN",
"value": "[^{}\\n\\t ]+"
"value": "[^{}\\n\\t ][^{}\\n\\t]*"
}
},
"named": true,
Expand Down
4 changes: 4 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@
"type": "{",
"named": false
},
{
"type": "{}",
"named": false
},
{
"type": "|",
"named": false
Expand Down
Loading

0 comments on commit 22d5dcd

Please sign in to comment.