Coverage for src/renaissance/integrations/clang/kinds.py: 100%
2 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-15 10:34 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-15 10:34 +0000
1# Copyright (C) 2024-2026 TNO
2#
3# Licensed under the terms specified in the LICENSE file in the root directory
4# of this repository, also available at:
5# https://github.com/TNO/Renaissance.Py/blob/main/LICENSE
7"""AI: Mapping of Clang node kinds to the library's semantic kinds."""
9from renaissance.syntax_tree.semantic_kind import SemanticKind
11CLANG_KIND_MAP = {
12 "TRANSLATION_UNIT": SemanticKind.TRANSLATION_UNIT,
13 "translation_unit": SemanticKind.TRANSLATION_UNIT,
14 "TranslationUnitDecl": SemanticKind.TRANSLATION_UNIT,
15 "FunctionDecl": SemanticKind.FUNCTION,
16 "FUNCTION_DECL": SemanticKind.FUNCTION,
17 "CXXMethodDecl": SemanticKind.FUNCTION,
18 "CXX_METHOD": SemanticKind.FUNCTION,
19 "CXXConstructorDecl": SemanticKind.FUNCTION,
20 "CXX_CONSTRUCTOR": SemanticKind.FUNCTION,
21 "CONSTRUCTOR": SemanticKind.FUNCTION,
22 "CallExpr": SemanticKind.CALL,
23 "CALL_EXPR": SemanticKind.CALL,
24 "CXXConstructExpr": SemanticKind.CALL,
25 "CXX_CONSTRUCT_EXPR": SemanticKind.CALL,
26 "DeclRefExpr": SemanticKind.NAME,
27 "IntegerLiteral": SemanticKind.LITERAL,
28 "INTEGER_LITERAL": SemanticKind.LITERAL,
29 "FloatingLiteral": SemanticKind.LITERAL,
30 "StringLiteral": SemanticKind.LITERAL,
31 "VarDecl": SemanticKind.DECLARATION,
32 "VAR_DECL": SemanticKind.DECLARATION,
33 "DeclStmt": SemanticKind.STATEMENT,
34 "DECL_STMT": SemanticKind.STATEMENT,
35 "TypedefDecl": SemanticKind.DECLARATION,
36 "TYPEDEF_DECL": SemanticKind.DECLARATION,
37 "ParmVarDecl": SemanticKind.PARAMETER,
38 "PARM_DECL": SemanticKind.PARAMETER,
39 "BinaryOperator": SemanticKind.BINARY_OPERATION,
40 "BINARY_OPERATOR": SemanticKind.BINARY_OPERATION,
41 "UnaryOperator": SemanticKind.UNARY_OPERATION,
42 "UNARY_OPERATOR": SemanticKind.UNARY_OPERATION,
43 "IfStmt": SemanticKind.CONDITIONAL,
44 "IF_STMT": SemanticKind.CONDITIONAL,
45 "ForStmt": SemanticKind.LOOP,
46 "FOR_STMT": SemanticKind.LOOP,
47 "WhileStmt": SemanticKind.LOOP,
48 "WHILE_STMT": SemanticKind.LOOP,
49 "ReturnStmt": SemanticKind.RETURN,
50 "RETURN_STMT": SemanticKind.RETURN,
51 "RecordDecl": SemanticKind.CLASS,
52 "CXXRecordDecl": SemanticKind.CLASS,
53 "STRUCT_DECL": SemanticKind.CLASS,
54 "CLASS_DECL": SemanticKind.CLASS,
55 "NamespaceDecl": SemanticKind.DEFINITION,
56 "NAMESPACE_DECL": SemanticKind.DEFINITION,
57 "CompoundStmt": SemanticKind.STATEMENT,
58 "COMPOUND_STMT": SemanticKind.STATEMENT,
59 "Import": SemanticKind.IMPORT,
60 "INCLUSION_DIRECTIVE": SemanticKind.IMPORT,
61 "InclusionDirective": SemanticKind.IMPORT,
62}