Skip to content

Commit

Permalink
fix: column_heading does not allow space after "~"
Browse files Browse the repository at this point in the history
Example from ":help definitions":

    2. bbb		2. bbb		2. bbb		10. ddd
    3. ccc ccc ccc	3. ccc ccc ccc	3. ccc ccc c	11. ~
  • Loading branch information
justinmk committed Oct 5, 2022
1 parent 33afae9 commit fc1b022
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
6 changes: 2 additions & 4 deletions corpus/codespan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ an error`.
(word))
(word)
(word)
(codespan
(ERROR
(word)
(MISSING "`")))
(line
(word)
(word))
(word))))

================================================================================
Expand Down
4 changes: 4 additions & 0 deletions corpus/heading3-column_heading.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ ABC not-h3
NOT column_heading
================================================================================
tilde ~/foo/bar foo~ bar
trailing-space-is-NOT-column_heading ~


--------------------------------------------------------------------------------
Expand All @@ -243,5 +244,8 @@ tilde ~/foo/bar foo~ bar
(line
(word)
(word)
(word)
(word))
(line
(word)
(word))))
16 changes: 11 additions & 5 deletions corpus/optionlink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ x `after_codespan`'s
(ERROR)
(block
(line
(codespan
(argument
(word))
(ERROR))))
(word))
(ERROR
(word)
(codespan
(word)))))

================================================================================
NOT optionlink 3 (FIXME)
Expand All @@ -116,6 +120,8 @@ foo '"\ '. Notice
(block
(line
(word)
(word
(ERROR)
(MISSING "'")))))
(ERROR)
(word))
(line
(taglink
(word)))))
5 changes: 1 addition & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ module.exports = grammar({
// TODO: children should be $.word (plaintext), not $.atom.
column_heading: ($) => seq(
field('name', seq(choice($._atom_noli, $._uppercase_words), repeat($._atom))),
choice(
token.immediate(/~[\t ]*\n/),
/~[\t ]*\n/,
),
/~\n/,
),

h1: ($) =>
Expand Down

0 comments on commit fc1b022

Please sign in to comment.