예제 #1
0
파일: CppFile.py 프로젝트: quinsmpang/Tools
 def parseCpp(self, filePathName):
     with open(filePathName, 'r', encoding = 'utf8') as fHandle:
         tokenParseData = TokenParseData.TokenParseData('')
         try:
             tokenParseData.m_fileStr = fHandle.read();       # 读取所有的内容
         except Exception as e:
             Utils.logStackInfo()
             Logger.instance().info("{0} 文件解析错误".format(filePathName))
             return
         
             
         Utils.skipSpaceAndBr(tokenParseData)          # 删除左边的空格
         while len(tokenParseData.m_fileStr):
             oneToken = Utils.getToken(tokenParseData)
             if oneToken == "#ifndef":
                 Utils.skipCurLine(tokenParseData)
             elif oneToken == "#define":
                 Utils.skipCurLine(tokenParseData)
             elif oneToken == "#include":
                 Utils.skipCurLine(tokenParseData)
             elif oneToken[0:3] == "/**":
                 self.m_curCppElem = CppMultiComment.CppMultiComment()
                 self.m_pStack.push(self.m_curCppElem)
                 self.m_curCppElem.parseCppElem(tokenParseData)
             elif oneToken[0:2] == "//":
                 Utils.skipCurLine(tokenParseData)
             elif oneToken == "struct":
                 self.m_curCppElem = CppStructItem.CppStructItem()
                 self.m_curCppElem.parseCppElem(tokenParseData)
 
             
             Utils.skipSpaceAndBr(tokenParseData)          # 删除左边的空格
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
예제 #2
0
 def parseCppElem(self, strParam):
     super.parseCppElem(strParam)
     while len(strParam):
         oneToken = Utils.getToken(strParam)
         if oneToken[0:2] == "*/":
             break
예제 #3
0
 def parseCppElem(self, strParam):
     super.parseCppElem(strParam)
     while len(strParam):
         oneToken = Utils.getToken(strParam)
         if oneToken[0:2] == "*/":
             break