📄 cppparser.java
字号:
default: jj_la1[17] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } static final public String scope_override() throws ParseException { String name = ""; Token t; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SCOPE: jj_consume_token(SCOPE); name += "::"; label_8: while (true) { if (jj_2_33(2)) { ; } else { break label_8; } t = jj_consume_token(ID); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LESSTHAN: jj_consume_token(LESSTHAN); template_argument_list(); jj_consume_token(GREATERTHAN); break; default: jj_la1[18] = jj_gen; ; } jj_consume_token(SCOPE); name += t.image + "::"; } break; case ID: label_9: while (true) { t = jj_consume_token(ID); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LESSTHAN: jj_consume_token(LESSTHAN); template_argument_list(); jj_consume_token(GREATERTHAN); break; default: jj_la1[19] = jj_gen; ; } jj_consume_token(SCOPE); name += t.image + "::"; if (jj_2_34(2)) { ; } else { break label_9; } } break; default: jj_la1[20] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return name;} throw new Error("Missing return statement in function"); } static final public String qualified_id() throws ParseException { String name = ""; Token t; if (jj_2_35(2147483647)) { name = scope_override(); } else { ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ID: t = jj_consume_token(ID); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LESSTHAN: jj_consume_token(LESSTHAN); template_argument_list(); jj_consume_token(GREATERTHAN); break; default: jj_la1[21] = jj_gen; ; } {if (true) return name + t.image;} break; case OPERATOR: jj_consume_token(OPERATOR); optor(); {if (true) return "operator";} break; default: jj_la1[22] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } static final public void ptr_to_member() throws ParseException { scope_override(); jj_consume_token(STAR); } static final public void qualified_type() throws ParseException { if (sym.IsFullyScopedTypeName(GetFullyScopedName())) { } else { jj_consume_token(-1); throw new ParseException(); } qualified_id(); } static final public void type_qualifier() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CONST: jj_consume_token(CONST); break; case VOLATILE: jj_consume_token(VOLATILE); break; default: jj_la1[23] = jj_gen; jj_consume_token(-1); throw new ParseException(); } }/** * Very temporary. Just returns true if it sees a typedef. Finally, we will * need a structure that stores all the attributes. */ static final public boolean storage_class_specifier() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case AUTO: case EXTERN: case REGISTER: case STATIC: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case AUTO: jj_consume_token(AUTO); break; case REGISTER: jj_consume_token(REGISTER); break; case STATIC: jj_consume_token(STATIC); break; case EXTERN: jj_consume_token(EXTERN); break; default: jj_la1[24] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return false;} break; case TYPEDEF: jj_consume_token(TYPEDEF); {if (true) return true;} break; default: jj_la1[25] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } static final public void builtin_type_specifier() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VOID: jj_consume_token(VOID); break; case CHAR: jj_consume_token(CHAR); break; case SHORT: jj_consume_token(SHORT); break; case INT: jj_consume_token(INT); break; case LONG: jj_consume_token(LONG); break; case FLOAT: jj_consume_token(FLOAT); break; case DOUBLE: jj_consume_token(DOUBLE); break; case SIGNED: jj_consume_token(SIGNED); break; case UNSIGNED: jj_consume_token(UNSIGNED); break; default: jj_la1[26] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } static final public void init_declarator_list(boolean isTypedef) throws ParseException { init_declarator(isTypedef); label_10: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[27] = jj_gen; break label_10; } jj_consume_token(COMMA); init_declarator(isTypedef); } } static final public void init_declarator(boolean isTypedef) throws ParseException { String name; name = declarator(); if (isTypedef) sym.PutTypeName(name); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPARENTHESIS: case ASSIGNEQUAL: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASSIGNEQUAL: jj_consume_token(ASSIGNEQUAL); initializer(); break; case LPARENTHESIS: jj_consume_token(LPARENTHESIS); expression_list(); jj_consume_token(RPARENTHESIS); break; default: jj_la1[28] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[29] = jj_gen; ; } } static final public void class_head() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRUCT: jj_consume_token(STRUCT); break; case UNION: jj_consume_token(UNION); break; case CLASS: jj_consume_token(CLASS); break; default: jj_la1[30] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ID: jj_consume_token(ID); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COLON: base_clause(null); break; default: jj_la1[31] = jj_gen; ; } break; default: jj_la1[32] = jj_gen; ; } } static final public void class_specifier() throws ParseException { ClassScope sc = null; Token t; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRUCT: jj_consume_token(STRUCT); break; case UNION: jj_consume_token(UNION); break; case CLASS: jj_consume_token(CLASS); break; default: jj_la1[33] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LCURLYBRACE: jj_consume_token(LCURLYBRACE); sym.OpenScope(null, false); label_11: while (true) { if (jj_2_36(1)) { ; } else { break label_11; } member_declaration(); } jj_consume_token(RCURLYBRACE); sym.CloseScope(); break; default: jj_la1[35] = jj_gen; if (jj_2_39(2)) { t = jj_consume_token(ID); sc = (ClassScope)sym.OpenScope(t.image, true); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COLON: base_clause(sc); break; default: jj_la1[34] = jj_gen; ; } jj_consume_token(LCURLYBRACE); label_12: while (true) { if (jj_2_37(1)) { ; } else { break label_12; } member_declaration(); } jj_consume_token(RCURLYBRACE); sym.CloseScope(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ID: t = jj_consume_token(ID); if (jj_2_38(2)) { jj_consume_token(LESSTHAN); template_argument_list(); jj_consume_token(GREATERTHAN); } else { ; } sym.PutTypeName(t.image); break; default: jj_la1[36] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } } static final public void base_clause(ClassScope scope) throws ParseException { jj_consume_token(COLON); base_specifier(scope); label_13: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[37] = jj_gen; break label_13; } jj_consume_token(COMMA); base_specifier(scope); } } static final public void base_specifier(ClassScope scope) throws ParseException { Token t; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PRIVATE: case PROTECTED: case PUBLIC: case VIRTUAL: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PRIVATE: case PROTECTED: case PUBLIC: access_specifier(); break; default: jj_la1[38] = jj_gen; ; } break; case PRIVATE: case PROTECTED: case PUBLIC: access_specifier(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); break; default: jj_la1[39] = jj_gen; ; } break; default: jj_la1[40] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: jj_la1[41] = jj_gen; ; } if (jj_2_40(2147483647)) { scope_override(); } else { ; } t = jj_consume_token(ID); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LESSTHAN: jj_consume_token(LESSTHAN); template_argument_list(); jj_consume_token(GREATERTHAN); break; default: jj_la1[42] = jj_gen; ; } scope.AddSuper(sym.GetScope(t.image)); } static final public void access_specifier() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PUBLIC: jj_consume_token(PUBLIC); break; case PROTECTED: jj_consume_token(PROTECTED); break; case PRIVATE: jj_consume_token(PRIVATE); break; default: jj_la1[43] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } static final public void member_declaration() throws ParseException { boolean isTypedef = false; if (jj_2_41(2147483647)) { declaration(); } else if (jj_2_42(2147483647)) { enum_specifier(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPARENTHESIS: case SCOPE: case AMPERSAND: case STAR: case TILDE: case OPERATOR: case ID: member_declarator_list(false); break; default: jj_la1[44] = jj_gen; ; } jj_consume_token(SEMICOLON); } else if (jj_2_43(2147483647)) { conversion_function_decl_or_def(); } else if (jj_2_44(2147483647)) { dtor_definition(); } else if (jj_2_45(2147483647)) { dtor_ctor_decl_spec(); simple_dtor_declarator(); jj_consume_token(SEMICOLON); } else if (jj_2_46(2147483647)) { ctor_definition(); } else if (jj_2_47(2147483647)) { dtor_ctor_decl_spec(); ctor_declarator(); jj_consume_token(SEMICOLON); } else if (jj_2_48(2147483647)) { function_definition(); } else if (jj_2_49(2147483647)) { isTypedef = declaration_specifiers(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPARENTHESIS: case SCOPE: case AMPERSAND: case STAR: case TILDE: case OPERATOR: case ID: member_declarator_list(isTypedef); break; default: jj_la1[45] = jj_gen; ; } jj_consume_token(SEMICOLON); } else if (jj_2_50(2147483647)) { function_declarator(false); jj_consume_token(SEMICOLON); } else if (jj_2_51(3)) { qualified_id(); jj_consume_token(SEMICOLON); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PRIVATE: case PROTECTED: case PUBLIC: access_specifier(); jj_consume_token(COLON); break; case SEMICOLON: jj_consume_token(SEMICOLON); break; default: jj_la1[46] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } static final public void member_declarator_list(boolean isTypedef) throws ParseException { member_declarator(isTypedef); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -