Macro construct_language

Source
macro_rules! construct_language {
    ($name:ident($tslang:expr).[$($ext:ident)+]?=$query_name:ident->$query:literal ) => { ... };
}
Expand description

Use to more easily make new SupportedLanguages. First provide the name (which is used as the type of the language), followed by the tree sitter languge in parenthesis, next you put the file extensions in brackets with a leading . to specify the query we use ?= variable -> string literal query. In the query you when you want use the variable just do {variable}.

Example:

use function_grep::construct_language;
use function_grep::supported_languages::SupportedLanguage;
use tree_sitter::Language;
construct_language!(C(tree_sitter_c::language()).[c h]?=
   name ->  "((function_definition
 declarator:
 (function_declarator declarator: (identifier) @method-name))
 @method-definition
 (#eq? @method-name {name}))
((declaration declarator:
 (function_declarator declarator: (identifier) @method-name))
 @method-definition
 (#eq? @method-name {name}))"
);