예제 #1
0
 def parse(self, tokenParseBuffer):
     super(ProtoMessage, self).parse(tokenParseBuffer)
     
     self.m_typeKeyWord = tokenParseBuffer.getTokenAndRemove()  # "message"
     self.m_typeName = tokenParseBuffer.getTokenAndRemove() # "stTest"
     # 检查父类
     nextToken = tokenParseBuffer.getTokenAndNoRemove()
     if nextToken == ":":     # 说明有基类
         nextToken = tokenParseBuffer.getTokenAndRemove()    # 移除 ":"
         self.m_parentCls = tokenParseBuffer.getTokenAndRemove()
     
     
     tokenParseBuffer.getTokenAndRemove()        # 移除 "{"
     
     while True:
         linePrefix = tokenParseBuffer.getTokenAndNoRemove()
         if linePrefix == ProtoKeyWord.eRightBraceSemicolon:     # 如果取出来是 "};"
             break
         elif linePrefix == ProtoKeyWord.eRightBrace:            # 如果取出来是 "}"
             tokenParseBuffer.getTokenAndRemove()        # 移除 ";"
             break
         elif AppSysBase.instance().getClsUtils().tokenIsComment(linePrefix):       # 如果当前符号是注释
             memberComment = ProtoMemberComment()
             self.m_memberList.append(memberComment)
             memberComment.parse(memberComment)
         elif linePrefix == ProtoKeyWord.eBase:
             messageMember = MessageMember()
             self.m_baseMemberInitList.append(messageMember)
             messageMember.parse(tokenParseBuffer)
         else:
             messageMember = MessageMember()
             self.m_memberList.append(messageMember)
             messageMember.parse(tokenParseBuffer)
         
     
     tokenParseBuffer.getTokenAndRemove()        # 移除 "};"
예제 #2
0
    def parse(self, tokenParseBuffer):
        super(ProtoEnum, self).parse(tokenParseBuffer)

        self.m_typeKeyWord = tokenParseBuffer.getTokenAndRemove()  # "enum"
        self.m_typeName = tokenParseBuffer.getTokenAndRemove()  # "eTest"
        tokenParseBuffer.getTokenAndRemove()  # 移除 "{"

        while True:
            linePrefix = tokenParseBuffer.getTokenAndNoRemove()
            if linePrefix == ProtoKeyWord.eRightBraceSemicolon:  # 如果取出来是 "};"
                break
            elif linePrefix == ProtoKeyWord.eRightBrace:  # 如果取出来是 "}"
                tokenParseBuffer.getTokenAndRemove()  # 移除 ";"
                break
            elif AppSysBase.instance().getClsUtils().tokenIsComment(linePrefix):  # 如果当前符号是注释
                memberComment = ProtoMemberComment()
                self.m_memberList.append(memberComment)
                memberComment.parse(memberComment)
            else:
                enumMember = EnumMember()
                self.m_memberList.append(enumMember)
                enumMember.parse(tokenParseBuffer)

        tokenParseBuffer.getTokenAndRemove()  # 移除 "};"