📄 cpp.ll
字号:
}<FindMembers>[ \t]*"Public"|"Peer"|"Package"|"Private"[ \t\n]+ { // Ignore keywords used by makeheader }<FindMembers>[a-z_A-Z~.0-9]+ { // Normal name addType(current); current->name = yytext; if(current_root->section == UNION_SEC && current_root->type.index("enum") != -1) BEGIN(Union); }<FindMembers>"}" { if(current_root->section == NAMESPACE_SEC) current_root = current_root->parent; }<FindMembersName>"operator"/[^a-z_A-Z0-9] { current->name += yytext; BEGIN(Operator); }<FindMembersName>[a-z_A-Z~.0-9]+ { current->name += yytext; }<FindMembersName>. { yyless(0); BEGIN(FindMembers); }<FindMembers>^[ \t]*"#" { BEGIN(SkipCPP); }<SkipCPP>.<SkipCPP>"\\"[ \t]*"\n" { yyLineNr++; }<SkipCPP>\n { yyLineNr++; BEGIN(FindMembers); }<FindMembers>^[ \t]*"#"[ \t]*define[ \t]+ { current->type = "#define"; BEGIN(Define); }<Define>[a-z_A-Z:.0-9]+ { current->name = yytext; BEGIN(DefineEnd); }<DefineEnd>[ \t] { BEGIN(DefineEnd); }<DefineEnd>"("[^)]*")" { current->args = yytext; BEGIN(DefineEnded); }<DefineEnd,DefineEnded>"\\"[ \t]*"\n" { yyLineNr++; }<DefineEnd,DefineEnded>"\n" { if(!noDefines) { current->section = MACRO_SEC;#ifdef DEBUG debug("found macro `%s'", current->name.c_str());#endif current->file = yyFileName; current_root->addSubEntry(current); last = current; current = new Entry; current->protection = protection; } else current->clear(); yyLineNr++; BEGIN(FindMembers); }<FindMembers>[*&]+ { current->name += yytext; }<FindMembers>[;=,] { BEGIN(FindMembersSuffix);#ifdef DEBUG debug("found `%s %s'", current->type.c_str(), current->name.c_str());#endif if(current->section != TYPEDEF_SEC) current->section = VARIABLE_SEC; current->file = yyFileName; current_root->addSubEntry(current); last = current; current = new Entry; // So `int a, b' gives `int a, int b' if(*yytext == ',') current->type = last->type; current->protection = protection; if(*yytext == '=') BEGIN(NextSemi); }<Union>[;=,\n] { BEGIN(FindMembersSuffix);#ifdef DEBUG debug("found `%s %s'", current->type.c_str(), current->name.c_str());#endif if(current->section != TYPEDEF_SEC) current->section = VARIABLE_SEC; current->file = yyFileName; current_root->addSubEntry(current); last = current; current = new Entry; // So `int a, b' gives `int a, int b' if(*yytext == ',') current->type = last->type; current->protection = protection; if(*yytext == '=') BEGIN(NextSemi); }<Friend>[^;\n]+ { current->clear(); current_root->friends.append(new McString(yytext)); }<Friend>[;\n] { lineCount(); BEGIN(FindMembers); }<FindMembers>"[" { current->args += yytext; sharpCount = 1; BEGIN(Array); }<Array>"]" { current->args += *yytext; if(--sharpCount <= 0) BEGIN(FindMembers); }<Array>"[" { current->args += *yytext; sharpCount++; }<Array>. { current->args += *yytext; }<FindMembers>"<" { addType(current); current->type += yytext; sharpCount = 1; BEGIN(Sharp); }<Sharp>">" { current->type += *yytext; if(--sharpCount <= 0) BEGIN(FindMembers); }<Sharp>"<" { current->type += *yytext; sharpCount++; }<Sharp>. { current->type += *yytext; }<Curly>[^\n{}"/]* { current->program += yytext; }<Curly>"//".* { current->program += yytext; }<Curly>\"[^\n"]*]\" { current->program += yytext; }<Curly>"/*"\**[ \t]* { current->program += yytext; BEGIN(Comment); }<Curly>"/*"\**[ \t]*\n { current->program += yytext; ++yyLineNr; BEGIN(Comment); }<Curly>"{" { current->program += yytext; ++curlyBracketCount; ++innerCurlyCount; }<Curly>"}" { if(curlyBracketCount > 0) --curlyBracketCount; if(innerCurlyCount > 0) { // do we have any ``using namespace'' at this level? // if so, remove them for(int i = 0; i < namespace_table.size(); i++) if(namespace_table[i]->innerCurlyCount == innerCurlyCount) { delete namespace_table[i]->name; namespace_table.remove(i); } current->program += yytext; --innerCurlyCount; } else { current_root->addSubEntry(current); current->file = yyFileName; last = current; current = new Entry; current->protection = protection; BEGIN(NextSemi); } }<Curly>\n { current->program += yytext; yyLineNr++; }<Curly>. { current->program += yytext; }<FindMembers>"(" { current->args = yytext; argumentStartPos = 0; BEGIN(Round); }<Round>"(" { current->args += *yytext; ++roundBracketCount; }<Round>")" { current->args += *yytext; if(roundBracketCount) --roundBracketCount; else BEGIN(Function); }<Round>[ \t\n]*"/**" { lineCount(); if(addParamDoc()) BEGIN(Param_Doc); }<Round>[ \t\n]*"///" { lineCount(); if(addParamDoc()) BEGIN(Param_CxxDoc); }<Round>[ \t\n]*","[ \t\n]* { lineCount(); current->args += ", "; }<Round>[ \t\n]+ { lineCount(); current->args += ' '; }<Round>. { current->args += *yytext; }<Param_Doc>\n { current->doc += yytext; yyLineNr++; }<Param_Doc>. { current->doc += yytext; }<Param_Doc>"*/" { BEGIN(Round); }<Param_CxxDoc>.* { current->doc += yytext; }<Param_CxxDoc>\n { yyLineNr++; BEGIN(Round); }<Function>[ \t]*"const"[ \t\n]* { current->args += " const "; lineCount(); }<Function>[ \t]*"throw"[ \t\n]*"(" { current->args += " throw("; lineCount(); BEGIN(Round); }<Function>[ \t]*"raises"[ \t\n]*"(" { // IDL mode current->args += " raises("; lineCount(); BEGIN(Round); }<Function>"(" { current->type += current->name; current->name = current->args; current->args = yytext; BEGIN(Round); }<Function>[ \t]*"="[ \t]*"0" {#ifdef DEBUG debug("found pure virtual method %s %s%s", current->type.c_str(), current->name.c_str(), current->args.c_str());#endif current->pureVirtual = true; }<Function>[:;{] {#ifdef DEBUG debug("found method `%s %s%s'", current->type.c_str(), current->name.c_str(), current->args.c_str());#endif current->section = FUNCTION_SEC; current->file = yyFileName; current_root->addSubEntry(current); for(int i = 0; i < current->args.length(); i++) if(i > 0 && current->args[i] == '*' && current->args[i - 1] == ' ') { current->args.remove(i - 1); current->args.insert(i, " "); } last = current; current = new Entry; current->protection = protection; if(*yytext == '{') { skipReturn = SkipSemiAndCurly; skipCurlyStart = curlyBracketCount; BEGIN(SkipCurly); } else if(*yytext == ':') BEGIN(SkipInits); else BEGIN(FindMembersSuffix); }<Function>. { }<FindMembersSuffix>\n { yyless(0); BEGIN(FindMembers); }<FindMembersSuffix>(.*"///"[ \t]*)|(.*"/**"[ \t]*) { if(QuantelExtn) {#ifdef DEBUG debug("appended note to `%s'", last->name.c_str());#endif last->docify = true; last->memo += " "; BEGIN(GrabSuffixMemo); } else { yyless(0); BEGIN(FindMembers); } }<FindMembersSuffix>.*"//"[ \t]* { if(commentExtn) {#ifdef DEBUG debug("appended note to `%s'", last->name.c_str());#endif last->docify = true; last->memo += " "; BEGIN(GrabSuffixMemo); } else { yyless(0); BEGIN(FindMembers); } }<FindMembersSuffix>. { yyless(0); BEGIN(FindMembers); }<GrabSuffixMemo>. { last->memo += nonewline(*yytext); }<GrabSuffixMemo>"*/"|(\n) { lineCount(); BEGIN(FindMembers); }<SkipSemiOrCurly>; { BEGIN(FindMembers); }<SkipSemiOrCurly>"{" { skipReturn = FindMembers; skipCurlyStart = curlyBracketCount; BEGIN(SkipCurly); }<SkipCurly>"{" { ++curlyBracketCount; }<SkipCurly>"}" { if(curlyBracketCount > skipCurlyStart) --curlyBracketCount; else BEGIN(skipReturn); }<SkipInits>"{" { skipReturn = SkipSemiAndCurly; skipCurlyStart = curlyBracketCount; BEGIN(SkipCurly); }<SkipInits>";" { BEGIN(FindMembers); }<SkipSemiAndCurly>[ \t\n]<SkipSemiAndCurly>("///")|("/**") { yyless(0); BEGIN(FindMembers); }<SkipSemiAndCurly>. { // i.e. a semicolon (or anything else) if(*yytext != ';') yyless(0); BEGIN(FindMembers); }<Bases>";" { current->section = VARIABLE_SEC; current_root->addSubEntry(current); current->file = yyFileName; last = current; current = new Entry; current->protection = protection; BEGIN(FindMembersSuffix); }<IdlUnion>"switch" { current->args += " switch"; BEGIN(IdlSwitch); }<IdlUnion>[a-z_A-Z0-9\[\]*&]+ { current->name += yytext; }<IdlSwitch>[a-z_A-Z0-9\[\]*&]+ { current->args += " "; current->args += yytext; current->args += " "; }<IdlSwitch>[()] { current->args += yytext; }<ClassName>"(" { current->args = yytext; argumentStartPos = 0; BEGIN(Round);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -