Coverage for src/renaissance/integrations/tree_sitter/kinds.py: 100%
2 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-10-02 13:12 +0000
« prev ^ index » next coverage.py v7.16.1, created at 2026-10-02 13:12 +0000
1"""AI: Mapping of tree-sitter node kinds to the library's semantic kinds."""
3from renaissance.syntax_tree.semantic_kind import SemanticKind
5TREE_SITTER_KIND_MAP = {
6 "module": SemanticKind.TRANSLATION_UNIT,
7 "translation_unit": SemanticKind.TRANSLATION_UNIT,
8 "function_definition": SemanticKind.FUNCTION,
9 "function_declaration": SemanticKind.FUNCTION,
10 "call": SemanticKind.CALL,
11 "call_expression": SemanticKind.CALL,
12 "identifier": SemanticKind.NAME,
13 "integer": SemanticKind.LITERAL,
14 "integer_literal": SemanticKind.LITERAL,
15 "string": SemanticKind.LITERAL,
16 "string_literal": SemanticKind.LITERAL,
17 "assignment": SemanticKind.ASSIGNMENT,
18 "assignment_expression": SemanticKind.ASSIGNMENT,
19 "binary_expression": SemanticKind.BINARY_OPERATION,
20 "unary_expression": SemanticKind.UNARY_OPERATION,
21 "if_statement": SemanticKind.CONDITIONAL,
22 "conditional_expression": SemanticKind.CONDITIONAL,
23 "for_statement": SemanticKind.LOOP,
24 "while_statement": SemanticKind.LOOP,
25 "return_statement": SemanticKind.RETURN,
26 "return": SemanticKind.RETURN,
27 "import_statement": SemanticKind.IMPORT,
28 "import": SemanticKind.IMPORT,
29 "import_declaration": SemanticKind.IMPORT,
30 "if": SemanticKind.CONDITIONAL,
31 "class_definition": SemanticKind.CLASS,
32 "class_declaration": SemanticKind.CLASS,
33 "class_specifier": SemanticKind.CLASS,
34 "for": SemanticKind.LOOP,
35 "while": SemanticKind.LOOP,
36 "expression_statement": SemanticKind.EXPRESSION,
37 "assert_statement": SemanticKind.CONDITIONAL,
38 "with_statement": SemanticKind.LOOP,
39 "async_for_statement": SemanticKind.LOOP,
40 "async_function_definition": SemanticKind.FUNCTION,
41 "async_with_statement": SemanticKind.LOOP,
42 "try_statement": SemanticKind.STATEMENT,
43 "raise_statement": SemanticKind.RETURN,
44 "break_statement": SemanticKind.RETURN,
45 "continue_statement": SemanticKind.RETURN,
46 "pass_statement": SemanticKind.STATEMENT,
47 "delete_statement": SemanticKind.STATEMENT,
48 "generator_expression": SemanticKind.EXPRESSION,
49 "formatted_string": SemanticKind.LITERAL,
50 "subscript": SemanticKind.EXPRESSION,
51 "tuple": SemanticKind.EXPRESSION,
52 "not_operator": SemanticKind.UNARY_OPERATION,
53 "list": SemanticKind.EXPRESSION,
54 "dictionary_comprehension": SemanticKind.EXPRESSION,
55 "list_comprehension": SemanticKind.EXPRESSION,
56 "set_comprehension": SemanticKind.EXPRESSION,
57 "lambda": SemanticKind.EXPRESSION,
58 "global_statement": SemanticKind.DEFINITION,
59 "dictionary": SemanticKind.EXPRESSION,
60 "set": SemanticKind.EXPRESSION,
61 "FormattedString": SemanticKind.LITERAL,
62 "yield": SemanticKind.EXPRESSION,
63 "await": SemanticKind.EXPRESSION,
64 "match_statement": SemanticKind.CONDITIONAL,
65 "augmented_assignment": SemanticKind.ASSIGNMENT,
66 "import_from_statement": SemanticKind.IMPORT,
67 "binary_operator": SemanticKind.BINARY_OPERATION,
68 "unary_operator": SemanticKind.UNARY_OPERATION,
69 "with": SemanticKind.LOOP,
70 "type_alias_statement": SemanticKind.STATEMENT
71}