Skip to content

Commit c03640a

Browse files
authored
Merge #31 fix: errors from single ' or |
2 parents d595021 + 6cd420d commit c03640a

File tree

5 files changed

+3257
-3188
lines changed

5 files changed

+3257
-3188
lines changed

corpus/optionlink.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,40 @@ world 'hello' world
2828
(word))
2929
(word))))
3030

31+
================================================================================
32+
NOT optionlink: ' followed by whitespace
33+
================================================================================
34+
'fillchars'
35+
stl ' ' or '^' statusline
36+
wbr ' ' windowbar
37+
tricky: ' 'yes'
38+
39+
40+
--------------------------------------------------------------------------------
41+
42+
(help_file
43+
(block
44+
(line
45+
(optionlink
46+
(word)))
47+
(line
48+
(word)
49+
(word)
50+
(word)
51+
(word)
52+
(word)
53+
(word))
54+
(line
55+
(word)
56+
(word)
57+
(word)
58+
(word))
59+
(line
60+
(word)
61+
(word)
62+
(optionlink
63+
(word)))))
64+
3165
================================================================================
3266
NOT optionlink #7 #14
3367
================================================================================

corpus/taglink.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ taglink in parentheses
7070
================================================================================
7171
NOT a taglink
7272
================================================================================
73-
7473
whitespace |world foo bar|
74+
|
75+
rx |
76+
rx | ry
7577
adjacent || |||
7678
table-borders |=========| |---------|
7779

@@ -93,6 +95,16 @@ Note: ":autocmd" can...
9395
(MISSING "|"))
9496
(word)
9597
(word))
98+
(line
99+
(word
100+
(MISSING "_word_common_token5")))
101+
(line
102+
(word)
103+
(ERROR))
104+
(line
105+
(word)
106+
(word)
107+
(word))
96108
(line
97109
(word)
98110
(word)

grammar.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ module.exports = grammar({
6262
// Explicit special cases: these are plaintext, not errors.
6363
_word_common: () => choice(
6464
// NOT optionlink: single "'".
65-
/[\t ]'[\t ]/,
65+
/'[\t ]/,
6666
// NOT optionlink: contains any non-lowercase char.
6767
seq("'", token.immediate(/[^'\n\t ]*[^'a-z\n\t ][^'\n\t ]*/), token.immediate("'")),
6868
// NOT optionlink: single char surrounded by "'".
6969
seq("'", token.immediate(/[^'\n\t ]/), token.immediate("'")),
7070
// NOT taglink: single "|".
71-
/[\t ]\|[\t ]/,
71+
/\|[\t ]/,
72+
// NOT taglink: "|foo".
73+
seq('|', /[^|\n\t ]+/),
7274
// NOT taglink: "||".
7375
/\|\|*/,
7476
// NOT argument: "{}".

src/grammar.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
"members": [
170170
{
171171
"type": "PATTERN",
172-
"value": "[\\t ]'[\\t ]"
172+
"value": "'[\\t ]"
173173
},
174174
{
175175
"type": "SEQ",
@@ -219,7 +219,20 @@
219219
},
220220
{
221221
"type": "PATTERN",
222-
"value": "[\\t ]\\|[\\t ]"
222+
"value": "\\|[\\t ]"
223+
},
224+
{
225+
"type": "SEQ",
226+
"members": [
227+
{
228+
"type": "STRING",
229+
"value": "|"
230+
},
231+
{
232+
"type": "PATTERN",
233+
"value": "[^|\\n\\t ]+"
234+
}
235+
]
223236
},
224237
{
225238
"type": "PATTERN",

0 commit comments

Comments
 (0)