Skip to main content

Module pattern

Module pattern 

Source
Expand description

semlith pattern: a tree-sitter structural query over the indexed files of one language.

The question this answers is the one a regex cannot: “every call whose receiver is self.index”, “every struct with a lifetime parameter”. The graph already parses these files with these grammars; this exposes the parser to a caller who knows what shape they are looking for.

Two things keep it honest. The grammar comes from crate::graph’s own table, so a language pattern accepts is a language the extractor accepts and there is no second list to drift. And the text comes from the store’s chunks rather than from disk, for the reason crate::Semlith::read does: the boundary that decided what may be indexed is the boundary that decides what may be read back.

Structs§

Match
One captured node.
Matches
What one pattern run produced.

Constants§

MAX_FILES
How many files one pattern will parse.
MAX_MATCHES
How many captures one pattern will return before it stops and says so.

Functions§

run
Run source as a tree-sitter query over every indexed file of language.