xonecas.io
7814
Ta

tiny-c-agent / files

tiny-c-agent / src / queries.generated.c

16.3 KB
1// Generated by tools/gen_queries.py from vendor/queries. Do not edit.
2// Refresh with `make queries`.
3
4#include "queries.h"
5
6static const tiny_query tiny_queries[] = {
7    {"bash",
8     "[\n  (string)\n  (raw_string)\n  (heredoc_body)\n  (heredoc_start)\n] @string\n\n(command_name) @function\n\n(variable_name) @property\n\n[\n  \"case\"\n  \"do\"\n  \"done\"\n  \"elif\"\n  \"else\"\n  \"esac\"\n  \"export\"\n  \"fi\"\n  \"for\"\n  \"function\"\n  \"if\"\n  \"in\"\n  \"select\"\n  \"then\"\n  \"unset\"\n  \"until\"\n  \"while\"\n] @keyword\n\n(comment) @comment\n\n(function_definition name: (word) @function)\n\n(file_descriptor) @number\n\n[\n  (command_substitution)\n  (process_substitution)\n  (expansion)\n]@embedded\n\n[\n  \"$\"\n  \"&&\"\n  \">\"\n  \">>\"\n  \"<\"\n  \"|\"\n] @operator\n\n(\n  (command (_) @constant)\n  (#match\? @constant \"^-\")\n)\n"},
9    {"c",
10     "(identifier) @variable\n\n((identifier) @constant\n (#match\? @constant \"^[A-Z][A-Z\\\\d_]*$\"))\n\n\"break\" @keyword\n\"case\" @keyword\n\"const\" @keyword\n\"continue\" @keyword\n\"default\" @keyword\n\"do\" @keyword\n\"else\" @keyword\n\"enum\" @keyword\n\"extern\" @keyword\n\"for\" @keyword\n\"if\" @keyword\n\"inline\" @keyword\n\"return\" @keyword\n\"sizeof\" @keyword\n\"static\" @keyword\n\"struct\" @keyword\n\"switch\" @keyword\n\"typedef\" @keyword\n\"union\" @keyword\n\"volatile\" @keyword\n\"while\" @keyword\n\n\"#define\" @keyword\n\"#elif\" @keyword\n\"#else\" @keyword\n\"#endif\" @keyword\n\"#if\" @keyword\n\"#ifdef\" @keyword\n\"#ifndef\" @keyword\n\"#include\" @keyword\n(preproc_directive) @keyword\n\n\"--\" @operator\n\"-\" @operator\n\"-=\" @operator\n\"->\" @operator\n\"=\" @operator\n\"!=\" @operator\n\"*\" @operator\n\"&\" @operator\n\"&&\" @operator\n\"+\" @operator\n\"++\" @operator\n\"+=\" @operator\n\"<\" @operator\n\"==\" @operator\n\">\" @operator\n\"||\" @operator\n\n\".\" @delimiter\n\";\" @delimiter\n\n(string_literal) @string\n(system_lib_string) @string\n\n(null) @constant\n(number_literal) @number\n(char_literal) @number\n\n(field_identifier) @property\n(statement_identifier) @label\n(type_identifier) @type\n(primitive_type) @type\n(sized_type_specifier) @type\n\n(call_expression\n  function: (identifier) @function)\n(call_expression\n  function: (field_expression\n    field: (field_identifier) @function))\n(function_declarator\n  declarator: (identifier) @function)\n(preproc_function_def\n  name: (identifier) @function.special)\n\n(comment) @comment\n"},
11    {"javascript",
12     "; Variables\n;----------\n\n(identifier) @variable\n\n; Properties\n;-----------\n\n(property_identifier) @property\n\n; Function and method definitions\n;--------------------------------\n\n(function_expression\n  name: (identifier) @function)\n(function_declaration\n  name: (identifier) @function)\n(method_definition\n  name: (property_identifier) @function.method)\n\n(pair\n  key: (property_identifier) @function.method\n  value: [(function_expression) (arrow_function)])\n\n(assignment_expression\n  left: (member_expression\n    property: (property_identifier) @function.method)\n  right: [(function_expression) (arrow_function)])\n\n(variable_declarator\n  name: (identifier) @function\n  value: [(function_expression) (arrow_function)])\n\n(assignment_expression\n  left: (identifier) @function\n  right: [(function_expression) (arrow_function)])\n\n; Function and method calls\n;--------------------------\n\n(call_expression\n  function: (identifier) @function)\n\n(call_expression\n  function: (member_expression\n    property: (property_identifier) @function.method))\n\n; Special identifiers\n;--------------------\n\n((identifier) @constructor\n (#match\? @constructor \"^[A-Z]\"))\n\n([\n    (identifier)\n    (shorthand_property_identifier)\n    (shorthand_property_identifier_pattern)\n ] @constant\n (#match\? @constant \"^[A-Z_][A-Z\\\\d_]+$\"))\n\n((identifier) @variable.builtin\n (#match\? @variable.builtin \"^(arguments|module|console|window|document)$\")\n (#is-not\? local))\n\n((identifier) @function.builtin\n (#eq\? @function.builtin \"require\")\n (#is-not\? local))\n\n; Literals\n;---------\n\n(this) @variable.builtin\n(super) @variable.builtin\n\n[\n  (true)\n  (false)\n  (null)\n  (undefined)\n] @constant.builtin\n\n(comment) @comment\n\n[\n  (string)\n  (template_string)\n] @string\n\n(regex) @string.special\n(number) @number\n\n; Tokens\n;-------\n\n[\n  \";\"\n  (optional_chain)\n  \".\"\n  \",\"\n] @punctuation.delimiter\n\n[\n  \"-\"\n  \"--\"\n  \"-=\"\n  \"+\"\n  \"++\"\n  \"+=\"\n  \"*\"\n  \"*=\"\n  \"**\"\n  \"**=\"\n  \"/\"\n  \"/=\"\n  \"%\"\n  \"%=\"\n  \"<\"\n  \"<=\"\n  \"<<\"\n  \"<<=\"\n  \"=\"\n  \"==\"\n  \"===\"\n  \"!\"\n  \"!=\"\n  \"!==\"\n  \"=>\"\n  \">\"\n  \">=\"\n  \">>\"\n  \">>=\"\n  \">>>\"\n  \">>>=\"\n  \"~\"\n  \"^\"\n  \"&\"\n  \"|\"\n  \"^=\"\n  \"&=\"\n  \"|=\"\n  \"&&\"\n  \"||\"\n  \"\?\?\"\n  \"&&=\"\n  \"||=\"\n  \"\?\?=\"\n] @operator\n\n[\n  \"(\"\n  \")\"\n  \"[\"\n  \"]\"\n  \"{\"\n  \"}\"\n]  @punctuation.bracket\n\n(template_substitution\n  \"${\" @punctuation.special\n  \"}\" @punctuation.special) @embedded\n\n[\n  \"as\"\n  \"async\"\n  \"await\"\n  \"break\"\n  \"case\"\n  \"catch\"\n  \"class\"\n  \"const\"\n  \"continue\"\n  \"debugger\"\n  \"default\"\n  \"delete\"\n  \"do\"\n  \"else\"\n  \"export\"\n  \"extends\"\n  \"finally\"\n  \"for\"\n  \"from\"\n  \"function\"\n  \"get\"\n  \"if\"\n  \"import\"\n  \"in\"\n  \"instanceof\"\n  \"let\"\n  \"new\"\n  \"of\"\n  \"return\"\n  \"set\"\n  \"static\"\n  \"switch\"\n  \"target\"\n  \"throw\"\n  \"try\"\n  \"typeof\"\n  \"var\"\n  \"void\"\n  \"while\"\n  \"with\"\n  \"yield\"\n] @keyword\n"},
13    {"make",
14     "(comment) @comment @spell\n\n(conditional\n  (_\n    [\n      \"ifeq\"\n      \"else\"\n      \"ifneq\"\n      \"ifdef\"\n      \"ifndef\"\n    ] @keyword.conditional)\n  \"endif\" @keyword.conditional)\n\n(rule\n  (targets\n    (word) @function))\n\n(rule\n  (targets) @_target\n  (prerequisites\n    (word) @function\n    (#eq\? @_target \".PHONY\")))\n\n(rule\n  (targets\n    (word) @function.builtin\n    (#any-of\? @function.builtin\n      \".DEFAULT\" \".SUFFIXES\" \".DELETE_ON_ERROR\" \".EXPORT_ALL_VARIABLES\" \".IGNORE\" \".INTERMEDIATE\"\n      \".LOW_RESOLUTION_TIME\" \".NOTPARALLEL\" \".ONESHELL\" \".PHONY\" \".POSIX\" \".PRECIOUS\" \".SECONDARY\"\n      \".SECONDEXPANSION\" \".SILENT\" \".SUFFIXES\")))\n\n(rule\n  [\n    \"&:\"\n    \":\"\n    \"::\"\n    \"|\"\n  ] @operator)\n\n[\n  \"export\"\n  \"unexport\"\n] @keyword.import\n\n(override_directive\n  \"override\" @keyword)\n\n(include_directive\n  [\n    \"include\"\n    \"-include\"\n  ] @keyword.import\n  filenames: (list\n    (word) @string.special.path))\n\n(variable_assignment\n  name: (word) @string.special.symbol\n  [\n    \"\?=\"\n    \":=\"\n    \"::=\"\n    ; \":::=\"\n    \"+=\"\n    \"=\"\n  ] @operator)\n\n(shell_assignment\n  name: (word) @string.special.symbol\n  \"!=\" @operator)\n\n(define_directive\n  \"define\" @keyword\n  name: (word) @string.special.symbol\n  [\n    \"=\"\n    \":=\"\n    \"::=\"\n    ; \":::=\"\n    \"\?=\"\n    \"!=\"\n  ]\? @operator\n  \"endef\" @keyword)\n\n(variable_assignment\n  (word) @variable.builtin\n  (#any-of\? @variable.builtin\n    \".DEFAULT_GOAL\" \".EXTRA_PREREQS\" \".FEATURES\" \".INCLUDE_DIRS\" \".RECIPEPREFIX\" \".SHELLFLAGS\"\n    \".VARIABLES\" \"MAKEARGS\" \"MAKEFILE_LIST\" \"MAKEFLAGS\" \"MAKE_RESTARTS\" \"MAKE_TERMERR\"\n    \"MAKE_TERMOUT\" \"SHELL\"))\n\n; Use string to match bash\n(variable_reference\n  (word) @string) @operator\n\n(shell_function\n  [\n    \"$\"\n    \"(\"\n    \")\"\n  ] @operator\n  \"shell\" @function.builtin)\n\n(function_call\n  [\n    \"$\"\n    \"(\"\n    \")\"\n  ] @operator)\n\n(substitution_reference\n  [\n    \"$\"\n    \"(\"\n    \")\"\n  ] @operator)\n\n(automatic_variable\n  \"$\"\n  _ @character.special\n  (#set! priority 105))\n\n(automatic_variable\n  [\n    \"$\"\n    \"(\"\n    \")\"\n  ] @operator\n  (#set! priority 105))\n\n(recipe_line\n  \"@\" @character.special)\n\n(function_call\n  [\n    \"subst\"\n    \"patsubst\"\n    \"strip\"\n    \"findstring\"\n    \"filter\"\n    \"filter-out\"\n    \"sort\"\n    \"word\"\n    \"words\"\n    \"wordlist\"\n    \"firstword\"\n    \"lastword\"\n    \"dir\"\n    \"notdir\"\n    \"suffix\"\n    \"basename\"\n    \"addsuffix\"\n    \"addprefix\"\n    \"join\"\n    \"wildcard\"\n    \"realpath\"\n    \"abspath\"\n    \"error\"\n    \"warning\"\n    \"info\"\n    \"origin\"\n    \"flavor\"\n    \"foreach\"\n    \"if\"\n    \"or\"\n    \"and\"\n    \"call\"\n    \"eval\"\n    \"file\"\n    \"value\"\n  ] @function.builtin)\n\n\"\\\\\" @punctuation.special\n"},
15    {"markdown",
16     ";From nvim-treesitter/nvim-treesitter\n(atx_heading\n  (inline) @text.title)\n\n(setext_heading\n  (paragraph) @text.title)\n\n[\n  (atx_h1_marker)\n  (atx_h2_marker)\n  (atx_h3_marker)\n  (atx_h4_marker)\n  (atx_h5_marker)\n  (atx_h6_marker)\n  (setext_h1_underline)\n  (setext_h2_underline)\n] @punctuation.special\n\n[\n  (link_title)\n  (indented_code_block)\n  (fenced_code_block)\n] @text.literal\n\n(fenced_code_block_delimiter) @punctuation.delimiter\n\n(code_fence_content) @none\n\n(link_destination) @text.uri\n\n(link_label) @text.reference\n\n[\n  (list_marker_plus)\n  (list_marker_minus)\n  (list_marker_star)\n  (list_marker_dot)\n  (list_marker_parenthesis)\n  (thematic_break)\n] @punctuation.special\n\n[\n  (block_continuation)\n  (block_quote_marker)\n] @punctuation.special\n\n(backslash_escape) @string.escape\n"},
17    {"markdown_inline",
18     "; From nvim-treesitter/nvim-treesitter\n[\n  (code_span)\n  (link_title)\n] @text.literal\n\n[\n  (emphasis_delimiter)\n  (code_span_delimiter)\n] @punctuation.delimiter\n\n(emphasis) @text.emphasis\n\n(strong_emphasis) @text.strong\n\n[\n  (link_destination)\n  (uri_autolink)\n] @text.uri\n\n[\n  (link_label)\n  (link_text)\n  (image_description)\n] @text.reference\n\n[\n  (backslash_escape)\n  (hard_line_break)\n] @string.escape\n\n(image\n  [\n    \"!\"\n    \"[\"\n    \"]\"\n    \"(\"\n    \")\"\n  ] @punctuation.delimiter)\n\n(inline_link\n  [\n    \"[\"\n    \"]\"\n    \"(\"\n    \")\"\n  ] @punctuation.delimiter)\n\n(shortcut_link\n  [\n    \"[\"\n    \"]\"\n  ] @punctuation.delimiter)\n\n; NOTE: extension not enabled by default\n; (wiki_link [\"[\" \"|\" \"]\"] @punctuation.delimiter)\n"},
19    {"python",
20     "; Identifier naming conventions\n\n(identifier) @variable\n\n((identifier) @constructor\n (#match\? @constructor \"^[A-Z]\"))\n\n((identifier) @constant\n (#match\? @constant \"^[A-Z][A-Z_]*$\"))\n\n; Function calls\n\n(decorator) @function\n(decorator\n  (identifier) @function)\n\n(call\n  function: (attribute attribute: (identifier) @function.method))\n(call\n  function: (identifier) @function)\n\n; Builtin functions\n\n((call\n  function: (identifier) @function.builtin)\n (#match\?\n   @function.builtin\n   \"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$\"))\n\n; Function definitions\n\n(function_definition\n  name: (identifier) @function)\n\n(attribute attribute: (identifier) @property)\n(type (identifier) @type)\n\n; Literals\n\n[\n  (none)\n  (true)\n  (false)\n] @constant.builtin\n\n[\n  (integer)\n  (float)\n] @number\n\n(comment) @comment\n(string) @string\n(escape_sequence) @escape\n\n(interpolation\n  \"{\" @punctuation.special\n  \"}\" @punctuation.special) @embedded\n\n[\n  \"-\"\n  \"-=\"\n  \"!=\"\n  \"*\"\n  \"**\"\n  \"**=\"\n  \"*=\"\n  \"/\"\n  \"//\"\n  \"//=\"\n  \"/=\"\n  \"&\"\n  \"&=\"\n  \"%\"\n  \"%=\"\n  \"^\"\n  \"^=\"\n  \"+\"\n  \"->\"\n  \"+=\"\n  \"<\"\n  \"<<\"\n  \"<<=\"\n  \"<=\"\n  \"<>\"\n  \"=\"\n  \":=\"\n  \"==\"\n  \">\"\n  \">=\"\n  \">>\"\n  \">>=\"\n  \"|\"\n  \"|=\"\n  \"~\"\n  \"@=\"\n  \"and\"\n  \"in\"\n  \"is\"\n  \"not\"\n  \"or\"\n  \"is not\"\n  \"not in\"\n] @operator\n\n[\n  \"as\"\n  \"assert\"\n  \"async\"\n  \"await\"\n  \"break\"\n  \"class\"\n  \"continue\"\n  \"def\"\n  \"del\"\n  \"elif\"\n  \"else\"\n  \"except\"\n  \"exec\"\n  \"finally\"\n  \"for\"\n  \"from\"\n  \"global\"\n  \"if\"\n  \"import\"\n  \"lambda\"\n  \"nonlocal\"\n  \"pass\"\n  \"print\"\n  \"raise\"\n  \"return\"\n  \"try\"\n  \"while\"\n  \"with\"\n  \"yield\"\n  \"match\"\n  \"case\"\n] @keyword\n"},
21    {"typescript",
22     "; Variables\n;----------\n\n(identifier) @variable\n\n; Properties\n;-----------\n\n(property_identifier) @property\n\n; Function and method definitions\n;--------------------------------\n\n(function_expression\n  name: (identifier) @function)\n(function_declaration\n  name: (identifier) @function)\n(method_definition\n  name: (property_identifier) @function.method)\n\n(pair\n  key: (property_identifier) @function.method\n  value: [(function_expression) (arrow_function)])\n\n(assignment_expression\n  left: (member_expression\n    property: (property_identifier) @function.method)\n  right: [(function_expression) (arrow_function)])\n\n(variable_declarator\n  name: (identifier) @function\n  value: [(function_expression) (arrow_function)])\n\n(assignment_expression\n  left: (identifier) @function\n  right: [(function_expression) (arrow_function)])\n\n; Function and method calls\n;--------------------------\n\n(call_expression\n  function: (identifier) @function)\n\n(call_expression\n  function: (member_expression\n    property: (property_identifier) @function.method))\n\n; Special identifiers\n;--------------------\n\n((identifier) @constructor\n (#match\? @constructor \"^[A-Z]\"))\n\n([\n    (identifier)\n    (shorthand_property_identifier)\n    (shorthand_property_identifier_pattern)\n ] @constant\n (#match\? @constant \"^[A-Z_][A-Z\\\\d_]+$\"))\n\n((identifier) @variable.builtin\n (#match\? @variable.builtin \"^(arguments|module|console|window|document)$\")\n (#is-not\? local))\n\n((identifier) @function.builtin\n (#eq\? @function.builtin \"require\")\n (#is-not\? local))\n\n; Literals\n;---------\n\n(this) @variable.builtin\n(super) @variable.builtin\n\n[\n  (true)\n  (false)\n  (null)\n  (undefined)\n] @constant.builtin\n\n(comment) @comment\n\n[\n  (string)\n  (template_string)\n] @string\n\n(regex) @string.special\n(number) @number\n\n; Tokens\n;-------\n\n[\n  \";\"\n  (optional_chain)\n  \".\"\n  \",\"\n] @punctuation.delimiter\n\n[\n  \"-\"\n  \"--\"\n  \"-=\"\n  \"+\"\n  \"++\"\n  \"+=\"\n  \"*\"\n  \"*=\"\n  \"**\"\n  \"**=\"\n  \"/\"\n  \"/=\"\n  \"%\"\n  \"%=\"\n  \"<\"\n  \"<=\"\n  \"<<\"\n  \"<<=\"\n  \"=\"\n  \"==\"\n  \"===\"\n  \"!\"\n  \"!=\"\n  \"!==\"\n  \"=>\"\n  \">\"\n  \">=\"\n  \">>\"\n  \">>=\"\n  \">>>\"\n  \">>>=\"\n  \"~\"\n  \"^\"\n  \"&\"\n  \"|\"\n  \"^=\"\n  \"&=\"\n  \"|=\"\n  \"&&\"\n  \"||\"\n  \"\?\?\"\n  \"&&=\"\n  \"||=\"\n  \"\?\?=\"\n] @operator\n\n[\n  \"(\"\n  \")\"\n  \"[\"\n  \"]\"\n  \"{\"\n  \"}\"\n]  @punctuation.bracket\n\n(template_substitution\n  \"${\" @punctuation.special\n  \"}\" @punctuation.special) @embedded\n\n[\n  \"as\"\n  \"async\"\n  \"await\"\n  \"break\"\n  \"case\"\n  \"catch\"\n  \"class\"\n  \"const\"\n  \"continue\"\n  \"debugger\"\n  \"default\"\n  \"delete\"\n  \"do\"\n  \"else\"\n  \"export\"\n  \"extends\"\n  \"finally\"\n  \"for\"\n  \"from\"\n  \"function\"\n  \"get\"\n  \"if\"\n  \"import\"\n  \"in\"\n  \"instanceof\"\n  \"let\"\n  \"new\"\n  \"of\"\n  \"return\"\n  \"set\"\n  \"static\"\n  \"switch\"\n  \"target\"\n  \"throw\"\n  \"try\"\n  \"typeof\"\n  \"var\"\n  \"void\"\n  \"while\"\n  \"with\"\n  \"yield\"\n] @keyword\n; Types\n\n(type_identifier) @type\n(predefined_type) @type.builtin\n\n((identifier) @type\n (#match\? @type \"^[A-Z]\"))\n\n(type_arguments\n  \"<\" @punctuation.bracket\n  \">\" @punctuation.bracket)\n\n; Variables\n\n(required_parameter (identifier) @variable.parameter)\n(optional_parameter (identifier) @variable.parameter)\n\n; Keywords\n\n[ \"abstract\"\n  \"declare\"\n  \"enum\"\n  \"export\"\n  \"implements\"\n  \"interface\"\n  \"keyof\"\n  \"namespace\"\n  \"private\"\n  \"protected\"\n  \"public\"\n  \"type\"\n  \"readonly\"\n  \"override\"\n  \"satisfies\"\n] @keyword\n"},
23};
24
25const char *tiny_query_for(const char *lang) {
26    for (size_t i = 0; i < sizeof tiny_queries / sizeof tiny_queries[0]; i++)
27        if (strcmp(tiny_queries[i].lang, lang) == 0) return tiny_queries[i].text;
28    return NULL;
29}