Debian Codegraph @

book/ts-query.js

raw symbols SCIP
1 hljs.registerLanguage("tsq", function (hljs) {
2 const IDENT = /[A-Za-z_][\w-]*/;
3 return {
4 name: "Tree-sitter Query",
5 aliases: ["scm"],
6 contains: [
7 hljs.COMMENT(";", "$"),
8 hljs.QUOTE_STRING_MODE,
9 // @capture.name (with dots and dashes)
10 { className: "variable", begin: /@[\w.\-]+/ },
11 // #predicate? — #eq?, #match?, #any-of?, #kind-eq?, #same-line?, ...
12 { className: "built_in", begin: /#[\w\-]+\?/ },
13 // #directive! — #set!, #select-adjacent!, #strip!, #trim!, #gsub!
14 { className: "meta", begin: /#[\w\-]+!/ },
15 // field name: or negated !field:
16 { className: "attr", begin: /!?[A-Za-z_][\w-]*:/ },
17 // wildcard and special node kinds
18 { className: "literal", begin: /\b(?:_|MISSING|ERROR)\b/ },
19 // named node kind (must come after field/wildcard rules)
20 { className: "title", begin: IDENT },
21 // anchors and quantifiers: . * + ?
22 { className: "operator", begin: /[.*+?]/ },
23 ],
24 };
25 });