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

feat!: support only "-", "•" as listitem, constrain (argument) definition #97

Merged
merged 6 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Overview
- contains headings (`h1`, `h2`, `h3`, `column_heading`) because `codeblock`
terminated by "implicit stop" (no terminating `<`) consumes blank lines, so
`block` has no way to end.
- `line_li` ("list item")
- `line_li` ("listitem")
- lines starting with `-`/`•` (_not_ `+`/`*`) are listitems.
- consumes lines until blank line, codeblock, or next listitem.
- nesting is ignored: indented listitems are parsed as siblings.
- `codeblock`:
Expand Down Expand Up @@ -48,7 +49,7 @@ Known issues
- `url` doesn't handle _nested_ parens. E.g. `(https://example.com/(foo)#yay)`
- `column_heading` currently only recognizes tilde `~` preceded by space (i.e.
`foo ~` not `foo~`). This covers 99% of :help files.
- `column_heading` children should be plaintext. Currently its children are parsed as `$._atom`.
- `column_heading` children should be plaintext, but currently are parsed as `$._atom`.

TODO
----
Expand Down
29 changes: 21 additions & 8 deletions corpus/arguments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
argument
================================================================================
argument: {arg}
argument: {arg arg}
CTRL-R CTRL-R {register CTRL-F}
tuple: {arg,arg}
keycode: CTRL-R {CTRL-R} {register CTRL-F}
list of { uri:string, name: string } tables


Expand All @@ -23,7 +23,12 @@ list of { uri:string, name: string } tables
(word)
(keycode)
(argument
(word)))
(word))
(word)
(ERROR
(word))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{arg} no longer allows whitespace. That wasn't used in any :help docs anyway, and isn't in vim's help syntax.

(keycode)
(word))
(line
(word)
(word)
Expand Down Expand Up @@ -71,6 +76,7 @@ argument in parentheses
================================================================================
NOT an argument
================================================================================
a '{' '}' block
{foo "{bar}" `{baz}` |{baz| } {}
foo { bar
{ {} foo{{ foo{{{
Expand All @@ -92,11 +98,18 @@ EXTERNAL *netrw-externapp* {{{2
(help_file
(block
(line
(argument
(word)
(ERROR
(word)
(word)))
(word)
(word)
(word)
(word)
(word)
(word)
(word)
(word))
(line
(word)
(ERROR
(word))
(word)
(codespan
(word))
Expand Down
6 changes: 4 additions & 2 deletions corpus/heading3-column_heading.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,13 @@ buffer-diagram
(word))
(line
(word)
(word)
(ERROR
(word))
(word))
(line
(word)
(word)
(ERROR
(word))
(word))
(line
(taglink
Expand Down
71 changes: 58 additions & 13 deletions corpus/line_block.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@ block2 text text
================================================================================
listitems
================================================================================
* list1.a item1
* - •
- list1.a item1
- - •
• word,
!foo! ~bar. word word
'item' line3 |foo|
* x 'list1.a' ~/foo/bar.txt
- x 'list1.a' ~/foo/bar.txt
li continues
* {nested} here
- {nested} here

* 'list2' item w3
* *nested_li* word *tag2*
* list2 item w3
* nested_li-2
'list2' item w3
- *nested_li* word *tag2*
list2 item w3
- nested_li-2
foo
foo

Expand Down Expand Up @@ -178,16 +178,16 @@ li continues
listitem with codeblock
================================================================================

* list1.a item1 >
list1.a item1 >
foo
< * list1.b item1
* w1 w2
< list1.b item1
w1 w2
w3 >
code1 {
code2
}
<* w1
* w2 w3
< w1
w2 w3
`item2` line2
{item2} line3

Expand Down Expand Up @@ -291,3 +291,48 @@ listitems + lines without blank lines
(argument
(word))
(word)))))

================================================================================
listitem tricky
================================================================================

- x - x

-x -x

- - x -x
- -x - x
- -


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

(help_file
(block
(line_li
(line
(word)
(word)
(word))
(line)))
(block
(line
(word)
(word)))
(block
(line_li
(line
(word)
(word)
(word))
(line))
(line_li
(line
(word)
(word)
(word))
(line))
(line_li
(line
(word))
(line))))
25 changes: 7 additions & 18 deletions corpus/optionlink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ NOT optionlink: ' or 'x
================================================================================
'fillchars'
stl ' ' or '^' statusline
wbr ' ' windowbar
tricky: ' 'yes' 's foo


Expand All @@ -51,11 +50,6 @@ tricky: ' 'yes' 's foo
(word)
(word)
(word))
(line
(word)
(word)
(word)
(word))
(line
(word)
(word)
Expand All @@ -72,9 +66,8 @@ no! ','sqlKeyword'
single-char '-' 'g' '보'
non-ascii: '\"' '%)' '-bang' '.*\\.log' '.gitignore' '@{${\"foo\"}}'
number: '04' 'ISO-10646-1' 'python3'

Option ' :help 'textwidth'
Regular / :help /[
Option ' :help 'textwidth'
Regular / :help /[


--------------------------------------------------------------------------------
Expand All @@ -101,16 +94,13 @@ number: '04' 'ISO-10646-1' 'python3'
(word)
(word)
(word)
(tag
(word)
(MISSING "*"))
(word)
(ERROR
(word))
(word)
(word)
(argument
(word)
(ERROR
(word)
(word)))
(word))
(word)
(word))
(line
Expand All @@ -119,8 +109,7 @@ number: '04' 'ISO-10646-1' 'python3'
(word)
(word)
(word)
(word)))
(block
(word))
(line
(word)
(word)
Expand Down
3 changes: 2 additions & 1 deletion corpus/taglink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ Note: ":autocmd" can...
(line
(word)
(word)
(word)
(ERROR
(word))
(word))
(line
(word)
Expand Down
57 changes: 27 additions & 30 deletions corpus/tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ NOT a tag
================================================================================
* bullet1
* bullet2 bullet2
* bullet3
bullet3 bullet3
* bullet4

0 \* escaped
0 (paren *)
1 "*" not
2 * not
3this *not no
Expand All @@ -93,47 +92,45 @@ NOT a tag

(help_file
(block
(line_li
(line
(word))
(line))
(line_li
(line
(word)
(word))
(line))
(line_li
(line
(word))
(line)
(line
(word)
(word)))
(line_li
(line
(word))
(line)))
(line
(word)
(word))
(line
(word)
(word)
(word)))
(block
(line
(word)
(word)
(word))
(line
(word)
(ERROR)
(word)
(word)
(word)
(ERROR
(word)))
(line
(word)
(word)
(word))
(line
(word)
(tag
(word)
(MISSING "*"))
(word)
(word))
(line
(word)
(word)
(ERROR
(word))
(word)))
(block
(line
(word)
(tag
(word)
(MISSING "*"))
(word)
(ERROR
(word))
(word)
(word)
(word))))
Loading