The project consists of
- grammar.js the tree-sitter grammar for xQuery.
- test/corpus/
- queries/ highlight.scm etc
- examples/ xQuery example files
- config this is the symlinked to the
$HOME/.tree-sitter
- Makefile: some tree-sitter shortcut commands, helped by a dot env file
The top-level make
just invokes tree-sitter generate
.
To adjust what files are tested, parsed or queried, I alter vars in '.env'.
make test
var TEST_SECTION: will test my current working section under test.
For make parse
, make test
, make query
and make hl
, will use the EXAMPLE file in the examples folder
Although there is a lot to digest the guides I have found useful are
Capture queries are written as S-expresions
- hightlights: WIP
- locals: TODO
- folds: TODO
- indents: TODO
The above are built in, but there should be other queries associated with treesitter plugin modules
Apart from looking at how other grammar queries are constructed, I refer to the following
- pattern matching with queries
- syntax highlighting queries
- emacs syntax highlighting query guide↲
- neovim treesitter contributing
- neovim treesitter text
Captures will only capture if a query will resolve to a valid node in the grammer.
So frequently running make query-all
is a good idea, as it will throw an diagnostic error
errors if ':' or ')' at end of comment delimiter
(: OK! (: xquery allows embed comments :) :)
(:~
: ok with doc style comments
:
:)
(: but this will error ::)
There are no lookahead regex expr allowed for tree-sitter grammars, so this might no be resolved, unless a c lexer is used. Thats what other TS grammars use.
not sure how to resolve
TODO