示例#1
0
 def to_ast_node_id(kind):
     if (kind == clang.cindex.CursorKind.NAMESPACE):
         return ASTNodeId.getNamespaceId()
     if (kind in [
             clang.cindex.CursorKind.CLASS_DECL,
             clang.cindex.CursorKind.CLASS_TEMPLATE,
             clang.cindex.CursorKind.CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
     ]):
         return ASTNodeId.getClassId()
     if (kind == clang.cindex.CursorKind.STRUCT_DECL):
         return ASTNodeId.getStructId()
     if (kind == clang.cindex.CursorKind.ENUM_DECL):
         return ASTNodeId.getEnumId()
     if (kind == clang.cindex.CursorKind.ENUM_CONSTANT_DECL):
         return ASTNodeId.getEnumValueId()
     if (kind == clang.cindex.CursorKind.UNION_DECL):
         return ASTNodeId.getUnionId()
     if (kind == clang.cindex.CursorKind.FIELD_DECL):
         return ASTNodeId.getFieldId()
     if (kind == clang.cindex.CursorKind.VAR_DECL):
         return ASTNodeId.getLocalVariableId()
     if (kind in [
             clang.cindex.CursorKind.FUNCTION_DECL,
             clang.cindex.CursorKind.FUNCTION_TEMPLATE
     ]):
         return ASTNodeId.getFunctionId()
     if (kind in [
             clang.cindex.CursorKind.CXX_METHOD,
             clang.cindex.CursorKind.CONSTRUCTOR,
             clang.cindex.CursorKind.DESTRUCTOR
     ]):
         return ASTNodeId.getMethodId()
     if (kind == clang.cindex.CursorKind.PARM_DECL):
         return ASTNodeId.getFunctionParameterId()
     if (kind == clang.cindex.CursorKind.TEMPLATE_TYPE_PARAMETER):
         return ASTNodeId.getTemplateTypeParameterId()
     if (kind == clang.cindex.CursorKind.TEMPLATE_NON_TYPE_PARAMETER):
         return ASTNodeId.getTemplateNonTypeParameterId()
     if (kind == clang.cindex.CursorKind.TEMPLATE_TEMPLATE_PARAMETER):
         return ASTNodeId.getTemplateTemplateParameterId()
     if (kind == clang.cindex.CursorKind.MACRO_DEFINITION):
         return ASTNodeId.getMacroDefinitionId()
     if (kind == clang.cindex.CursorKind.MACRO_INSTANTIATION):
         return ASTNodeId.getMacroInstantiationId()
     if (kind in [
             clang.cindex.CursorKind.TYPEDEF_DECL,
             clang.cindex.CursorKind.TYPE_ALIAS_DECL
     ]):
         return ASTNodeId.getTypedefId()
     if (kind == clang.cindex.CursorKind.NAMESPACE_ALIAS):
         return ASTNodeId.getNamespaceAliasId()
     if (kind == clang.cindex.CursorKind.USING_DIRECTIVE):
         return ASTNodeId.getUsingDirectiveId()
     if (kind == clang.cindex.CursorKind.USING_DECLARATION):
         return ASTNodeId.getUsingDeclarationId()
     return ASTNodeId.getUnsupportedId()
