mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add parsers module and better match iter
The `parsers` module manages parsers for us, for now only in a really
basic way.
iter_prepared_mathes iters on an enhanced versions of the matches, where
captures are directly accessible via their names to allow things like :
((itentifier) @def.first (identifier) @def.last)
To be handled like this in lua:
match.def.first
match.def.last
Also adds a `set!` predicate to allow setting data within the prepared
match (see queries/lua/locals.scm) for examples.
This commit is contained in:
parent
5897d72b07
commit
2526baf4cc
4 changed files with 100 additions and 19 deletions
|
|
@ -1,10 +1,13 @@
|
|||
local api = vim.api
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
|
||||
local M = {}
|
||||
|
||||
-- This function sets up everythin needed for a given language
|
||||
-- this is the main interface through the plugin
|
||||
function M.setup(lang)
|
||||
if parsers.has_parser(lang) then
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue