Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: errors from single ' or | #31

Merged
merged 3 commits into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: single ' parsed as (optionlink) error
Single apostrophes are found in various :help documents such as ":help
'fillchars'". They should be treated as plaintext.
  • Loading branch information
justinmk committed Oct 9, 2022
commit e0740259ac433fa7195705ccff76021d32c483c7
34 changes: 34 additions & 0 deletions corpus/optionlink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,40 @@ world 'hello' world
(word))
(word))))

================================================================================
NOT optionlink: ' followed by whitespace
================================================================================
'fillchars'
stl ' ' or '^' statusline
wbr ' ' windowbar
tricky: ' 'yes'


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

(help_file
(block
(line
(optionlink
(word)))
(line
(word)
(word)
(word)
(word)
(word)
(word))
(line
(word)
(word)
(word)
(word))
(line
(word)
(word)
(optionlink
(word)))))

================================================================================
NOT optionlink #7 #14
================================================================================
Expand Down
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = grammar({
// Explicit special cases: these are plaintext, not errors.
_word_common: () => choice(
// NOT optionlink: single "'".
/[\t ]'[\t ]/,
/'[\t ]/,
// NOT optionlink: contains any non-lowercase char.
seq("'", token.immediate(/[^'\n\t ]*[^'a-z\n\t ][^'\n\t ]*/), token.immediate("'")),
// NOT optionlink: single char surrounded by "'".
Expand Down