-
Notifications
You must be signed in to change notification settings - Fork 13
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
remove scanner, rewrite grammar.js #16
Conversation
corpus/headline.txt
Outdated
|
||
================================================================================ | ||
Headline with tag at the start | ||
headline with tag at the start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use lowercase descriptions so that tree-sitter test --filter headline
is easy to use.
@vigoux any idea how I can fix this? Is CI installing an older version of tree-sitter CLI? |
|
It is pretty surprising... I'll look into this problem today. |
I pushed a fix for that in latest master. To ensure consistency of the parser version, I recommend you to:
This should handle all the version management for us now. |
Yes, looks like CI installs an old parser (0.20.0)? As ABI 14 is now (0.20.7) the default, it would be better to update the CI. |
The CI uses the locked version of tree-sitter. In latest master the locked version now supports ABI 14, and furthermore, the default ABI for this parser should now be 14. |
Any interest in including queries in this repo, too, so CI can catch breaking changes that require query updates on PRs? (Does this PR require query updates?) |
Would be good too. |
You can start with https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/help/highlights.scm We don't need to follow the strict corset of nvim-treesitter, but it would help; the allowed text captures are here: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#text |
yeah, mostly the introduction of:
I will probably alias For "inner content" I have named the If we're open to renaming things, I suggest:
|
|
We are. If you add the new queries here, I'll just plonk them into (The parser is currently marked as "experimental", so I have no qualms about breaking things. Could think about removing that label, though, if you deem things stable enough after this PR.) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Without changing the "spec" for help files, I think that this cannot be handled in the parser. The parser user would have to guess the filetype of the codeblock by looking at what it contains otherwise. |
Isn't that something that can be added later? Could also extend the vimdoc spec as @vigoux mentioned, e.g. |
This comment was marked as off-topic.
This comment was marked as off-topic.
By the way, I am okay with renaming things. I think taking a fresh start is great. |
This comment was marked as off-topic.
This comment was marked as off-topic.
For the record, this seems to fail parsing some options. |
Yes, I need to fix some stuff |
options are fixed (locally, WIP), now 2 other issues to fix :D getting close... |
Ok all tests are passing and I think the results are pretty good. I will note the compromises as PR comments. I didn't rename anything yet, nor add highlights. Should that wait for a followup PR? |
(line | ||
(argument | ||
(word) | ||
(ERROR)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave up on this for now, ideally it should be:
(argument
(word)
(MISSING "}"))
corpus/backtick.txt
Outdated
================================================================================ | ||
|
||
Hello `world`, I am a markup language | ||
Hello `world`, I am `markup language`. But `this is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The grammar supports same-line whitespace in a codespan, but I'm not sure if that's actually supported by vimdoc format.
Best to rip the bandaid off in one go. And, yes, please add queries; it's good practice to keep them in sync, otherwise I'll have to manually fix the ones we bundle or it will block all updates in nvim-treesitter. (Can be improved later; the main point is that they don't error out with the new parser.) |
Plan
|
Problem: Hand-written C scanner is hard to maintain, slow, and hangs on files like `filetype.txt` and `usr_24.txt`. Solution: Delete hand-written C scanner, define grammar fully in `grammar.js` - introduce `url` - introduce `block`, a group of lines. (does not support nesting yet) - introduce `line_li` for listitems. (does not support nesting yet) - keycodes #1 - `[range]` #1 fix #1 fix #7 fix #9 fix #10 fix #11 fix #14 fix #12 (except nested) fix #13 (except nested)
Latest push includes renamed forms. See updated comment #16 (comment) for summary. |
You should have commit access now, feel free to merge this PR and take the parser over from here |
fixes for url, column_name, etc.
- adapt to parser changes from neovim/tree-sitter-vimdoc#16 - numerous other generator improvements
- adapt to parser changes from neovim/tree-sitter-vimdoc#16 - numerous other generator improvements
- adapt to parser changes from neovim/tree-sitter-vimdoc#16 - numerous other generator improvements
- adapt to parser changes from neovim/tree-sitter-vimdoc#16 - numerous other generator improvements
url
andblock
(group ofline
s)filetype.txt
,usr_24.txt
[range]
more syntax features: keycodes, special, parameters #1vim.treesitter.get_captures_at_cursor()
code blocksfixup remaining test failuresfix #7
fix #9
fix #10
fix #11
fix #14
fix #12 (non-nested)
fix #13 (non-nested)
fix #17