idlast.py
来自「编译工具」· Python 代码 · 共 1,144 行 · 第 1/3 页
PY
1,144 行
class Const (Decl, DeclRepoId): """Constant declaration (Decl, DeclRepoId)Functions: constType() -- IdlType.Type object of this constant. Aliases not stripped. constKind() -- TypeCode kind of constant with aliases stripped. value() -- value of the constant. Either an integer or an Enumerator object.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, constType, constKind, value): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__constType = constType self.__constKind = constKind self.__value = value #print line, "Const init:", constType, identifier, value def accept(self, visitor): visitor.visitConst(self) def constType(self): return self.__constType def constKind(self): return self.__constKind def value(self): return self.__valueclass Declarator (Decl, DeclRepoId): """Declarator used in typedefs, struct members, etc. (Decl, DeclRepoId)Functions: sizes() -- list of array sizes, or None if this is a simple declarator. alias() -- Typedef object for this declarator if this is a typedef declarator. None otherwise.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, sizes): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__sizes = sizes self.__alias = None def _setAlias(self, alias): self.__alias = alias def accept(self, visitor): visitor.visitDeclarator(self) def sizes(self): return self.__sizes def alias(self): return self.__aliasclass Typedef (Decl): """Typedef (Decl)Functions: aliasType() -- IdlType.Type object that this is an alias to. constrType() -- boolean: true if the alias type was constructed within this typedef declaration. declarators() -- list of Declarator objects.""" def __init__(self, file, line, mainFile, pragmas, comments, aliasType, constrType, declarators): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__aliasType = aliasType self.__constrType = constrType self.__declarators = declarators def accept(self, visitor): visitor.visitTypedef(self) def aliasType(self): return self.__aliasType def constrType(self): return self.__constrType def declarators(self): return self.__declaratorsclass Member (Decl): """Member of a struct or exception (Decl)Functions: memberType() -- IdlType.Type object for the type of this member. constrType() -- boolean: true if the member type was constructed within the member declaration. declarators() -- list of Declarator objects.""" def __init__(self, file, line, mainFile, pragmas, comments, memberType, constrType, declarators): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__memberType = memberType self.__constrType = constrType self.__declarators = declarators def accept(self, visitor): visitor.visitMember(self) def memberType(self): return self.__memberType def constrType(self): return self.__constrType def declarators(self): return self.__declaratorsclass Struct (Decl, DeclRepoId): """Struct declaration (Decl, DeclRepoId)Functions: members() -- list of Member objects for the struct contents. recursive() -- boolean: true if the struct is recursive.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, recursive): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__recursive = recursive def _setMembers(self, members): self.__members = members def accept(self, visitor): visitor.visitStruct(self) def members(self): return self.__members def recursive(self): return self.__recursiveclass StructForward (Decl, DeclRepoId): """Struct forward declaration (Decl, DeclRepoId)Functions: fullDecl() -- full definition of the struct.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self._fullDecl = None self._more = [] def accept(self, visitor): visitor.visitStructForward(self) def fullDecl(self): return self._fullDeclclass Exception (Decl, DeclRepoId): """Exception declaration (Decl, DeclRepoId)Function: members() -- list of Member objects for the exception contents.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, members): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__members = members #print line, "Exception init:", identifier, members def accept(self, visitor): visitor.visitException(self) def members(self): return self.__membersclass CaseLabel (Decl): """Case label within a union (Decl)Functions: default() -- boolean: true if this is the default label. value() -- label value. Either an integer or an Enumerator object. If default() is true, returns a value used by none of the other union labels. labelKind() -- TypeCode kind of label.""" def __init__(self, file, line, mainFile, pragmas, comments, default, value, labelKind): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__default = default self.__value = value self.__labelKind = labelKind def accept(self, visitor): visitor.visitCaseLabel(self) def default(self): return self.__default def value(self): return self.__value def labelKind(self): return self.__labelKindclass UnionCase (Decl): """One case within a union (Decl)Functions: labels() -- list of CaseLabel objects. caseType() -- IdlType.Type object for the case type. constrType() -- boolean: true if the case type was constructed within the case. declarator() -- Declarator object""" def __init__(self, file, line, mainFile, pragmas, comments, labels, caseType, constrType, declarator): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__labels = labels self.__caseType = caseType self.__constrType = constrType self.__declarator = declarator def accept(self, visitor): visitor.visitUnionCase(self) def labels(self): return self.__labels def caseType(self): return self.__caseType def constrType(self): return self.__constrType def declarator(self): return self.__declaratorclass Union (Decl, DeclRepoId): """Union declaration (Decl, DeclRepoId)Functions: switchType() -- IdlType.Type object corresponding to the switch type. constrType() -- boolean: true if the switch type was declared within the switch statement. Only possible for Enums. cases() -- list of UnionCase objects. recursive() -- boolean: true if the union is recursive.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, switchType, constrType, recursive): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__switchType = switchType self.__constrType = constrType self.__recursive = recursive def _setCases(self, cases): self.__cases = cases def accept(self, visitor): visitor.visitUnion(self) def switchType(self): return self.__switchType def constrType(self): return self.__constrType def cases(self): return self.__cases def recursive(self): return self.__recursiveclass UnionForward (Decl, DeclRepoId): """Union forward declaration (Decl, DeclRepoId)Functions: fullDecl() -- full definition of the union.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self._fullDecl = None self._more = [] def accept(self, visitor): visitor.visitUnionForward(self) def fullDecl(self): return self._fullDeclclass Enumerator (Decl, DeclRepoId): """Enumerator of an Enum (Decl, DeclRepoId)Function: value() -- integer value of enumerator, as marshalled.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, value): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__value = value def accept(self, visitor): visitor.visitEnumerator(self) def value(self): return self.__valueclass Enum (Decl, DeclRepoId): """Enum declaration (Decl, DeclRepoId)Function: enumerators() -- list of Enumerator objects.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, enumerators): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__enumerators = enumerators def accept(self, visitor): visitor.visitEnum(self) def enumerators(self): return self.__enumeratorsclass Attribute (Decl): """Attribute declaration (Decl)Functions: readonly() -- boolean: true if the attribute is read only. attrType() -- IdlType.Type object for the attribute's type. declarators() -- list of the attribute's declarators. identifiers() -- list of strings containing the attribute identifiers (equivalent to the identifiers inside the declarators).""" def __init__(self, file, line, mainFile, pragmas, comments, readonly, attrType, declarators): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__readonly = readonly self.__attrType = attrType self.__declarators = declarators self.__identifiers = map(lambda d: d.identifier(), declarators) #print line, "Attribute init:", readonly, identifiers def accept(self, visitor): visitor.visitAttribute(self) def readonly(self): return self.__readonly def attrType(self): return self.__attrType def declarators(self): return self.__declarators def identifiers(self): return self.__identifiersclass Parameter (Decl): """A Parameter of an operation or factory specifier (Decl)Functions: direction() -- integer: 0 == in, 1 == out, 2 == inout. is_in() -- boolean: true if in or inout. is_out() -- boolean: true if out or inout. paramType() -- IdlType.Type object for the parameter type. identifier() -- string of parameter identifier.""" def __init__(self, file, line, mainFile, pragmas, comments, direction, paramType, identifier): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__direction = direction self.__is_in = (direction == 0 or direction == 2) self.__is_out = (direction == 1 or direction == 2) self.__paramType = paramType
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?