Skip to content

Commit 30cd470

Browse files
authored
fix: invalid optionlink #48
fix #45 fix #46
1 parent eb90ebc commit 30cd470

File tree

6 files changed

+5082
-4867
lines changed

6 files changed

+5082
-4867
lines changed

corpus/line_block.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ li continues
132132
(word)
133133
(word)
134134
(word)
135+
(word)
135136
(word))
136137
(line)
137138
(line

corpus/optionlink.txt

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,22 @@ number: '04' 'ISO-10646-1' 'python3'
101101
(word)
102102
(word)
103103
(word)
104+
(word)
105+
(tag
106+
(word)
107+
(MISSING "*"))
108+
(word)
109+
(word)
110+
(word)
111+
(ERROR
112+
(word))
113+
(argument
114+
(word))
115+
(word)
104116
(word))
105117
(line
118+
(word)
119+
(word)
106120
(word)
107121
(word)
108122
(word)
@@ -121,7 +135,7 @@ number: '04' 'ISO-10646-1' 'python3'
121135
(word))))
122136

123137
================================================================================
124-
NOT optionlink 2 (FIXME)
138+
NOT optionlink 2
125139
================================================================================
126140
'{a-z} `{a-z} foo
127141
x `after_codespan`'s
@@ -130,21 +144,22 @@ x `after_codespan`'s
130144
--------------------------------------------------------------------------------
131145

132146
(help_file
133-
(ERROR)
134147
(block
135148
(line
136-
(argument
137-
(word))
138-
(word))
149+
(word)
150+
(word)
151+
(codespan
152+
(word)
153+
(MISSING "`")))
139154
(line
140155
(word)
141156
(codespan
142157
(word))
143-
(word
144-
(MISSING "'")))))
158+
(word)
159+
(ERROR))))
145160

146161
================================================================================
147-
NOT optionlink 3 (FIXME)
162+
NOT optionlink 3
148163
================================================================================
149164
foo '"\ '. Notice
150165
|foo|
@@ -156,7 +171,9 @@ foo '"\ '. Notice
156171
(block
157172
(line
158173
(word)
159-
(ERROR)
174+
(word)
175+
(word)
176+
(word)
160177
(word))
161178
(line
162179
(taglink

corpus/taglink.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ Note: ":autocmd" can...
129129
(word)
130130
(word))
131131
(line
132+
(word)
133+
(word)
132134
(word)
133135
(word))
134136
(line

grammar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ module.exports = grammar({
6262
// Explicit special cases: these are plaintext, not errors.
6363
_word_common: () => choice(
6464
// NOT optionlink: single "'".
65-
/'[\t ]/,
66-
// NOT optionlink: contains any non-lowercase char.
67-
seq("'", token.immediate(/[^'\n\t ]*[^'a-z\n\t ][^'\n\t ]*/), token.immediate("'")),
65+
"'",
66+
// NOT optionlink: followed by non-lowercase char.
67+
seq("'", token.immediate(/[a-z]*[^'a-z\n\t ][a-z]*/), optional(token.immediate("'"))),
6868
// NOT optionlink: single char surrounded by "'".
6969
seq("'", token.immediate(/[^'\n\t ]/), token.immediate("'")),
7070
// NOT taglink: "||", "|"

src/grammar.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@
168168
"type": "CHOICE",
169169
"members": [
170170
{
171-
"type": "PATTERN",
172-
"value": "'[\\t ]"
171+
"type": "STRING",
172+
"value": "'"
173173
},
174174
{
175175
"type": "SEQ",
@@ -182,15 +182,23 @@
182182
"type": "IMMEDIATE_TOKEN",
183183
"content": {
184184
"type": "PATTERN",
185-
"value": "[^'\\n\\t ]*[^'a-z\\n\\t ][^'\\n\\t ]*"
185+
"value": "[a-z]*[^'a-z\\n\\t ][a-z]*"
186186
}
187187
},
188188
{
189-
"type": "IMMEDIATE_TOKEN",
190-
"content": {
191-
"type": "STRING",
192-
"value": "'"
193-
}
189+
"type": "CHOICE",
190+
"members": [
191+
{
192+
"type": "IMMEDIATE_TOKEN",
193+
"content": {
194+
"type": "STRING",
195+
"value": "'"
196+
}
197+
},
198+
{
199+
"type": "BLANK"
200+
}
201+
]
194202
}
195203
]
196204
},

0 commit comments

Comments
 (0)