示例#2
0
 def to_ast_node_id(kind):
     if (kind == clang.cindex.CursorKind.NAMESPACE):
         return ASTNodeId.getNamespaceId()
     if (kind in [clang.cindex.CursorKind.CLASS_DECL, clang.cindex.CursorKind.CLASS_TEMPLATE, clang.cindex.CursorKind.CLASS_TEMPLATE_PARTIAL_SPECIALIZATION]):
         return ASTNodeId.getClassId()
     if (kind == clang.cindex.CursorKind.STRUCT_DECL):
         return ASTNodeId.getStructId()
     if (kind == clang.cindex.CursorKind.ENUM_DECL):
         return ASTNodeId.getEnumId()
     if (kind == clang.cindex.CursorKind.ENUM_CONSTANT_DECL):
         return ASTNodeId.getEnumValueId()
     if (kind == clang.cindex.CursorKind.UNION_DECL):
         return ASTNodeId.getUnionId()
     if (kind == clang.cindex.CursorKind.FIELD_DECL):
         return ASTNodeId.getFieldId()
     if (kind == clang.cindex.CursorKind.VAR_DECL):
         return ASTNodeId.getLocalVariableId()
     if (kind in [clang.cindex.CursorKind.FUNCTION_DECL, clang.cindex.CursorKind.FUNCTION_TEMPLATE]):
         return ASTNodeId.getFunctionId()
     if (kind in [clang.cindex.CursorKind.CXX_METHOD, clang.cindex.CursorKind.CONSTRUCTOR, clang.cindex.CursorKind.DESTRUCTOR]):
         return ASTNodeId.getMethodId()
     if (kind == clang.cindex.CursorKind.PARM_DECL):
         return ASTNodeId.getFunctionParameterId()
     if (kind == clang.cindex.CursorKind.TEMPLATE_TYPE_PARAMETER):
         return ASTNodeId.getTemplateTypeParameterId()
     if (kind == clang.cindex.CursorKind.TEMPLATE_NON_TYPE_PARAMETER):
         return ASTNodeId.getTemplateNonTypeParameterId()
     if (kind == clang.cindex.CursorKind.TEMPLATE_TEMPLATE_PARAMETER):
         return ASTNodeId.getTemplateTemplateParameterId()
     if (kind == clang.cindex.CursorKind.MACRO_DEFINITION):
         return ASTNodeId.getMacroDefinitionId()
     if (kind == clang.cindex.CursorKind.MACRO_INSTANTIATION):
         return ASTNodeId.getMacroInstantiationId()
     if (kind in [clang.cindex.CursorKind.TYPEDEF_DECL, clang.cindex.CursorKind.TYPE_ALIAS_DECL]):
         return ASTNodeId.getTypedefId()
     if (kind == clang.cindex.CursorKind.NAMESPACE_ALIAS):
         return ASTNodeId.getNamespaceAliasId()
     if (kind == clang.cindex.CursorKind.USING_DIRECTIVE):
         return ASTNodeId.getUsingDirectiveId()
     if (kind == clang.cindex.CursorKind.USING_DECLARATION):
         return ASTNodeId.getUsingDeclarationId()
     return ASTNodeId.getUnsupportedId()
示例#3
0
 def __tag_id_to_vim_syntax_group(tag_identifier):
     if tag_identifier == ASTNodeId.getNamespaceId():
         return "yavideCppNamespace"
     if tag_identifier == ASTNodeId.getNamespaceAliasId():
         return "yavideCppNamespaceAlias"
     if tag_identifier == ASTNodeId.getClassId():
         return "yavideCppClass"
     if tag_identifier == ASTNodeId.getStructId():
         return "yavideCppStructure"
     if tag_identifier == ASTNodeId.getEnumId():
         return "yavideCppEnum"
     if tag_identifier == ASTNodeId.getEnumValueId():
         return "yavideCppEnumValue"
     if tag_identifier == ASTNodeId.getUnionId():
         return "yavideCppUnion"
     if tag_identifier == ASTNodeId.getFieldId():
         return "yavideCppField"
     if tag_identifier == ASTNodeId.getLocalVariableId():
         return "yavideCppLocalVariable"
     if tag_identifier == ASTNodeId.getFunctionId():
         return "yavideCppFunction"
     if tag_identifier == ASTNodeId.getMethodId():
         return "yavideCppMethod"
     if tag_identifier == ASTNodeId.getFunctionParameterId():
         return "yavideCppFunctionParameter"
     if tag_identifier == ASTNodeId.getTemplateTypeParameterId():
         return "yavideCppTemplateTypeParameter"
     if tag_identifier == ASTNodeId.getTemplateNonTypeParameterId():
         return "yavideCppTemplateNonTypeParameter"
     if tag_identifier == ASTNodeId.getTemplateTemplateParameterId():
         return "yavideCppTemplateTemplateParameter"
     if tag_identifier == ASTNodeId.getMacroDefinitionId():
         return "yavideCppMacroDefinition"
     if tag_identifier == ASTNodeId.getMacroInstantiationId():
         return "yavideCppMacroInstantiation"
     if tag_identifier == ASTNodeId.getTypedefId():
         return "yavideCppTypedef"
     if tag_identifier == ASTNodeId.getUsingDirectiveId():
         return "yavideCppUsingDirective"
     if tag_identifier == ASTNodeId.getUsingDeclarationId():
         return "yavideCppUsingDeclaration"