neovim / tree-sitter-vimdoc

Tree-sitter parser for Vim help files

Repository from Github https://github.comneovim/tree-sitter-vimdocRepository from Github https://github.comneovim/tree-sitter-vimdoc

parse error: options.txt

jdhao opened this issue · comments

commented

Found tree-sitter-vimdoc parse error at: https://neovim.io/doc/user/options.html

Context:

	to check what is following.  E.g. for Javascript, if a function is
	defined with "func_name = function(args)": >
		^\s*\ze\i\+\s*=\s*function(
<	If the function is defined with "func_name : function() {...": >
	        ^\s*\ze\i\+\s*[:]\s*(*function\s*(
<	When using the ":set" command, you need to double the backslashes!
	To avoid that use `:let` with a single quote string: >

The 3rd code block is not rendered correctly as code block.

The 3rd code block is not rendered correctly as code block.

The unclosed { causes an error. Because {...} can contain spaces. For authoring Vim help, if syntax like {, *, and | are to mean anything at all (and give useful errors), then sometimes errors really need to be errors :)

So the fix here is to fix this help section, by changing the quotes to backticks. Alternatively, we could introduce a (quote) form (or specify that as a (word), but wouldn't handle multiline quotes) that captures things with quotes "...".