static boolean doObjCParsing() { //fseek (TagFile.fp, 0L, SEEK_END); cppInit(0, 0); while (skipToObjCKeyword() != EOF) { struct handlerType *iter; char *keyword; keyword = readToNonAlpha(NULL); if (!keyword) continue; keyword = eStrdup(keyword); for (iter = handlers; iter->name; iter++) { if (!strcmp(iter->name, keyword)) { iter->handler(keyword); } } eFree(keyword); } cppTerminate(); return FALSE; }
static void findProtobufTags (void) { cppInit (false, false, false, false, KIND_GHOST_INDEX, 0, KIND_GHOST_INDEX, 0, 0); token.value = vStringNew (); nextToken (); while (token.type != TOKEN_EOF) { if (tokenIsKeyword (KEYWORD_PACKAGE)) parseStatement (PK_PACKAGE); else if (tokenIsKeyword (KEYWORD_MESSAGE)) parseStatement (PK_MESSAGE); else if (tokenIsKeyword (KEYWORD_ENUM)) parseStatement (PK_ENUM); else if (tokenIsKeyword (KEYWORD_REPEATED) || tokenIsKeyword (KEYWORD_OPTIONAL) || tokenIsKeyword (KEYWORD_REQUIRED)) parseStatement (PK_FIELD); else if (tokenIsKeyword (KEYWORD_SERVICE)) parseStatement (PK_SERVICE); else if (tokenIsKeyword (KEYWORD_RPC)) parseStatement (PK_RPC); skipUntil (";{}"); nextToken (); } vStringDelete (token.value); cppTerminate (); }
static void runCppGetc (void) { cppInit (0, FALSE, FALSE, DTSKinds + DTS_MACRO, DTSKinds + DTS_HEADER); while ( cppGetc() != EOF ) ; /* Do nothing, just read. */ cppTerminate (); }
/* * FUNCTION DEFINITIONS */ static void runCppGetc (void) { cppInit (0, FALSE, FALSE, FALSE, DTSKinds + DTS_MACRO, DTS_MACRO_KIND_UNDEF_ROLE, DTSKinds + DTS_HEADER, DTS_HEADER_KIND_SYSTEM_ROLE, DTS_HEADER_KIND_LOCAL_ROLE, FIELD_UNKNOWN); findRegexTagsMainloop (cppGetc); cppTerminate (); }
static rescanReason cxxParserMain(const unsigned int passCount) { cxxScopeClear(); cxxTokenAPINewFile(); cxxParserNewStatement(); kindOption * kind_for_define = cxxTagGetKindOptions() + CXXTagKindMACRO; kindOption * kind_for_header = cxxTagGetKindOptions() + CXXTagKindINCLUDE; int role_for_macro_undef = CR_MACRO_UNDEF; int role_for_header_system = CR_HEADER_SYSTEM; int role_for_header_local = CR_HEADER_LOCAL; int end_field_type = cxxParserCurrentLanguageIsCPP()? cxxTagGetCPPFieldSpecifiers () [CXXTagCPPFieldEndLine].ftype: cxxTagGetCFieldSpecifiers () [CXXTagCFieldEndLine].ftype; Assert(passCount < 3); cppInit( (boolean) (passCount > 1), FALSE, TRUE, // raw literals FALSE, kind_for_define, role_for_macro_undef, kind_for_header, role_for_header_system, role_for_header_local, end_field_type ); g_cxx.iChar = ' '; boolean bRet = cxxParserParseBlock(FALSE); cppTerminate (); cxxTokenChainClear(g_cxx.pTokenChain); if(g_cxx.pTemplateTokenChain) cxxTokenChainClear(g_cxx.pTemplateTokenChain); if(!bRet && (passCount == 1)) { CXX_DEBUG_PRINT("Processing failed: trying to rescan"); return RESCAN_FAILED; } return RESCAN_NONE; }
static void findAsmTags (void) { vString *name = vStringNew (); vString *operator = vStringNew (); const unsigned char *line; cppInit (false, false, false, false, KIND_GHOST_INDEX, 0, KIND_GHOST_INDEX, 0, 0); unsigned int lastMacroCorkIndex = CORK_NIL; while ((line = asmReadLineFromInputFile ()) != NULL) { const unsigned char *cp = line; bool labelCandidate = (bool) (! isspace ((int) *cp)); bool nameFollows = false; bool directive = false; const bool isComment = (bool) (*cp != '\0' && strchr (";*@", *cp) != NULL); /* skip comments */ if (isComment) continue; /* skip white space */ while (isspace ((int) *cp)) ++cp; /* read symbol */ if (*cp == '.') { directive = true; labelCandidate = false; ++cp; } cp = readSymbol (cp, name); if (vStringLength (name) > 0 && *cp == ':') { labelCandidate = true; ++cp; } if (! isspace ((int) *cp) && *cp != '\0') continue; /* skip white space */ while (isspace ((int) *cp)) ++cp; /* skip leading dot */ #if 0 if (*cp == '.') ++cp; #endif cp = readOperator (cp, operator); /* attempt second read of symbol */ if (vStringLength (name) == 0) { while (isspace ((int) *cp)) ++cp; cp = readSymbol (cp, name); nameFollows = true; } makeAsmTag (name, operator, labelCandidate, nameFollows, directive, &lastMacroCorkIndex); } cppTerminate (); vStringDelete (name); vStringDelete (operator); }