options { STATIC = false; JAVA_UNICODE_ESCAPE = true; } PARSER_BEGIN(Parser) import edu.neu.ccs.demeter.Ident; import edu.neu.ccs.demeterf.*; import edu.neu.ccs.demeterf.util.*; import java.lang.*; import edu.neu.ccs.demeter.*; public class Parser { // oit is uugly. Why isn't there a Character.valueOf(String)? static char unescapifyChar(String s) { char c = s.charAt(0); if (c == '\\') { switch (s.charAt(1)) { case 'n': c = '\n'; break; case 't': c = '\t'; break; case 'b': c = '\b'; break; case 'r': c = '\r'; break; case 'f': c = '\f'; break; case '\\': c = '\\'; break; case '\'': c = '\''; break; case '\"': c = '\"'; break; default: c = (char) Integer.parseInt(s.substring(1, s.length()), 8); break; } } return c; } // Even uglier... static String unescapify(String s) { char str[] = new char[s.length()]; int i = 0, o = 0; while (i < s.length()) { char c = s.charAt(i++); if (c == '\\') { int j = i + 1; while (j < s.length() && Character.digit(s.charAt(j), 8) != -1) { j++; } c = unescapifyChar(s.substring(i-1, j)); i = j; } str[o++] = c; } return String.valueOf(str, 0, o); } } PARSER_END(Parser) CompilationUnit _CompilationUnit() : { CompilationUnit it = null; PackageDeclaration _packagedeclaration; ImportDeclarations _importdeclarations; TypeDeclarations _typedeclarations; } { { it=new CompilationUnit(); } [ _packagedeclaration=_PackageDeclaration() { it.set_packagedeclaration(_packagedeclaration); } ] _importdeclarations=_ImportDeclarations() { it.set_importdeclarations(_importdeclarations); } _typedeclarations=_TypeDeclarations() { it.set_typedeclarations(_typedeclarations); } { return it; } } PackageDeclaration _PackageDeclaration() : { PackageDeclaration it = null; Name _name; } { { it=new PackageDeclaration(); } "package" _name=_Name() { it.set_name(_name); } ";" { return it; } } ImportDeclarations _ImportDeclarations() : { ImportDeclarations it = null; Nonempty_ImportDeclarations _first; } { { it=new ImportDeclarations(); } [ _first=_Nonempty_ImportDeclarations() { it.set_first(_first); } ] { return it; } } ImportDeclaration _ImportDeclaration() : { ImportDeclaration it = null; Name _name; DotStar _dotstar; } { { it=new ImportDeclaration(); } "import" _name=_Name() { it.set_name(_name); } [ _dotstar=_DotStar() { it.set_dotstar(_dotstar); } ] ";" { return it; } } DotStar _DotStar() : { DotStar it = null; } { { it=new DotStar(); } ".*" { return it; } } TypeDeclarations _TypeDeclarations() : { TypeDeclarations it = null; Nonempty_TypeDeclarations _first; } { { it=new TypeDeclarations(); } [ _first=_Nonempty_TypeDeclarations() { it.set_first(_first); } ] { return it; } } TypeDeclaration _TypeDeclaration() : { TypeDeclaration it = null; } { ( LOOKAHEAD ( ( "abstract" | "final" | "public" )* "class" )it=_ClassDeclaration() | it=_InterfaceDeclaration() | it=_SemiColonTD() ) { return it; } } void common_TypeDeclaration(TypeDeclaration it) : { } { { } } SemiColonTD _SemiColonTD() : { SemiColonTD it = null; SemiColon _semicolon; } { { it=new SemiColonTD(); } _semicolon=_SemiColon() { it.set_semicolon(_semicolon); } common_TypeDeclaration(it) { return it; } } ClassDeclaration _ClassDeclaration() : { ClassDeclaration it = null; ClassModifiers _classmodifiers; UnmodifiedClassDeclaration _unmodifiedclassdeclaration; } { { it=new ClassDeclaration(); } _classmodifiers=_ClassModifiers() { it.set_classmodifiers(_classmodifiers); } _unmodifiedclassdeclaration=_UnmodifiedClassDeclaration() { it.set_unmodifiedclassdeclaration(_unmodifiedclassdeclaration); } common_TypeDeclaration(it) { return it; } } ClassModifiers _ClassModifiers() : { ClassModifiers it = null; Nonempty_ClassModifiers _first; } { { it=new ClassModifiers(); } [ _first=_Nonempty_ClassModifiers() { it.set_first(_first); } ] { return it; } } ClassModifier _ClassModifier() : { ClassModifier it = null; } { ( it=_CM_Abstract() | it=_CM_Final() | it=_CM_Public() ) { return it; } } void common_ClassModifier(ClassModifier it) : { } { { } } CM_Abstract _CM_Abstract() : { CM_Abstract it = null; CAbstract _cabstract; } { { it=new CM_Abstract(); } _cabstract=_CAbstract() { it.set_cabstract(_cabstract); } common_ClassModifier(it) { return it; } } CM_Final _CM_Final() : { CM_Final it = null; CFinal _cfinal; } { { it=new CM_Final(); } _cfinal=_CFinal() { it.set_cfinal(_cfinal); } common_ClassModifier(it) { return it; } } CM_Public _CM_Public() : { CM_Public it = null; CPublic _cpublic; } { { it=new CM_Public(); } _cpublic=_CPublic() { it.set_cpublic(_cpublic); } common_ClassModifier(it) { return it; } } UnmodifiedClassDeclaration _UnmodifiedClassDeclaration() : { UnmodifiedClassDeclaration it = null; Ident _ident; Name _name; NameList _namelist; ClassBody _classbody; } { { it=new UnmodifiedClassDeclaration(); } "class" _ident=_Ident() { it.set_ident(_ident); } [ "extends" _name=_Name() { it.set_name(_name); } ] [ "implements" _namelist=_NameList() { it.set_namelist(_namelist); } ] _classbody=_ClassBody() { it.set_classbody(_classbody); } common_BlockStatement(it) { return it; } } ClassBody _ClassBody() : { ClassBody it = null; ClassBodyDeclarations _classbodydeclarations; } { { it=new ClassBody(); } "{" _classbodydeclarations=_ClassBodyDeclarations() { it.set_classbodydeclarations(_classbodydeclarations); } "}" { return it; } } ClassBodyDeclarations _ClassBodyDeclarations() : { ClassBodyDeclarations it = null; Nonempty_ClassBodyDeclarations _first; } { { it=new ClassBodyDeclarations(); } [ _first=_Nonempty_ClassBodyDeclarations() { it.set_first(_first); } ] { return it; } } NestedClassDeclaration _NestedClassDeclaration() : { NestedClassDeclaration it = null; NestedClassModifiers _nestedclassmodifiers; UnmodifiedClassDeclaration _unmodifiedclassdeclaration; } { { it=new NestedClassDeclaration(); } _nestedclassmodifiers=_NestedClassModifiers() { it.set_nestedclassmodifiers(_nestedclassmodifiers); } _unmodifiedclassdeclaration=_UnmodifiedClassDeclaration() { it.set_unmodifiedclassdeclaration(_unmodifiedclassdeclaration); } { return it; } } NestedClassModifiers _NestedClassModifiers() : { NestedClassModifiers it = null; Nonempty_NestedClassModifiers _first; } { { it=new NestedClassModifiers(); } [ _first=_Nonempty_NestedClassModifiers() { it.set_first(_first); } ] { return it; } } NestedClassModifier _NestedClassModifier() : { NestedClassModifier it = null; } { ( it=_NCM_Static() | it=_NCM_Abstract() | it=_NCM_Final() | it=_NCM_Public() | it=_NCM_Protected() | it=_NCM_Private() ) { return it; } } void common_NestedClassModifier(NestedClassModifier it) : { } { { } } NCM_Static _NCM_Static() : { NCM_Static it = null; CStatic _cstatic; } { { it=new NCM_Static(); } _cstatic=_CStatic() { it.set_cstatic(_cstatic); } common_NestedClassModifier(it) { return it; } } NCM_Abstract _NCM_Abstract() : { NCM_Abstract it = null; CAbstract _cabstract; } { { it=new NCM_Abstract(); } _cabstract=_CAbstract() { it.set_cabstract(_cabstract); } common_NestedClassModifier(it) { return it; } } NCM_Final _NCM_Final() : { NCM_Final it = null; CFinal _cfinal; } { { it=new NCM_Final(); } _cfinal=_CFinal() { it.set_cfinal(_cfinal); } common_NestedClassModifier(it) { return it; } } NCM_Public _NCM_Public() : { NCM_Public it = null; CPublic _cpublic; } { { it=new NCM_Public(); } _cpublic=_CPublic() { it.set_cpublic(_cpublic); } common_NestedClassModifier(it) { return it; } } NCM_Protected _NCM_Protected() : { NCM_Protected it = null; CProtected _cprotected; } { { it=new NCM_Protected(); } _cprotected=_CProtected() { it.set_cprotected(_cprotected); } common_NestedClassModifier(it) { return it; } } NCM_Private _NCM_Private() : { NCM_Private it = null; CPrivate _cprivate; } { { it=new NCM_Private(); } _cprivate=_CPrivate() { it.set_cprivate(_cprivate); } common_NestedClassModifier(it) { return it; } } ClassBodyDeclaration _ClassBodyDeclaration() : { ClassBodyDeclaration it = null; } { ( LOOKAHEAD (2)it=_Initializer() | LOOKAHEAD (("static"|"abstract"|"final"|"public"|"protected"|"private")*"class")it=_CBD_NestedClassDeclaration() | LOOKAHEAD (("static"|"abstract"|"final"|"public"|"protected"|"private")*"interface")it=_CBD_NestedInterfaceDeclaration() | LOOKAHEAD (["public"|"protected"|"private"] _Name() "(")it=_ConstructorDeclaration() | LOOKAHEAD (("public"|"protected"|"private"|"static"|"abstract"|"final"|"native"|"synchronized")* _ResultType() _Identifier() "(")it=_CBD_MethodDeclaration() | it=_CBD_FieldDeclaration() ) { return it; } } void common_ClassBodyDeclaration(ClassBodyDeclaration it) : { } { { } } CBD_NestedClassDeclaration _CBD_NestedClassDeclaration() : { CBD_NestedClassDeclaration it = null; NestedClassDeclaration _nestedclassdeclaration; } { { it=new CBD_NestedClassDeclaration(); } _nestedclassdeclaration=_NestedClassDeclaration() { it.set_nestedclassdeclaration(_nestedclassdeclaration); } common_ClassBodyDeclaration(it) { return it; } } CBD_NestedInterfaceDeclaration _CBD_NestedInterfaceDeclaration() : { CBD_NestedInterfaceDeclaration it = null; NestedInterfaceDeclaration _nestedinterfacedeclaration; } { { it=new CBD_NestedInterfaceDeclaration(); } _nestedinterfacedeclaration=_NestedInterfaceDeclaration() { it.set_nestedinterfacedeclaration(_nestedinterfacedeclaration); } common_ClassBodyDeclaration(it) { return it; } } CBD_MethodDeclaration _CBD_MethodDeclaration() : { CBD_MethodDeclaration it = null; MethodDeclaration _methoddeclaration; } { { it=new CBD_MethodDeclaration(); } _methoddeclaration=_MethodDeclaration() { it.set_methoddeclaration(_methoddeclaration); } common_ClassBodyDeclaration(it) { return it; } } CBD_FieldDeclaration _CBD_FieldDeclaration() : { CBD_FieldDeclaration it = null; FieldDeclaration _fielddeclaration; } { { it=new CBD_FieldDeclaration(); } _fielddeclaration=_FieldDeclaration() { it.set_fielddeclaration(_fielddeclaration); } common_ClassBodyDeclaration(it) { return it; } } InterfaceDeclaration _InterfaceDeclaration() : { InterfaceDeclaration it = null; InterfaceModifiers _interfacemodifiers; UnmodifiedInterfaceDeclaration _unmodifiedinterfacedeclaration; } { { it=new InterfaceDeclaration(); } _interfacemodifiers=_InterfaceModifiers() { it.set_interfacemodifiers(_interfacemodifiers); } _unmodifiedinterfacedeclaration=_UnmodifiedInterfaceDeclaration() { it.set_unmodifiedinterfacedeclaration(_unmodifiedinterfacedeclaration); } common_TypeDeclaration(it) { return it; } } InterfaceModifiers _InterfaceModifiers() : { InterfaceModifiers it = null; Nonempty_InterfaceModifiers _first; } { { it=new InterfaceModifiers(); } [ _first=_Nonempty_InterfaceModifiers() { it.set_first(_first); } ] { return it; } } InterfaceModifier _InterfaceModifier() : { InterfaceModifier it = null; } { ( it=_IM_Abstract() | it=_IM_Public() ) { return it; } } void common_InterfaceModifier(InterfaceModifier it) : { } { { } } IM_Abstract _IM_Abstract() : { IM_Abstract it = null; CAbstract _cabstract; } { { it=new IM_Abstract(); } _cabstract=_CAbstract() { it.set_cabstract(_cabstract); } common_InterfaceModifier(it) { return it; } } IM_Public _IM_Public() : { IM_Public it = null; CPublic _cpublic; } { { it=new IM_Public(); } _cpublic=_CPublic() { it.set_cpublic(_cpublic); } common_InterfaceModifier(it) { return it; } } NestedInterfaceDeclaration _NestedInterfaceDeclaration() : { NestedInterfaceDeclaration it = null; NestedInterfaceModifiers _nestedinterfacemodifiers; UnmodifiedInterfaceDeclaration _unmodifiedinterfacedeclaration; } { { it=new NestedInterfaceDeclaration(); } _nestedinterfacemodifiers=_NestedInterfaceModifiers() { it.set_nestedinterfacemodifiers(_nestedinterfacemodifiers); } _unmodifiedinterfacedeclaration=_UnmodifiedInterfaceDeclaration() { it.set_unmodifiedinterfacedeclaration(_unmodifiedinterfacedeclaration); } { return it; } } NestedInterfaceModifiers _NestedInterfaceModifiers() : { NestedInterfaceModifiers it = null; Nonempty_NestedInterfaceModifiers _first; } { { it=new NestedInterfaceModifiers(); } [ _first=_Nonempty_NestedInterfaceModifiers() { it.set_first(_first); } ] { return it; } } NestedInterfaceModifier _NestedInterfaceModifier() : { NestedInterfaceModifier it = null; } { ( it=_NIM_Static() | it=_NIM_Abstract() | it=_NIM_Final() | it=_NIM_Public() | it=_NIM_Protected() | it=_NIM_Private() ) { return it; } } void common_NestedInterfaceModifier(NestedInterfaceModifier it) : { } { { } } NIM_Static _NIM_Static() : { NIM_Static it = null; CStatic _cstatic; } { { it=new NIM_Static(); } _cstatic=_CStatic() { it.set_cstatic(_cstatic); } common_NestedInterfaceModifier(it) { return it; } } NIM_Abstract _NIM_Abstract() : { NIM_Abstract it = null; CAbstract _cabstract; } { { it=new NIM_Abstract(); } _cabstract=_CAbstract() { it.set_cabstract(_cabstract); } common_NestedInterfaceModifier(it) { return it; } } NIM_Final _NIM_Final() : { NIM_Final it = null; CFinal _cfinal; } { { it=new NIM_Final(); } _cfinal=_CFinal() { it.set_cfinal(_cfinal); } common_NestedInterfaceModifier(it) { return it; } } NIM_Public _NIM_Public() : { NIM_Public it = null; CPublic _cpublic; } { { it=new NIM_Public(); } _cpublic=_CPublic() { it.set_cpublic(_cpublic); } common_NestedInterfaceModifier(it) { return it; } } NIM_Protected _NIM_Protected() : { NIM_Protected it = null; CProtected _cprotected; } { { it=new NIM_Protected(); } _cprotected=_CProtected() { it.set_cprotected(_cprotected); } common_NestedInterfaceModifier(it) { return it; } } NIM_Private _NIM_Private() : { NIM_Private it = null; CPrivate _cprivate; } { { it=new NIM_Private(); } _cprivate=_CPrivate() { it.set_cprivate(_cprivate); } common_NestedInterfaceModifier(it) { return it; } } UnmodifiedInterfaceDeclaration _UnmodifiedInterfaceDeclaration() : { UnmodifiedInterfaceDeclaration it = null; Identifier _identifier; NameList _namelist; InterfaceMemberDeclarations _interfacememberdeclarations; } { { it=new UnmodifiedInterfaceDeclaration(); } "interface" _identifier=_Identifier() { it.set_identifier(_identifier); } [ "extends" _namelist=_NameList() { it.set_namelist(_namelist); } ] "{" _interfacememberdeclarations=_InterfaceMemberDeclarations() { it.set_interfacememberdeclarations(_interfacememberdeclarations); } "}" { return it; } } InterfaceMemberDeclarations _InterfaceMemberDeclarations() : { InterfaceMemberDeclarations it = null; Nonempty_InterfaceMemberDeclarations _first; } { { it=new InterfaceMemberDeclarations(); } [ _first=_Nonempty_InterfaceMemberDeclarations() { it.set_first(_first); } ] { return it; } } InterfaceMemberDeclaration _InterfaceMemberDeclaration() : { InterfaceMemberDeclaration it = null; } { ( LOOKAHEAD (("static"|"abstract"|"final"|"public"|"protected"|"private")* "class")it=_IMD_NestedClassDeclaration() | LOOKAHEAD (("static"|"abstract"|"final"|"public"|"protected"|"private")* "interface")it=_IMD_NestedInterfaceDeclaration() | LOOKAHEAD (("public"|"protected"|"private"|"static"|"abstract"|"final"|"native"|"synchronized")* _ResultType() _Identifier() "(")it=_IMD_MethodDeclaration() | it=_IMD_FieldDeclaration() ) { return it; } } void common_InterfaceMemberDeclaration(InterfaceMemberDeclaration it) : { } { { } } IMD_NestedClassDeclaration _IMD_NestedClassDeclaration() : { IMD_NestedClassDeclaration it = null; NestedClassDeclaration _nestedclassdeclaration; } { { it=new IMD_NestedClassDeclaration(); } _nestedclassdeclaration=_NestedClassDeclaration() { it.set_nestedclassdeclaration(_nestedclassdeclaration); } common_InterfaceMemberDeclaration(it) { return it; } } IMD_NestedInterfaceDeclaration _IMD_NestedInterfaceDeclaration() : { IMD_NestedInterfaceDeclaration it = null; NestedInterfaceDeclaration _nestedinterfacedeclaration; } { { it=new IMD_NestedInterfaceDeclaration(); } _nestedinterfacedeclaration=_NestedInterfaceDeclaration() { it.set_nestedinterfacedeclaration(_nestedinterfacedeclaration); } common_InterfaceMemberDeclaration(it) { return it; } } IMD_MethodDeclaration _IMD_MethodDeclaration() : { IMD_MethodDeclaration it = null; MethodDeclaration _methoddeclaration; } { { it=new IMD_MethodDeclaration(); } _methoddeclaration=_MethodDeclaration() { it.set_methoddeclaration(_methoddeclaration); } common_InterfaceMemberDeclaration(it) { return it; } } IMD_FieldDeclaration _IMD_FieldDeclaration() : { IMD_FieldDeclaration it = null; FieldDeclaration _fielddeclaration; } { { it=new IMD_FieldDeclaration(); } _fielddeclaration=_FieldDeclaration() { it.set_fielddeclaration(_fielddeclaration); } common_InterfaceMemberDeclaration(it) { return it; } } FieldDeclaration _FieldDeclaration() : { FieldDeclaration it = null; FieldModifiers _fieldmodifiers; Type _type; VariableDeclarators _variabledeclarators; } { { it=new FieldDeclaration(); } _fieldmodifiers=_FieldModifiers() { it.set_fieldmodifiers(_fieldmodifiers); } _type=_Type() { it.set_type(_type); } _variabledeclarators=_VariableDeclarators() { it.set_variabledeclarators(_variabledeclarators); } ";" { return it; } } FieldModifiers _FieldModifiers() : { FieldModifiers it = null; Nonempty_FieldModifiers _first; } { { it=new FieldModifiers(); } [ _first=_Nonempty_FieldModifiers() { it.set_first(_first); } ] { return it; } } FieldModifier _FieldModifier() : { FieldModifier it = null; } { ( it=_FM_Public() | it=_FM_Protected() | it=_FM_Private() | it=_FM_Static() | it=_FM_Final() | it=_FM_Transient() | it=_FM_Volatile() ) { return it; } } void common_FieldModifier(FieldModifier it) : { } { { } } FM_Public _FM_Public() : { FM_Public it = null; CPublic _cpublic; } { { it=new FM_Public(); } _cpublic=_CPublic() { it.set_cpublic(_cpublic); } common_FieldModifier(it) { return it; } } FM_Protected _FM_Protected() : { FM_Protected it = null; CProtected _cprotected; } { { it=new FM_Protected(); } _cprotected=_CProtected() { it.set_cprotected(_cprotected); } common_FieldModifier(it) { return it; } } FM_Private _FM_Private() : { FM_Private it = null; CPrivate _cprivate; } { { it=new FM_Private(); } _cprivate=_CPrivate() { it.set_cprivate(_cprivate); } common_FieldModifier(it) { return it; } } FM_Static _FM_Static() : { FM_Static it = null; CStatic _cstatic; } { { it=new FM_Static(); } _cstatic=_CStatic() { it.set_cstatic(_cstatic); } common_FieldModifier(it) { return it; } } FM_Final _FM_Final() : { FM_Final it = null; CFinal _cfinal; } { { it=new FM_Final(); } _cfinal=_CFinal() { it.set_cfinal(_cfinal); } common_FieldModifier(it) { return it; } } FM_Transient _FM_Transient() : { FM_Transient it = null; CTransient _ctransient; } { { it=new FM_Transient(); } _ctransient=_CTransient() { it.set_ctransient(_ctransient); } common_FieldModifier(it) { return it; } } FM_Volatile _FM_Volatile() : { FM_Volatile it = null; CVolatile _cvolatile; } { { it=new FM_Volatile(); } _cvolatile=_CVolatile() { it.set_cvolatile(_cvolatile); } common_FieldModifier(it) { return it; } } VariableDeclarators _VariableDeclarators() : { VariableDeclarators it = null; Nonempty_VariableDeclarators _first; } { { it=new VariableDeclarators(); } _first=_Nonempty_VariableDeclarators() { it.set_first(_first); } { return it; } } VariableDeclarator _VariableDeclarator() : { VariableDeclarator it = null; VariableDeclaratorId _variabledeclaratorid; VariableInitializer _variableinitializer; } { { it=new VariableDeclarator(); } _variabledeclaratorid=_VariableDeclaratorId() { it.set_variabledeclaratorid(_variabledeclaratorid); } [ "=" _variableinitializer=_VariableInitializer() { it.set_variableinitializer(_variableinitializer); } ] { return it; } } VariableDeclaratorId _VariableDeclaratorId() : { VariableDeclaratorId it = null; Identifier _identifier; SquareBrackets _squarebrackets; } { { it=new VariableDeclaratorId(); } _identifier=_Identifier() { it.set_identifier(_identifier); } _squarebrackets=_SquareBrackets() { it.set_squarebrackets(_squarebrackets); } { return it; } } SquareBrackets _SquareBrackets() : { SquareBrackets it = null; Nonempty_SquareBrackets _first; } { { it=new SquareBrackets(); } [ LOOKAHEAD (2) _first=_Nonempty_SquareBrackets() { it.set_first(_first); } ] { return it; } } SquareBracket _SquareBracket() : { SquareBracket it = null; } { { it=new SquareBracket(); } "[" "]" { return it; } } VariableInitializer _VariableInitializer() : { VariableInitializer it = null; } { ( it=_ArrayInitializer() | it=_Expression() ) { return it; } } void common_VariableInitializer(VariableInitializer it) : { } { { } } ArrayInitializer _ArrayInitializer() : { ArrayInitializer it = null; VariableInitializers _variableinitializers; Comma _comma; } { { it=new ArrayInitializer(); } "{" [ _variableinitializers=_VariableInitializers() { it.set_variableinitializers(_variableinitializers); } ] [ _comma=_Comma() { it.set_comma(_comma); } ] "}" common_VariableInitializer(it) { return it; } } VariableInitializers _VariableInitializers() : { VariableInitializers it = null; Nonempty_VariableInitializers _first; } { { it=new VariableInitializers(); } _first=_Nonempty_VariableInitializers() { it.set_first(_first); } { return it; } } Comma _Comma() : { Comma it = null; } { { it=new Comma(); } "," { return it; } } MethodDeclaration _MethodDeclaration() : { MethodDeclaration it = null; MethodModifiers _methodmodifiers; ResultType _resulttype; MethodDeclarator _methoddeclarator; NameList _namelist; AnyBlock _anyblock; } { { it=new MethodDeclaration(); } _methodmodifiers=_MethodModifiers() { it.set_methodmodifiers(_methodmodifiers); } _resulttype=_ResultType() { it.set_resulttype(_resulttype); } _methoddeclarator=_MethodDeclarator() { it.set_methoddeclarator(_methoddeclarator); } [ "throws" _namelist=_NameList() { it.set_namelist(_namelist); } ] _anyblock=_AnyBlock() { it.set_anyblock(_anyblock); } { return it; } } MethodModifiers _MethodModifiers() : { MethodModifiers it = null; Nonempty_MethodModifiers _first; } { { it=new MethodModifiers(); } [ _first=_Nonempty_MethodModifiers() { it.set_first(_first); } ] { return it; } } MethodModifier _MethodModifier() : { MethodModifier it = null; } { ( it=_MM_Public() | it=_MM_Protected() | it=_MM_Private() | it=_MM_Static() | it=_MM_Abstract() | it=_MM_Final() | it=_MM_Native() | it=_MM_Synchronized() ) { return it; } } void common_MethodModifier(MethodModifier it) : { } { { } } MM_Public _MM_Public() : { MM_Public it = null; CPublic _cpublic; } { { it=new MM_Public(); } _cpublic=_CPublic() { it.set_cpublic(_cpublic); } common_MethodModifier(it) { return it; } } MM_Protected _MM_Protected() : { MM_Protected it = null; CProtected _cprotected; } { { it=new MM_Protected(); } _cprotected=_CProtected() { it.set_cprotected(_cprotected); } common_MethodModifier(it) { return it; } } MM_Private _MM_Private() : { MM_Private it = null; CPrivate _cprivate; } { { it=new MM_Private(); } _cprivate=_CPrivate() { it.set_cprivate(_cprivate); } common_MethodModifier(it) { return it; } } MM_Static _MM_Static() : { MM_Static it = null; CStatic _cstatic; } { { it=new MM_Static(); } _cstatic=_CStatic() { it.set_cstatic(_cstatic); } common_MethodModifier(it) { return it; } } MM_Abstract _MM_Abstract() : { MM_Abstract it = null; CAbstract _cabstract; } { { it=new MM_Abstract(); } _cabstract=_CAbstract() { it.set_cabstract(_cabstract); } common_MethodModifier(it) { return it; } } MM_Final _MM_Final() : { MM_Final it = null; CFinal _cfinal; } { { it=new MM_Final(); } _cfinal=_CFinal() { it.set_cfinal(_cfinal); } common_MethodModifier(it) { return it; } } MM_Native _MM_Native() : { MM_Native it = null; CNative _cnative; } { { it=new MM_Native(); } _cnative=_CNative() { it.set_cnative(_cnative); } common_MethodModifier(it) { return it; } } MM_Synchronized _MM_Synchronized() : { MM_Synchronized it = null; CSynchronized _csynchronized; } { { it=new MM_Synchronized(); } _csynchronized=_CSynchronized() { it.set_csynchronized(_csynchronized); } common_MethodModifier(it) { return it; } } AnyBlock _AnyBlock() : { AnyBlock it = null; } { ( it=_A_Block() | it=_A_SemiColon() ) { return it; } } void common_AnyBlock(AnyBlock it) : { } { { } } A_Block _A_Block() : { A_Block it = null; Block _block; } { { it=new A_Block(); } _block=_Block() { it.set_block(_block); } common_AnyBlock(it) { return it; } } A_SemiColon _A_SemiColon() : { A_SemiColon it = null; SemiColon _semicolon; } { { it=new A_SemiColon(); } _semicolon=_SemiColon() { it.set_semicolon(_semicolon); } common_AnyBlock(it) { return it; } } MethodDeclarator _MethodDeclarator() : { MethodDeclarator it = null; Identifier _identifier; FormalParameters _formalparameters; SquareBrackets _squarebrackets; } { { it=new MethodDeclarator(); } _identifier=_Identifier() { it.set_identifier(_identifier); } _formalparameters=_FormalParameters() { it.set_formalparameters(_formalparameters); } _squarebrackets=_SquareBrackets() { it.set_squarebrackets(_squarebrackets); } { return it; } } FormalParameters _FormalParameters() : { FormalParameters it = null; FormalParameterList _formalparameterlist; } { { it=new FormalParameters(); } "(" [ _formalparameterlist=_FormalParameterList() { it.set_formalparameterlist(_formalparameterlist); } ] ")" { return it; } } FormalParameterList _FormalParameterList() : { FormalParameterList it = null; Nonempty_FormalParameterList _first; } { { it=new FormalParameterList(); } _first=_Nonempty_FormalParameterList() { it.set_first(_first); } { return it; } } FormalParameter _FormalParameter() : { FormalParameter it = null; CFinal _cfinal; Type _type; VariableDeclaratorId _variabledeclaratorid; } { { it=new FormalParameter(); } [ _cfinal=_CFinal() { it.set_cfinal(_cfinal); } ] _type=_Type() { it.set_type(_type); } _variabledeclaratorid=_VariableDeclaratorId() { it.set_variabledeclaratorid(_variabledeclaratorid); } { return it; } } ConstructorDeclaration _ConstructorDeclaration() : { ConstructorDeclaration it = null; ConstructorModifier _constructormodifier; Identifier _identifier; FormalParameters _formalparameters; NameList _namelist; ExplicitConstructorInvocation _explicitconstructorinvocation; BlockStatements _blockstatements; } { { it=new ConstructorDeclaration(); } [ _constructormodifier=_ConstructorModifier() { it.set_constructormodifier(_constructormodifier); } ] _identifier=_Identifier() { it.set_identifier(_identifier); } _formalparameters=_FormalParameters() { it.set_formalparameters(_formalparameters); } [ "throws" _namelist=_NameList() { it.set_namelist(_namelist); } ] "{" [ LOOKAHEAD (_ExplicitConstructorInvocation()) _explicitconstructorinvocation=_ExplicitConstructorInvocation() { it.set_explicitconstructorinvocation(_explicitconstructorinvocation); } ] _blockstatements=_BlockStatements() { it.set_blockstatements(_blockstatements); } "}" common_ClassBodyDeclaration(it) { return it; } } ConstructorModifier _ConstructorModifier() : { ConstructorModifier it = null; } { ( it=_CSM_Public() | it=_CSM_Protected() | it=_CSM_Private() ) { return it; } } void common_ConstructorModifier(ConstructorModifier it) : { } { { } } CSM_Public _CSM_Public() : { CSM_Public it = null; CPublic _cpublic; } { { it=new CSM_Public(); } _cpublic=_CPublic() { it.set_cpublic(_cpublic); } common_ConstructorModifier(it) { return it; } } CSM_Protected _CSM_Protected() : { CSM_Protected it = null; CProtected _cprotected; } { { it=new CSM_Protected(); } _cprotected=_CProtected() { it.set_cprotected(_cprotected); } common_ConstructorModifier(it) { return it; } } CSM_Private _CSM_Private() : { CSM_Private it = null; CPrivate _cprivate; } { { it=new CSM_Private(); } _cprivate=_CPrivate() { it.set_cprivate(_cprivate); } common_ConstructorModifier(it) { return it; } } BlockStatements _BlockStatements() : { BlockStatements it = null; Nonempty_BlockStatements _first; } { { it=new BlockStatements(); } [ _first=_Nonempty_BlockStatements() { it.set_first(_first); } ] { return it; } } ExplicitConstructorInvocation _ExplicitConstructorInvocation() : { ExplicitConstructorInvocation it = null; } { ( LOOKAHEAD ("this" _Arguments() ";")it=_ThisConsInvoc() | it=_SuperConsInvoc() ) { return it; } } void common_ExplicitConstructorInvocation(ExplicitConstructorInvocation it) : { } { { } } ThisConsInvoc _ThisConsInvoc() : { ThisConsInvoc it = null; Arguments _arguments; } { { it=new ThisConsInvoc(); } "this" _arguments=_Arguments() { it.set_arguments(_arguments); } ";" common_ExplicitConstructorInvocation(it) { return it; } } SuperConsInvoc _SuperConsInvoc() : { SuperConsInvoc it = null; PrimaryExpression _primaryexpression; Arguments _arguments; } { { it=new SuperConsInvoc(); } [ LOOKAHEAD (2) _primaryexpression=_PrimaryExpression() { it.set_primaryexpression(_primaryexpression); } "." ] "super" _arguments=_Arguments() { it.set_arguments(_arguments); } ";" common_ExplicitConstructorInvocation(it) { return it; } } Initializer _Initializer() : { Initializer it = null; CStatic _cstatic; Block _block; } { { it=new Initializer(); } [ _cstatic=_CStatic() { it.set_cstatic(_cstatic); } ] _block=_Block() { it.set_block(_block); } common_ClassBodyDeclaration(it) { return it; } } CPublic _CPublic() : { CPublic it = null; } { { it=new CPublic(); } "public" { return it; } } CProtected _CProtected() : { CProtected it = null; } { { it=new CProtected(); } "protected" { return it; } } CPrivate _CPrivate() : { CPrivate it = null; } { { it=new CPrivate(); } "private" { return it; } } CStatic _CStatic() : { CStatic it = null; } { { it=new CStatic(); } "static" { return it; } } CAbstract _CAbstract() : { CAbstract it = null; } { { it=new CAbstract(); } "abstract" { return it; } } CFinal _CFinal() : { CFinal it = null; } { { it=new CFinal(); } "final" { return it; } } CNative _CNative() : { CNative it = null; } { { it=new CNative(); } "native" { return it; } } CSynchronized _CSynchronized() : { CSynchronized it = null; } { { it=new CSynchronized(); } "synchronized" { return it; } } CTransient _CTransient() : { CTransient it = null; } { { it=new CTransient(); } "transient" { return it; } } CVolatile _CVolatile() : { CVolatile it = null; } { { it=new CVolatile(); } "volatile" { return it; } } Type _Type() : { Type it = null; TypeAlt _typealt; SquareBrackets _squarebrackets; } { { it=new Type(); } _typealt=_TypeAlt() { it.set_typealt(_typealt); } _squarebrackets=_SquareBrackets() { it.set_squarebrackets(_squarebrackets); } common_ResultType(it) { return it; } } TypeAlt _TypeAlt() : { TypeAlt it = null; } { ( it=_PrimitiveType() | it=_TName() ) { return it; } } void common_TypeAlt(TypeAlt it) : { } { { } } TName _TName() : { TName it = null; Name _name; } { { it=new TName(); } _name=_Name() { it.set_name(_name); } common_TypeAlt(it) { return it; } } PrimitiveType _PrimitiveType() : { PrimitiveType it = null; } { ( it=_boolType() | it=_byteType() | it=_charType() | it=_shortType() | it=_intType() | it=_floatType() | it=_longType() | it=_doubleType() ) { return it; } } void common_PrimitiveType(PrimitiveType it) : { } { common_TypeAlt(it) { } } boolType _boolType() : { boolType it = null; } { { it=new boolType(); } "boolean" common_PrimitiveType(it) { return it; } } byteType _byteType() : { byteType it = null; } { { it=new byteType(); } "byte" common_PrimitiveType(it) { return it; } } charType _charType() : { charType it = null; } { { it=new charType(); } "char" common_PrimitiveType(it) { return it; } } shortType _shortType() : { shortType it = null; } { { it=new shortType(); } "short" common_PrimitiveType(it) { return it; } } intType _intType() : { intType it = null; } { { it=new intType(); } "int" common_PrimitiveType(it) { return it; } } floatType _floatType() : { floatType it = null; } { { it=new floatType(); } "float" common_PrimitiveType(it) { return it; } } longType _longType() : { longType it = null; } { { it=new longType(); } "long" common_PrimitiveType(it) { return it; } } doubleType _doubleType() : { doubleType it = null; } { { it=new doubleType(); } "double" common_PrimitiveType(it) { return it; } } ResultType _ResultType() : { ResultType it = null; } { ( it=_Void() | it=_Type() ) { return it; } } void common_ResultType(ResultType it) : { } { { } } Void _Void() : { Void it = null; } { { it=new Void(); } "void" common_ResultType(it) { return it; } } Name _Name() : { Name it = null; Nonempty_Name _first; } { { it=new Name(); } _first=_Nonempty_Name() { it.set_first(_first); } { return it; } } NameList _NameList() : { NameList it = null; Nonempty_NameList _first; } { { it=new NameList(); } _first=_Nonempty_NameList() { it.set_first(_first); } { return it; } } Identifier _Identifier() : { Identifier it = null; Ident _ident; } { { it=new Identifier(); } _ident=_Ident() { it.set_ident(_ident); } { return it; } } SemiColon _SemiColon() : { SemiColon it = null; } { { it=new SemiColon(); } ";" { return it; } } Expression _Expression() : { Expression it = null; } { ( LOOKAHEAD ( _PrimaryExpression() _AssignmentOperator())it=_E_Assignment() | it=_ConditionalExpression() ) { return it; } } void common_Expression(Expression it) : { } { common_VariableInitializer(it) { } } E_Assignment _E_Assignment() : { E_Assignment it = null; Assignment _assignment; } { { it=new E_Assignment(); } _assignment=_Assignment() { it.set_assignment(_assignment); } common_Expression(it) { return it; } } Assignment _Assignment() : { Assignment it = null; PrimaryExpression _primaryexpression; AssignmentOperator _assignmentoperator; Expression _expression; } { { it=new Assignment(); } _primaryexpression=_PrimaryExpression() { it.set_primaryexpression(_primaryexpression); } _assignmentoperator=_AssignmentOperator() { it.set_assignmentoperator(_assignmentoperator); } _expression=_Expression() { it.set_expression(_expression); } { return it; } } AssignmentOperator _AssignmentOperator() : { AssignmentOperator it = null; } { ( it=_Eq() | it=_starEq() | it=_divEq() | it=_modEq() | it=_plEq() | it=_minEq() | it=_lshiftEq() | it=_rshiftEq() | it=_rrshiftEq() | it=_andEq() | it=_xorEq() | it=_orEq() ) { return it; } } void common_AssignmentOperator(AssignmentOperator it) : { } { { } } Eq _Eq() : { Eq it = null; } { { it=new Eq(); } "=" common_AssignmentOperator(it) { return it; } } starEq _starEq() : { starEq it = null; } { { it=new starEq(); } "*=" common_AssignmentOperator(it) { return it; } } divEq _divEq() : { divEq it = null; } { { it=new divEq(); } "/=" common_AssignmentOperator(it) { return it; } } modEq _modEq() : { modEq it = null; } { { it=new modEq(); } "%=" common_AssignmentOperator(it) { return it; } } plEq _plEq() : { plEq it = null; } { { it=new plEq(); } "+=" common_AssignmentOperator(it) { return it; } } minEq _minEq() : { minEq it = null; } { { it=new minEq(); } "-=" common_AssignmentOperator(it) { return it; } } lshiftEq _lshiftEq() : { lshiftEq it = null; } { { it=new lshiftEq(); } "<<=" common_AssignmentOperator(it) { return it; } } rshiftEq _rshiftEq() : { rshiftEq it = null; } { { it=new rshiftEq(); } ">>=" common_AssignmentOperator(it) { return it; } } rrshiftEq _rrshiftEq() : { rrshiftEq it = null; } { { it=new rrshiftEq(); } ">>>=" common_AssignmentOperator(it) { return it; } } andEq _andEq() : { andEq it = null; } { { it=new andEq(); } "&=" common_AssignmentOperator(it) { return it; } } xorEq _xorEq() : { xorEq it = null; } { { it=new xorEq(); } "^=" common_AssignmentOperator(it) { return it; } } orEq _orEq() : { orEq it = null; } { { it=new orEq(); } "|=" common_AssignmentOperator(it) { return it; } } ConditionalExpression _ConditionalExpression() : { ConditionalExpression it = null; ConditionalOrExpression _conditionalorexpression; TernExp _ternexp; } { { it=new ConditionalExpression(); } _conditionalorexpression=_ConditionalOrExpression() { it.set_conditionalorexpression(_conditionalorexpression); } [ _ternexp=_TernExp() { it.set_ternexp(_ternexp); } ] common_Expression(it) { return it; } } TernExp _TernExp() : { TernExp it = null; Expression _expression; ConditionalExpression _conditionalexpression; } { { it=new TernExp(); } "?" _expression=_Expression() { it.set_expression(_expression); } ":" _conditionalexpression=_ConditionalExpression() { it.set_conditionalexpression(_conditionalexpression); } { return it; } } ConditionalOrExpression _ConditionalOrExpression() : { ConditionalOrExpression it = null; Nonempty_ConditionalOrExpression _first; } { { it=new ConditionalOrExpression(); } _first=_Nonempty_ConditionalOrExpression() { it.set_first(_first); } { return it; } } ConditionalAndExpression _ConditionalAndExpression() : { ConditionalAndExpression it = null; Nonempty_ConditionalAndExpression _first; } { { it=new ConditionalAndExpression(); } _first=_Nonempty_ConditionalAndExpression() { it.set_first(_first); } { return it; } } InclusiveOrExpression _InclusiveOrExpression() : { InclusiveOrExpression it = null; Nonempty_InclusiveOrExpression _first; } { { it=new InclusiveOrExpression(); } _first=_Nonempty_InclusiveOrExpression() { it.set_first(_first); } { return it; } } ExclusiveOrExpression _ExclusiveOrExpression() : { ExclusiveOrExpression it = null; Nonempty_ExclusiveOrExpression _first; } { { it=new ExclusiveOrExpression(); } _first=_Nonempty_ExclusiveOrExpression() { it.set_first(_first); } { return it; } } AndExpression _AndExpression() : { AndExpression it = null; Nonempty_AndExpression _first; } { { it=new AndExpression(); } _first=_Nonempty_AndExpression() { it.set_first(_first); } { return it; } } EqualityExpression _EqualityExpression() : { EqualityExpression it = null; InstanceOfExpression _instanceofexpression; RHSEqualityExpression _rhsequalityexpression; } { { it=new EqualityExpression(); } _instanceofexpression=_InstanceOfExpression() { it.set_instanceofexpression(_instanceofexpression); } _rhsequalityexpression=_RHSEqualityExpression() { it.set_rhsequalityexpression(_rhsequalityexpression); } { return it; } } RHSEqualityExpression _RHSEqualityExpression() : { RHSEqualityExpression it = null; Nonempty_RHSEqualityExpression _first; } { { it=new RHSEqualityExpression(); } [ _first=_Nonempty_RHSEqualityExpression() { it.set_first(_first); } ] { return it; } } RInstanceOfExpression _RInstanceOfExpression() : { RInstanceOfExpression it = null; EqNotEq _eqnoteq; InstanceOfExpression _instanceofexpression; } { { it=new RInstanceOfExpression(); } _eqnoteq=_EqNotEq() { it.set_eqnoteq(_eqnoteq); } _instanceofexpression=_InstanceOfExpression() { it.set_instanceofexpression(_instanceofexpression); } { return it; } } EqNotEq _EqNotEq() : { EqNotEq it = null; } { ( it=_EqEq() | it=_NotEq() ) { return it; } } void common_EqNotEq(EqNotEq it) : { } { { } } EqEq _EqEq() : { EqEq it = null; } { { it=new EqEq(); } "==" common_EqNotEq(it) { return it; } } NotEq _NotEq() : { NotEq it = null; } { { it=new NotEq(); } "!=" common_EqNotEq(it) { return it; } } InstanceOfExpression _InstanceOfExpression() : { InstanceOfExpression it = null; RelationalExpression _relationalexpression; Type _type; } { { it=new InstanceOfExpression(); } _relationalexpression=_RelationalExpression() { it.set_relationalexpression(_relationalexpression); } [ "instanceof" _type=_Type() { it.set_type(_type); } ] { return it; } } RelationalExpression _RelationalExpression() : { RelationalExpression it = null; ShiftExpression _shiftexpression; RHSRelationalExpression _rhsrelationalexpression; } { { it=new RelationalExpression(); } _shiftexpression=_ShiftExpression() { it.set_shiftexpression(_shiftexpression); } _rhsrelationalexpression=_RHSRelationalExpression() { it.set_rhsrelationalexpression(_rhsrelationalexpression); } { return it; } } CompExp _CompExp() : { CompExp it = null; } { ( it=_Le() | it=_Ge() | it=_LeEq() | it=_GeEq() ) { return it; } } void common_CompExp(CompExp it) : { } { { } } Le _Le() : { Le it = null; } { { it=new Le(); } "<" common_CompExp(it) { return it; } } Ge _Ge() : { Ge it = null; } { { it=new Ge(); } ">" common_CompExp(it) { return it; } } LeEq _LeEq() : { LeEq it = null; } { { it=new LeEq(); } "<=" common_CompExp(it) { return it; } } GeEq _GeEq() : { GeEq it = null; } { { it=new GeEq(); } ">=" common_CompExp(it) { return it; } } RHSRelationalExpression _RHSRelationalExpression() : { RHSRelationalExpression it = null; Nonempty_RHSRelationalExpression _first; } { { it=new RHSRelationalExpression(); } [ _first=_Nonempty_RHSRelationalExpression() { it.set_first(_first); } ] { return it; } } RShiftExpression _RShiftExpression() : { RShiftExpression it = null; CompExp _compexp; ShiftExpression _shiftexpression; } { { it=new RShiftExpression(); } _compexp=_CompExp() { it.set_compexp(_compexp); } _shiftexpression=_ShiftExpression() { it.set_shiftexpression(_shiftexpression); } { return it; } } ShiftExpression _ShiftExpression() : { ShiftExpression it = null; AdditiveExpression _additiveexpression; RHSShiftExpression _rhsshiftexpression; } { { it=new ShiftExpression(); } _additiveexpression=_AdditiveExpression() { it.set_additiveexpression(_additiveexpression); } _rhsshiftexpression=_RHSShiftExpression() { it.set_rhsshiftexpression(_rhsshiftexpression); } { return it; } } RHSShiftExpression _RHSShiftExpression() : { RHSShiftExpression it = null; Nonempty_RHSShiftExpression _first; } { { it=new RHSShiftExpression(); } [ _first=_Nonempty_RHSShiftExpression() { it.set_first(_first); } ] { return it; } } RAdditiveExpression _RAdditiveExpression() : { RAdditiveExpression it = null; ShiftExp _shiftexp; AdditiveExpression _additiveexpression; } { { it=new RAdditiveExpression(); } _shiftexp=_ShiftExp() { it.set_shiftexp(_shiftexp); } _additiveexpression=_AdditiveExpression() { it.set_additiveexpression(_additiveexpression); } { return it; } } ShiftExp _ShiftExp() : { ShiftExp it = null; } { ( it=_SEright() | it=_SEleft() | it=_SEunright() ) { return it; } } void common_ShiftExp(ShiftExp it) : { } { { } } SEright _SEright() : { SEright it = null; } { { it=new SEright(); } "<<" common_ShiftExp(it) { return it; } } SEleft _SEleft() : { SEleft it = null; } { { it=new SEleft(); } ">>" common_ShiftExp(it) { return it; } } SEunright _SEunright() : { SEunright it = null; } { { it=new SEunright(); } ">>>" common_ShiftExp(it) { return it; } } AdditiveExpression _AdditiveExpression() : { AdditiveExpression it = null; MultiplicativeExpression _multiplicativeexpression; RHSAdditiveExpression _rhsadditiveexpression; } { { it=new AdditiveExpression(); } _multiplicativeexpression=_MultiplicativeExpression() { it.set_multiplicativeexpression(_multiplicativeexpression); } _rhsadditiveexpression=_RHSAdditiveExpression() { it.set_rhsadditiveexpression(_rhsadditiveexpression); } { return it; } } RHSAdditiveExpression _RHSAdditiveExpression() : { RHSAdditiveExpression it = null; Nonempty_RHSAdditiveExpression _first; } { { it=new RHSAdditiveExpression(); } [ _first=_Nonempty_RHSAdditiveExpression() { it.set_first(_first); } ] { return it; } } RMultiplicativeExpression _RMultiplicativeExpression() : { RMultiplicativeExpression it = null; AddExp _addexp; MultiplicativeExpression _multiplicativeexpression; } { { it=new RMultiplicativeExpression(); } _addexp=_AddExp() { it.set_addexp(_addexp); } _multiplicativeexpression=_MultiplicativeExpression() { it.set_multiplicativeexpression(_multiplicativeexpression); } { return it; } } AddExp _AddExp() : { AddExp it = null; } { ( it=_Plus() | it=_Minus() ) { return it; } } void common_AddExp(AddExp it) : { } { { } } Plus _Plus() : { Plus it = null; } { { it=new Plus(); } "+" common_AddExp(it) { return it; } } Minus _Minus() : { Minus it = null; } { { it=new Minus(); } "-" common_AddExp(it) { return it; } } MultiplicativeExpression _MultiplicativeExpression() : { MultiplicativeExpression it = null; UnaryExpression _unaryexpression; RHSMultiplicativeExpression _rhsmultiplicativeexpression; } { { it=new MultiplicativeExpression(); } _unaryexpression=_UnaryExpression() { it.set_unaryexpression(_unaryexpression); } _rhsmultiplicativeexpression=_RHSMultiplicativeExpression() { it.set_rhsmultiplicativeexpression(_rhsmultiplicativeexpression); } { return it; } } RHSMultiplicativeExpression _RHSMultiplicativeExpression() : { RHSMultiplicativeExpression it = null; Nonempty_RHSMultiplicativeExpression _first; } { { it=new RHSMultiplicativeExpression(); } [ _first=_Nonempty_RHSMultiplicativeExpression() { it.set_first(_first); } ] { return it; } } RUnaryExpression _RUnaryExpression() : { RUnaryExpression it = null; MulExp _mulexp; UnaryExpression _unaryexpression; } { { it=new RUnaryExpression(); } _mulexp=_MulExp() { it.set_mulexp(_mulexp); } _unaryexpression=_UnaryExpression() { it.set_unaryexpression(_unaryexpression); } { return it; } } MulExp _MulExp() : { MulExp it = null; } { ( it=_Mul() | it=_Div() | it=_Mod() ) { return it; } } void common_MulExp(MulExp it) : { } { { } } Mul _Mul() : { Mul it = null; } { { it=new Mul(); } "*" common_MulExp(it) { return it; } } Div _Div() : { Div it = null; } { { it=new Div(); } "/" common_MulExp(it) { return it; } } Mod _Mod() : { Mod it = null; } { { it=new Mod(); } "%" common_MulExp(it) { return it; } } UnaryExpression _UnaryExpression() : { UnaryExpression it = null; } { ( it=_PlusMinusUnaryExpression() | it=_U_PreIncrementExpression() | it=_U_PreDecrementExpression() | it=_UnaryExpressionNotPlusMinus() ) { return it; } } void common_UnaryExpression(UnaryExpression it) : { } { { } } U_PreIncrementExpression _U_PreIncrementExpression() : { U_PreIncrementExpression it = null; PreIncrementExpression _preincrementexpression; } { { it=new U_PreIncrementExpression(); } _preincrementexpression=_PreIncrementExpression() { it.set_preincrementexpression(_preincrementexpression); } common_UnaryExpression(it) { return it; } } U_PreDecrementExpression _U_PreDecrementExpression() : { U_PreDecrementExpression it = null; PreDecrementExpression _predecrementexpression; } { { it=new U_PreDecrementExpression(); } _predecrementexpression=_PreDecrementExpression() { it.set_predecrementexpression(_predecrementexpression); } common_UnaryExpression(it) { return it; } } PlusMinusUnaryExpression _PlusMinusUnaryExpression() : { PlusMinusUnaryExpression it = null; AddExp _addexp; UnaryExpression _unaryexpression; } { { it=new PlusMinusUnaryExpression(); } _addexp=_AddExp() { it.set_addexp(_addexp); } _unaryexpression=_UnaryExpression() { it.set_unaryexpression(_unaryexpression); } common_UnaryExpression(it) { return it; } } PreIncrementExpression _PreIncrementExpression() : { PreIncrementExpression it = null; PrimaryExpression _primaryexpression; } { { it=new PreIncrementExpression(); } "++" _primaryexpression=_PrimaryExpression() { it.set_primaryexpression(_primaryexpression); } { return it; } } PreDecrementExpression _PreDecrementExpression() : { PreDecrementExpression it = null; PrimaryExpression _primaryexpression; } { { it=new PreDecrementExpression(); } "--" _primaryexpression=_PrimaryExpression() { it.set_primaryexpression(_primaryexpression); } { return it; } } UnaryExpressionNotPlusMinus _UnaryExpressionNotPlusMinus() : { UnaryExpressionNotPlusMinus it = null; } { ( it=_NUnaryExpression() | LOOKAHEAD ( "(" (_PrimitiveType() | _Name()) ("[""]")* ")")it=_CastExpression() | it=_UN_PostfixExpression() ) { return it; } } void common_UnaryExpressionNotPlusMinus(UnaryExpressionNotPlusMinus it) : { } { common_UnaryExpression(it) { } } UN_PostfixExpression _UN_PostfixExpression() : { UN_PostfixExpression it = null; PostfixExpression _postfixexpression; } { { it=new UN_PostfixExpression(); } _postfixexpression=_PostfixExpression() { it.set_postfixexpression(_postfixexpression); } common_UnaryExpressionNotPlusMinus(it) { return it; } } NUnaryExpression _NUnaryExpression() : { NUnaryExpression it = null; NotPlusMinus _notplusminus; UnaryExpression _unaryexpression; } { { it=new NUnaryExpression(); } _notplusminus=_NotPlusMinus() { it.set_notplusminus(_notplusminus); } _unaryexpression=_UnaryExpression() { it.set_unaryexpression(_unaryexpression); } common_UnaryExpressionNotPlusMinus(it) { return it; } } NotPlusMinus _NotPlusMinus() : { NotPlusMinus it = null; } { ( it=_Not() | it=_Tilde() ) { return it; } } void common_NotPlusMinus(NotPlusMinus it) : { } { { } } Not _Not() : { Not it = null; } { { it=new Not(); } "!" common_NotPlusMinus(it) { return it; } } Tilde _Tilde() : { Tilde it = null; } { { it=new Tilde(); } "~" common_NotPlusMinus(it) { return it; } } PostfixExpression _PostfixExpression() : { PostfixExpression it = null; PrimaryExpression _primaryexpression; PAddExp _paddexp; } { { it=new PostfixExpression(); } _primaryexpression=_PrimaryExpression() { it.set_primaryexpression(_primaryexpression); } [ _paddexp=_PAddExp() { it.set_paddexp(_paddexp); } ] { return it; } } PAddExp _PAddExp() : { PAddExp it = null; } { ( it=_PPlus() | it=_PMinus() ) { return it; } } void common_PAddExp(PAddExp it) : { } { { } } PPlus _PPlus() : { PPlus it = null; } { { it=new PPlus(); } "++" common_PAddExp(it) { return it; } } PMinus _PMinus() : { PMinus it = null; } { { it=new PMinus(); } "--" common_PAddExp(it) { return it; } } CastExpression _CastExpression() : { CastExpression it = null; } { ( LOOKAHEAD ("(" _PrimitiveType())it=_CastExpSimple() | LOOKAHEAD ("(" _Name())it=_CastExpCmplx() ) { return it; } } void common_CastExpression(CastExpression it) : { } { common_UnaryExpressionNotPlusMinus(it) { } } CastExpSimple _CastExpSimple() : { CastExpSimple it = null; Type _type; UnaryExpression _unaryexpression; } { { it=new CastExpSimple(); } "(" _type=_Type() { it.set_type(_type); } ")" _unaryexpression=_UnaryExpression() { it.set_unaryexpression(_unaryexpression); } common_CastExpression(it) { return it; } } CastExpCmplx _CastExpCmplx() : { CastExpCmplx it = null; Type _type; UnaryExpressionNotPlusMinus _unaryexpressionnotplusminus; } { { it=new CastExpCmplx(); } "(" _type=_Type() { it.set_type(_type); } ")" _unaryexpressionnotplusminus=_UnaryExpressionNotPlusMinus() { it.set_unaryexpressionnotplusminus(_unaryexpressionnotplusminus); } common_CastExpression(it) { return it; } } PrimaryExpression _PrimaryExpression() : { PrimaryExpression it = null; PrimaryPrefix _primaryprefix; PrimarySuffixes _primarysuffixes; } { { it=new PrimaryExpression(); } _primaryprefix=_PrimaryPrefix() { it.set_primaryprefix(_primaryprefix); } _primarysuffixes=_PrimarySuffixes() { it.set_primarysuffixes(_primarysuffixes); } { return it; } } PrimarySuffixes _PrimarySuffixes() : { PrimarySuffixes it = null; Nonempty_PrimarySuffixes _first; } { { it=new PrimarySuffixes(); } [ LOOKAHEAD (2) _first=_Nonempty_PrimarySuffixes() { it.set_first(_first); } ] { return it; } } PrimaryPrefix _PrimaryPrefix() : { PrimaryPrefix it = null; } { ( it=_Literal() | it=_PName() | it=_This() | it=_SuperPP() | it=_ParenExp() | it=_AllocationExpression() ) { return it; } } void common_PrimaryPrefix(PrimaryPrefix it) : { } { { } } PName _PName() : { PName it = null; Name _name; } { { it=new PName(); } _name=_Name() { it.set_name(_name); } common_PrimaryPrefix(it) { return it; } } This _This() : { This it = null; } { { it=new This(); } "this" common_PrimaryPrefix(it) { return it; } } SuperPP _SuperPP() : { SuperPP it = null; Identifier _identifier; } { { it=new SuperPP(); } "super" "." _identifier=_Identifier() { it.set_identifier(_identifier); } common_PrimaryPrefix(it) { return it; } } ParenExp _ParenExp() : { ParenExp it = null; Expression _expression; } { { it=new ParenExp(); } "(" _expression=_Expression() { it.set_expression(_expression); } ")" common_PrimaryPrefix(it) { return it; } } PrimarySuffix _PrimarySuffix() : { PrimarySuffix it = null; } { ( LOOKAHEAD (2)it=_dotThis() | LOOKAHEAD (2)it=_dotClass() | LOOKAHEAD (2)it=_dotAlloc() | it=_dotParam() | it=_dotIdent() | it=_Arguments() ) { return it; } } void common_PrimarySuffix(PrimarySuffix it) : { } { { } } dotThis _dotThis() : { dotThis it = null; } { { it=new dotThis(); } "." "this" common_PrimarySuffix(it) { return it; } } dotClass _dotClass() : { dotClass it = null; } { { it=new dotClass(); } "." "class" common_PrimarySuffix(it) { return it; } } dotAlloc _dotAlloc() : { dotAlloc it = null; AllocationExpression _allocationexpression; } { { it=new dotAlloc(); } "." _allocationexpression=_AllocationExpression() { it.set_allocationexpression(_allocationexpression); } common_PrimarySuffix(it) { return it; } } dotParam _dotParam() : { dotParam it = null; Expression _expression; } { { it=new dotParam(); } "[" _expression=_Expression() { it.set_expression(_expression); } "]" common_PrimarySuffix(it) { return it; } } dotIdent _dotIdent() : { dotIdent it = null; Identifier _identifier; } { { it=new dotIdent(); } "." _identifier=_Identifier() { it.set_identifier(_identifier); } common_PrimarySuffix(it) { return it; } } Literal _Literal() : { Literal it = null; } { ( LOOKAHEAD (2)it=_Integer_literal() | it=_Floating_point_literal() | it=_Character_literal() | LOOKAHEAD (1)it=_NullLiteral() | it=_BooleanLiteral() | it=_String_literal() ) { return it; } } void common_Literal(Literal it) : { } { common_PrimaryPrefix(it) { } } Integer_literal _Integer_literal() : { Integer_literal it = null; Integer _integer; } { { it=new Integer_literal(); } _integer=_Integer() { it.set_integer(_integer); } common_Literal(it) { return it; } } Floating_point_literal _Floating_point_literal() : { Floating_point_literal it = null; Float _f; } { { it=new Floating_point_literal(); } _f=_Float() { it.set_f(_f); } common_Literal(it) { return it; } } Character_literal _Character_literal() : { Character_literal it = null; Character _character; } { { it=new Character_literal(); } _character=_Character() { it.set_character(_character); } common_Literal(it) { return it; } } String_literal _String_literal() : { String_literal it = null; String _string; } { { it=new String_literal(); } _string=_String() { it.set_string(_string); } common_Literal(it) { return it; } } BooleanLiteral _BooleanLiteral() : { BooleanLiteral it = null; Boolean _b; } { { it=new BooleanLiteral(); } _b=_Boolean() { it.set_b(_b); } common_Literal(it) { return it; } } NullLiteral _NullLiteral() : { NullLiteral it = null; } { { it=new NullLiteral(); } "null" common_Literal(it) { return it; } } Arguments _Arguments() : { Arguments it = null; ArgumentList _argumentlist; } { { it=new Arguments(); } "(" [ _argumentlist=_ArgumentList() { it.set_argumentlist(_argumentlist); } ] ")" common_PrimarySuffix(it) { return it; } } ArgumentList _ArgumentList() : { ArgumentList it = null; Nonempty_ArgumentList _first; } { { it=new ArgumentList(); } _first=_Nonempty_ArgumentList() { it.set_first(_first); } { return it; } } AllocationExpression _AllocationExpression() : { AllocationExpression it = null; } { ( LOOKAHEAD (2)it=_newCmplx() | it=_newSimple() ) { return it; } } void common_AllocationExpression(AllocationExpression it) : { } { common_PrimaryPrefix(it) { } } newCmplx _newCmplx() : { newCmplx it = null; PrimitiveType _primitivetype; ArrayDimensions _arraydimensions; ArrayInitializer _arrayinitializer; } { { it=new newCmplx(); } "new" _primitivetype=_PrimitiveType() { it.set_primitivetype(_primitivetype); } _arraydimensions=_ArrayDimensions() { it.set_arraydimensions(_arraydimensions); } [ _arrayinitializer=_ArrayInitializer() { it.set_arrayinitializer(_arrayinitializer); } ] common_AllocationExpression(it) { return it; } } newSimple _newSimple() : { newSimple it = null; Name _name; ArrAlloc _arralloc; } { { it=new newSimple(); } "new" _name=_Name() { it.set_name(_name); } _arralloc=_ArrAlloc() { it.set_arralloc(_arralloc); } common_AllocationExpression(it) { return it; } } ArrAlloc _ArrAlloc() : { ArrAlloc it = null; } { ( it=_ArrAllocIni() | it=_ArrAllocClas() ) { return it; } } void common_ArrAlloc(ArrAlloc it) : { } { { } } ArrAllocIni _ArrAllocIni() : { ArrAllocIni it = null; ArrayDimensions _arraydimensions; ArrayInitializer _arrayinitializer; } { { it=new ArrAllocIni(); } _arraydimensions=_ArrayDimensions() { it.set_arraydimensions(_arraydimensions); } [ _arrayinitializer=_ArrayInitializer() { it.set_arrayinitializer(_arrayinitializer); } ] common_ArrAlloc(it) { return it; } } ArrAllocClas _ArrAllocClas() : { ArrAllocClas it = null; Arguments _arguments; ClassBody _classbody; } { { it=new ArrAllocClas(); } _arguments=_Arguments() { it.set_arguments(_arguments); } [ _classbody=_ClassBody() { it.set_classbody(_classbody); } ] common_ArrAlloc(it) { return it; } } ArrayDimensions _ArrayDimensions() : { ArrayDimensions it = null; ArrayDimension _arraydimension; SquareBrackets _squarebrackets; } { { it=new ArrayDimensions(); } _arraydimension=_ArrayDimension() { it.set_arraydimension(_arraydimension); } _squarebrackets=_SquareBrackets() { it.set_squarebrackets(_squarebrackets); } { return it; } } ArrayDimension _ArrayDimension() : { ArrayDimension it = null; Nonempty_ArrayDimension _first; } { { it=new ArrayDimension(); } _first=_Nonempty_ArrayDimension() { it.set_first(_first); } { return it; } } DimExp _DimExp() : { DimExp it = null; Expression _expression; } { { it=new DimExp(); } "[" _expression=_Expression() { it.set_expression(_expression); } "]" { return it; } } Statement _Statement() : { Statement it = null; } { ( LOOKAHEAD (2)it=_LabeledStatement() | it=_SBlock() | it=_EmptyStatement() | it=_StatementExpressionSe() | it=_SwitchStatement() | it=_IfStatement() | it=_WhileStatement() | it=_DoStatement() | it=_ForStatement() | it=_BreakStatement() | it=_ContinueStatement() | it=_ReturnStatement() | it=_ThrowStatement() | it=_SynchronizedStatement() | it=_TryStatement() ) { return it; } } void common_Statement(Statement it) : { } { { } } StatementExpressionSe _StatementExpressionSe() : { StatementExpressionSe it = null; StatementExpression _statementexpression; } { { it=new StatementExpressionSe(); } _statementexpression=_StatementExpression() { it.set_statementexpression(_statementexpression); } ";" common_Statement(it) { return it; } } LabeledStatement _LabeledStatement() : { LabeledStatement it = null; Identifier _identifier; Statement _statement; } { { it=new LabeledStatement(); } _identifier=_Identifier() { it.set_identifier(_identifier); } ":" _statement=_Statement() { it.set_statement(_statement); } common_Statement(it) { return it; } } SBlock _SBlock() : { SBlock it = null; Block _block; } { { it=new SBlock(); } _block=_Block() { it.set_block(_block); } common_Statement(it) { return it; } } Block _Block() : { Block it = null; BlockStatements _blockstatements; } { { it=new Block(); } "{" _blockstatements=_BlockStatements() { it.set_blockstatements(_blockstatements); } "}" { return it; } } BlockStatement _BlockStatement() : { BlockStatement it = null; } { ( LOOKAHEAD ([ "final" ] _Type() _Identifier())it=_LocVarDecl() | it=_BStatement() | it=_UnmodifiedClassDeclaration() ) { return it; } } void common_BlockStatement(BlockStatement it) : { } { { } } BStatement _BStatement() : { BStatement it = null; Statement _statement; } { { it=new BStatement(); } _statement=_Statement() { it.set_statement(_statement); } common_BlockStatement(it) { return it; } } LocVarDecl _LocVarDecl() : { LocVarDecl it = null; LocalVariableDeclaration _localvariabledeclaration; } { { it=new LocVarDecl(); } _localvariabledeclaration=_LocalVariableDeclaration() { it.set_localvariabledeclaration(_localvariabledeclaration); } ";" common_BlockStatement(it) { return it; } } LocalVariableDeclaration _LocalVariableDeclaration() : { LocalVariableDeclaration it = null; CFinal _cfinal; Type _type; VariableDeclarators _variabledeclarators; } { { it=new LocalVariableDeclaration(); } [ _cfinal=_CFinal() { it.set_cfinal(_cfinal); } ] _type=_Type() { it.set_type(_type); } _variabledeclarators=_VariableDeclarators() { it.set_variabledeclarators(_variabledeclarators); } common_ForInit(it) { return it; } } EmptyStatement _EmptyStatement() : { EmptyStatement it = null; SemiColon _semicolon; } { { it=new EmptyStatement(); } _semicolon=_SemiColon() { it.set_semicolon(_semicolon); } common_Statement(it) { return it; } } StatementExpression _StatementExpression() : { StatementExpression it = null; } { ( it=_SE_PreIncrementExpression() | it=_SE_PreDecrementExpression() | LOOKAHEAD (_PrimaryExpression() _AssignmentOperator())it=_SE_Assignment() | it=_SE_PostfixExpression() ) { return it; } } void common_StatementExpression(StatementExpression it) : { } { { } } SE_PreIncrementExpression _SE_PreIncrementExpression() : { SE_PreIncrementExpression it = null; PreIncrementExpression _preincrementexpression; } { { it=new SE_PreIncrementExpression(); } _preincrementexpression=_PreIncrementExpression() { it.set_preincrementexpression(_preincrementexpression); } common_StatementExpression(it) { return it; } } SE_PreDecrementExpression _SE_PreDecrementExpression() : { SE_PreDecrementExpression it = null; PreDecrementExpression _predecrementexpression; } { { it=new SE_PreDecrementExpression(); } _predecrementexpression=_PreDecrementExpression() { it.set_predecrementexpression(_predecrementexpression); } common_StatementExpression(it) { return it; } } SE_Assignment _SE_Assignment() : { SE_Assignment it = null; Assignment _assignment; } { { it=new SE_Assignment(); } _assignment=_Assignment() { it.set_assignment(_assignment); } common_StatementExpression(it) { return it; } } SE_PostfixExpression _SE_PostfixExpression() : { SE_PostfixExpression it = null; PostfixExpression _postfixexpression; } { { it=new SE_PostfixExpression(); } _postfixexpression=_PostfixExpression() { it.set_postfixexpression(_postfixexpression); } common_StatementExpression(it) { return it; } } SwitchStatement _SwitchStatement() : { SwitchStatement it = null; Expression _expression; CaseBlocks _caseblocks; } { { it=new SwitchStatement(); } "switch" "(" _expression=_Expression() { it.set_expression(_expression); } ")" "{" _caseblocks=_CaseBlocks() { it.set_caseblocks(_caseblocks); } "}" common_Statement(it) { return it; } } CaseBlocks _CaseBlocks() : { CaseBlocks it = null; Nonempty_CaseBlocks _first; } { { it=new CaseBlocks(); } [ _first=_Nonempty_CaseBlocks() { it.set_first(_first); } ] { return it; } } CaseBlock _CaseBlock() : { CaseBlock it = null; SwitchLabel _switchlabel; BlockStatements _blockstatements; } { { it=new CaseBlock(); } _switchlabel=_SwitchLabel() { it.set_switchlabel(_switchlabel); } _blockstatements=_BlockStatements() { it.set_blockstatements(_blockstatements); } { return it; } } SwitchLabel _SwitchLabel() : { SwitchLabel it = null; } { ( it=_CaseExp() | it=_DefExp() ) { return it; } } void common_SwitchLabel(SwitchLabel it) : { } { { } } CaseExp _CaseExp() : { CaseExp it = null; Expression _expression; } { { it=new CaseExp(); } "case" _expression=_Expression() { it.set_expression(_expression); } ":" common_SwitchLabel(it) { return it; } } DefExp _DefExp() : { DefExp it = null; } { { it=new DefExp(); } "default" ":" common_SwitchLabel(it) { return it; } } IfStatement _IfStatement() : { IfStatement it = null; Expression _expression; Statement _statement; Statement _elseStmt; } { { it=new IfStatement(); } "if" "(" _expression=_Expression() { it.set_expression(_expression); } ")" _statement=_Statement() { it.set_statement(_statement); } [ LOOKAHEAD (1) "else" _elseStmt=_Statement() { it.set_elseStmt(_elseStmt); } ] common_Statement(it) { return it; } } WhileStatement _WhileStatement() : { WhileStatement it = null; Expression _expression; Statement _statement; } { { it=new WhileStatement(); } "while" "(" _expression=_Expression() { it.set_expression(_expression); } ")" _statement=_Statement() { it.set_statement(_statement); } common_Statement(it) { return it; } } DoStatement _DoStatement() : { DoStatement it = null; Statement _statement; Expression _expression; } { { it=new DoStatement(); } "do" _statement=_Statement() { it.set_statement(_statement); } "while" "(" _expression=_Expression() { it.set_expression(_expression); } ")" ";" common_Statement(it) { return it; } } ForStatement _ForStatement() : { ForStatement it = null; ForInitOpt _forinitopt; ForEvalExp _forevalexp; ForUpdate _forupdate; Statement _statement; } { { it=new ForStatement(); } "for" "(" _forinitopt=_ForInitOpt() { it.set_forinitopt(_forinitopt); } _forevalexp=_ForEvalExp() { it.set_forevalexp(_forevalexp); } [ _forupdate=_ForUpdate() { it.set_forupdate(_forupdate); } ] ")" _statement=_Statement() { it.set_statement(_statement); } common_Statement(it) { return it; } } ForInitOpt _ForInitOpt() : { ForInitOpt it = null; ForInit _forinit; } { { it=new ForInitOpt(); } [ _forinit=_ForInit() { it.set_forinit(_forinit); } ] ";" { return it; } } ForEvalExp _ForEvalExp() : { ForEvalExp it = null; Expression _expression; } { { it=new ForEvalExp(); } [ _expression=_Expression() { it.set_expression(_expression); } ] ";" { return it; } } ForInit _ForInit() : { ForInit it = null; } { ( LOOKAHEAD ( [ "final" ] _Type() _Identifier() )it=_LocalVariableDeclaration() | it=_StatementExpressionList() ) { return it; } } void common_ForInit(ForInit it) : { } { { } } StatementExpressionList _StatementExpressionList() : { StatementExpressionList it = null; Nonempty_StatementExpressionList _first; } { { it=new StatementExpressionList(); } _first=_Nonempty_StatementExpressionList() { it.set_first(_first); } common_ForInit(it) { return it; } } ForUpdate _ForUpdate() : { ForUpdate it = null; StatementExpressionList _statementexpressionlist; } { { it=new ForUpdate(); } _statementexpressionlist=_StatementExpressionList() { it.set_statementexpressionlist(_statementexpressionlist); } { return it; } } BreakStatement _BreakStatement() : { BreakStatement it = null; Identifier _identifier; } { { it=new BreakStatement(); } "break" [ _identifier=_Identifier() { it.set_identifier(_identifier); } ] ";" common_Statement(it) { return it; } } ContinueStatement _ContinueStatement() : { ContinueStatement it = null; Identifier _identifier; } { { it=new ContinueStatement(); } "continue" [ _identifier=_Identifier() { it.set_identifier(_identifier); } ] ";" common_Statement(it) { return it; } } ReturnStatement _ReturnStatement() : { ReturnStatement it = null; Expression _expression; } { { it=new ReturnStatement(); } "return" [ _expression=_Expression() { it.set_expression(_expression); } ] ";" common_Statement(it) { return it; } } ThrowStatement _ThrowStatement() : { ThrowStatement it = null; Expression _expression; } { { it=new ThrowStatement(); } "throw" _expression=_Expression() { it.set_expression(_expression); } ";" common_Statement(it) { return it; } } SynchronizedStatement _SynchronizedStatement() : { SynchronizedStatement it = null; Expression _expression; Block _block; } { { it=new SynchronizedStatement(); } "synchronized" "(" _expression=_Expression() { it.set_expression(_expression); } ")" _block=_Block() { it.set_block(_block); } common_Statement(it) { return it; } } TryStatement _TryStatement() : { TryStatement it = null; Block _block; CatchBlocks _catchblocks; Block _finalblock; } { { it=new TryStatement(); } "try" _block=_Block() { it.set_block(_block); } _catchblocks=_CatchBlocks() { it.set_catchblocks(_catchblocks); } [ "finally" _finalblock=_Block() { it.set_finalblock(_finalblock); } ] common_Statement(it) { return it; } } CatchBlocks _CatchBlocks() : { CatchBlocks it = null; Nonempty_CatchBlocks _first; } { { it=new CatchBlocks(); } [ _first=_Nonempty_CatchBlocks() { it.set_first(_first); } ] { return it; } } CatchBlock _CatchBlock() : { CatchBlock it = null; FormalParameter _formalparameter; Block _block; } { { it=new CatchBlock(); } "catch" "(" _formalparameter=_FormalParameter() { it.set_formalparameter(_formalparameter); } ")" _block=_Block() { it.set_block(_block); } { return it; } } ClassVisitor _ClassVisitor() : { ClassVisitor it = null; } { { it=new ClassVisitor(); } { return it; } } MethodVisitor _MethodVisitor() : { MethodVisitor it = null; } { { it=new MethodVisitor(); } { return it; } } Main _Main() : { Main it = null; } { { it=new Main(); } { return it; } } Nonempty_ImportDeclarations _Nonempty_ImportDeclarations() : { Nonempty_ImportDeclarations it = null; ImportDeclaration _it; Nonempty_ImportDeclarations _next; } { { it=new Nonempty_ImportDeclarations(); } _it=_ImportDeclaration() { it.set_it(_it); } [ _next=_Nonempty_ImportDeclarations() { it.set_next(_next); } ] { return it; } } Nonempty_TypeDeclarations _Nonempty_TypeDeclarations() : { Nonempty_TypeDeclarations it = null; TypeDeclaration _it; Nonempty_TypeDeclarations _next; } { { it=new Nonempty_TypeDeclarations(); } _it=_TypeDeclaration() { it.set_it(_it); } [ _next=_Nonempty_TypeDeclarations() { it.set_next(_next); } ] { return it; } } Nonempty_ClassModifiers _Nonempty_ClassModifiers() : { Nonempty_ClassModifiers it = null; ClassModifier _it; Nonempty_ClassModifiers _next; } { { it=new Nonempty_ClassModifiers(); } _it=_ClassModifier() { it.set_it(_it); } [ _next=_Nonempty_ClassModifiers() { it.set_next(_next); } ] { return it; } } Nonempty_ClassBodyDeclarations _Nonempty_ClassBodyDeclarations() : { Nonempty_ClassBodyDeclarations it = null; ClassBodyDeclaration _it; Nonempty_ClassBodyDeclarations _next; } { { it=new Nonempty_ClassBodyDeclarations(); } _it=_ClassBodyDeclaration() { it.set_it(_it); } [ _next=_Nonempty_ClassBodyDeclarations() { it.set_next(_next); } ] { return it; } } Nonempty_NestedClassModifiers _Nonempty_NestedClassModifiers() : { Nonempty_NestedClassModifiers it = null; NestedClassModifier _it; Nonempty_NestedClassModifiers _next; } { { it=new Nonempty_NestedClassModifiers(); } _it=_NestedClassModifier() { it.set_it(_it); } [ _next=_Nonempty_NestedClassModifiers() { it.set_next(_next); } ] { return it; } } Nonempty_InterfaceModifiers _Nonempty_InterfaceModifiers() : { Nonempty_InterfaceModifiers it = null; InterfaceModifier _it; Nonempty_InterfaceModifiers _next; } { { it=new Nonempty_InterfaceModifiers(); } _it=_InterfaceModifier() { it.set_it(_it); } [ _next=_Nonempty_InterfaceModifiers() { it.set_next(_next); } ] { return it; } } Nonempty_NestedInterfaceModifiers _Nonempty_NestedInterfaceModifiers() : { Nonempty_NestedInterfaceModifiers it = null; NestedInterfaceModifier _it; Nonempty_NestedInterfaceModifiers _next; } { { it=new Nonempty_NestedInterfaceModifiers(); } _it=_NestedInterfaceModifier() { it.set_it(_it); } [ _next=_Nonempty_NestedInterfaceModifiers() { it.set_next(_next); } ] { return it; } } Nonempty_InterfaceMemberDeclarations _Nonempty_InterfaceMemberDeclarations() : { Nonempty_InterfaceMemberDeclarations it = null; InterfaceMemberDeclaration _it; Nonempty_InterfaceMemberDeclarations _next; } { { it=new Nonempty_InterfaceMemberDeclarations(); } _it=_InterfaceMemberDeclaration() { it.set_it(_it); } [ _next=_Nonempty_InterfaceMemberDeclarations() { it.set_next(_next); } ] { return it; } } Nonempty_FieldModifiers _Nonempty_FieldModifiers() : { Nonempty_FieldModifiers it = null; FieldModifier _it; Nonempty_FieldModifiers _next; } { { it=new Nonempty_FieldModifiers(); } _it=_FieldModifier() { it.set_it(_it); } [ _next=_Nonempty_FieldModifiers() { it.set_next(_next); } ] { return it; } } Nonempty_VariableDeclarators _Nonempty_VariableDeclarators() : { Nonempty_VariableDeclarators it = null; VariableDeclarator _it; Nonempty_VariableDeclarators _next; } { { it=new Nonempty_VariableDeclarators(); } _it=_VariableDeclarator() { it.set_it(_it); } [ "," _next=_Nonempty_VariableDeclarators() { it.set_next(_next); } ] { return it; } } Nonempty_SquareBrackets _Nonempty_SquareBrackets() : { Nonempty_SquareBrackets it = null; SquareBracket _it; Nonempty_SquareBrackets _next; } { { it=new Nonempty_SquareBrackets(); } _it=_SquareBracket() { it.set_it(_it); } [ LOOKAHEAD (2) _next=_Nonempty_SquareBrackets() { it.set_next(_next); } ] { return it; } } Nonempty_VariableInitializers _Nonempty_VariableInitializers() : { Nonempty_VariableInitializers it = null; VariableInitializer _it; Nonempty_VariableInitializers _next; } { { it=new Nonempty_VariableInitializers(); } _it=_VariableInitializer() { it.set_it(_it); } [ LOOKAHEAD (2) "," _next=_Nonempty_VariableInitializers() { it.set_next(_next); } ] { return it; } } Nonempty_MethodModifiers _Nonempty_MethodModifiers() : { Nonempty_MethodModifiers it = null; MethodModifier _it; Nonempty_MethodModifiers _next; } { { it=new Nonempty_MethodModifiers(); } _it=_MethodModifier() { it.set_it(_it); } [ _next=_Nonempty_MethodModifiers() { it.set_next(_next); } ] { return it; } } Nonempty_FormalParameterList _Nonempty_FormalParameterList() : { Nonempty_FormalParameterList it = null; FormalParameter _it; Nonempty_FormalParameterList _next; } { { it=new Nonempty_FormalParameterList(); } _it=_FormalParameter() { it.set_it(_it); } [ "," _next=_Nonempty_FormalParameterList() { it.set_next(_next); } ] { return it; } } Nonempty_BlockStatements _Nonempty_BlockStatements() : { Nonempty_BlockStatements it = null; BlockStatement _it; Nonempty_BlockStatements _next; } { { it=new Nonempty_BlockStatements(); } _it=_BlockStatement() { it.set_it(_it); } [ _next=_Nonempty_BlockStatements() { it.set_next(_next); } ] { return it; } } Nonempty_Name _Nonempty_Name() : { Nonempty_Name it = null; Identifier _it; Nonempty_Name _next; } { { it=new Nonempty_Name(); } _it=_Identifier() { it.set_it(_it); } [ LOOKAHEAD (2) "." _next=_Nonempty_Name() { it.set_next(_next); } ] { return it; } } Nonempty_NameList _Nonempty_NameList() : { Nonempty_NameList it = null; Name _it; Nonempty_NameList _next; } { { it=new Nonempty_NameList(); } _it=_Name() { it.set_it(_it); } [ "," _next=_Nonempty_NameList() { it.set_next(_next); } ] { return it; } } Nonempty_ConditionalOrExpression _Nonempty_ConditionalOrExpression() : { Nonempty_ConditionalOrExpression it = null; ConditionalAndExpression _it; Nonempty_ConditionalOrExpression _next; } { { it=new Nonempty_ConditionalOrExpression(); } _it=_ConditionalAndExpression() { it.set_it(_it); } [ "||" _next=_Nonempty_ConditionalOrExpression() { it.set_next(_next); } ] { return it; } } Nonempty_ConditionalAndExpression _Nonempty_ConditionalAndExpression() : { Nonempty_ConditionalAndExpression it = null; InclusiveOrExpression _it; Nonempty_ConditionalAndExpression _next; } { { it=new Nonempty_ConditionalAndExpression(); } _it=_InclusiveOrExpression() { it.set_it(_it); } [ "&&" _next=_Nonempty_ConditionalAndExpression() { it.set_next(_next); } ] { return it; } } Nonempty_InclusiveOrExpression _Nonempty_InclusiveOrExpression() : { Nonempty_InclusiveOrExpression it = null; ExclusiveOrExpression _it; Nonempty_InclusiveOrExpression _next; } { { it=new Nonempty_InclusiveOrExpression(); } _it=_ExclusiveOrExpression() { it.set_it(_it); } [ "|" _next=_Nonempty_InclusiveOrExpression() { it.set_next(_next); } ] { return it; } } Nonempty_ExclusiveOrExpression _Nonempty_ExclusiveOrExpression() : { Nonempty_ExclusiveOrExpression it = null; AndExpression _it; Nonempty_ExclusiveOrExpression _next; } { { it=new Nonempty_ExclusiveOrExpression(); } _it=_AndExpression() { it.set_it(_it); } [ "^" _next=_Nonempty_ExclusiveOrExpression() { it.set_next(_next); } ] { return it; } } Nonempty_AndExpression _Nonempty_AndExpression() : { Nonempty_AndExpression it = null; EqualityExpression _it; Nonempty_AndExpression _next; } { { it=new Nonempty_AndExpression(); } _it=_EqualityExpression() { it.set_it(_it); } [ "&" _next=_Nonempty_AndExpression() { it.set_next(_next); } ] { return it; } } Nonempty_RHSEqualityExpression _Nonempty_RHSEqualityExpression() : { Nonempty_RHSEqualityExpression it = null; RInstanceOfExpression _it; Nonempty_RHSEqualityExpression _next; } { { it=new Nonempty_RHSEqualityExpression(); } _it=_RInstanceOfExpression() { it.set_it(_it); } [ _next=_Nonempty_RHSEqualityExpression() { it.set_next(_next); } ] { return it; } } Nonempty_RHSRelationalExpression _Nonempty_RHSRelationalExpression() : { Nonempty_RHSRelationalExpression it = null; RShiftExpression _it; Nonempty_RHSRelationalExpression _next; } { { it=new Nonempty_RHSRelationalExpression(); } _it=_RShiftExpression() { it.set_it(_it); } [ _next=_Nonempty_RHSRelationalExpression() { it.set_next(_next); } ] { return it; } } Nonempty_RHSShiftExpression _Nonempty_RHSShiftExpression() : { Nonempty_RHSShiftExpression it = null; RAdditiveExpression _it; Nonempty_RHSShiftExpression _next; } { { it=new Nonempty_RHSShiftExpression(); } _it=_RAdditiveExpression() { it.set_it(_it); } [ _next=_Nonempty_RHSShiftExpression() { it.set_next(_next); } ] { return it; } } Nonempty_RHSAdditiveExpression _Nonempty_RHSAdditiveExpression() : { Nonempty_RHSAdditiveExpression it = null; RMultiplicativeExpression _it; Nonempty_RHSAdditiveExpression _next; } { { it=new Nonempty_RHSAdditiveExpression(); } _it=_RMultiplicativeExpression() { it.set_it(_it); } [ _next=_Nonempty_RHSAdditiveExpression() { it.set_next(_next); } ] { return it; } } Nonempty_RHSMultiplicativeExpression _Nonempty_RHSMultiplicativeExpression() : { Nonempty_RHSMultiplicativeExpression it = null; RUnaryExpression _it; Nonempty_RHSMultiplicativeExpression _next; } { { it=new Nonempty_RHSMultiplicativeExpression(); } _it=_RUnaryExpression() { it.set_it(_it); } [ _next=_Nonempty_RHSMultiplicativeExpression() { it.set_next(_next); } ] { return it; } } Nonempty_PrimarySuffixes _Nonempty_PrimarySuffixes() : { Nonempty_PrimarySuffixes it = null; PrimarySuffix _it; Nonempty_PrimarySuffixes _next; } { { it=new Nonempty_PrimarySuffixes(); } _it=_PrimarySuffix() { it.set_it(_it); } [ LOOKAHEAD (2) _next=_Nonempty_PrimarySuffixes() { it.set_next(_next); } ] { return it; } } Nonempty_ArgumentList _Nonempty_ArgumentList() : { Nonempty_ArgumentList it = null; Expression _it; Nonempty_ArgumentList _next; } { { it=new Nonempty_ArgumentList(); } _it=_Expression() { it.set_it(_it); } [ "," _next=_Nonempty_ArgumentList() { it.set_next(_next); } ] { return it; } } Nonempty_ArrayDimension _Nonempty_ArrayDimension() : { Nonempty_ArrayDimension it = null; DimExp _it; Nonempty_ArrayDimension _next; } { { it=new Nonempty_ArrayDimension(); } _it=_DimExp() { it.set_it(_it); } [ LOOKAHEAD (2) _next=_Nonempty_ArrayDimension() { it.set_next(_next); } ] { return it; } } Nonempty_CaseBlocks _Nonempty_CaseBlocks() : { Nonempty_CaseBlocks it = null; CaseBlock _it; Nonempty_CaseBlocks _next; } { { it=new Nonempty_CaseBlocks(); } _it=_CaseBlock() { it.set_it(_it); } [ _next=_Nonempty_CaseBlocks() { it.set_next(_next); } ] { return it; } } Nonempty_StatementExpressionList _Nonempty_StatementExpressionList() : { Nonempty_StatementExpressionList it = null; StatementExpression _it; Nonempty_StatementExpressionList _next; } { { it=new Nonempty_StatementExpressionList(); } _it=_StatementExpression() { it.set_it(_it); } [ "," _next=_Nonempty_StatementExpressionList() { it.set_next(_next); } ] { return it; } } Nonempty_CatchBlocks _Nonempty_CatchBlocks() : { Nonempty_CatchBlocks it = null; CatchBlock _it; Nonempty_CatchBlocks _next; } { { it=new Nonempty_CatchBlocks(); } _it=_CatchBlock() { it.set_it(_it); } [ _next=_Nonempty_CatchBlocks() { it.set_next(_next); } ] { return it; } } boolean _boolean() : { Token t; }{ ( t= { return true; } | t= { return false; } ) } char _char() : { Token t; } { t= { String s = t.image; return unescapifyChar(s.substring(1, s.length()-1)); } } byte _byte() : { int i; } { i=_int() { return (byte) i; } } short _short() : { int i; } { i=_int() { return (short) i; } } int _int() : { Number num; } { num=_Number() { return num.intValue(); } } long _long() : { Number num; } { num=_Number() { return num.longValue(); } } float _float() : { Number num; } { num=_Number() { return num.floatValue(); } } double _double() : { Number num; } { num=_Number() { return num.doubleValue(); } } Boolean _Boolean() : { Token t; }{ ( t= { return Boolean.TRUE; } | t= { return Boolean.FALSE; } ) } Character _Character() : { char c; } { c=_char() { return new Character(c); } } Integer _Integer() : { int i; } { i = _int() { return new Integer(i); } } Long _Long() : { long l; } { l=_long() { return new Long(l); } } Float _Float() : { float f; } { f=_float() { return new Float(f); } } Double _Double() : { double d; } { d=_double() { return new Double(d); } } Number _Number() : { Token t; String s = null; int radix = 0; Number num = null; } { ( ( t= { s = t.image; radix = 10; } | t= { // Strip off the "0x". s = t.image.substring(2, t.image.length()); radix = 16; } | t= { s = t.image; radix = 8; } ) { switch (s.charAt(s.length()-1)) { case 'l': case 'L': s = s.substring(0, s.length()-1); num = new Long(new java.math.BigInteger(s, radix).longValue()); break; default: num = new Integer(new java.math.BigInteger(s, radix).intValue()); break; } } | t= { s = t.image; switch (s.charAt(s.length()-1)) { case 'd': case 'D': num = Double.valueOf(s.substring(0, s.length()-1)); break; case 'f': case 'F': num = Float.valueOf(s.substring(0, s.length()-1)); break; default: num = Float.valueOf(s); break; } } ) { return num; } } String _String() : { Token t; } { t= { String s = t.image; return unescapify(s.substring(1, s.length()-1)); } } StringBuffer _StringBuffer() : { String s; } { s=_String() { return new StringBuffer(s); } } Ident _Ident() : { Token t; } { t= { return new Ident(t.image); } } Text _Text() : { Token t; } { t= { String s = t.image; return new Text(s.substring(2, s.length()-2)); } } Line _Line() : { Token t; } { { token_source.SwitchTo(1); } t= { return new Line(t.image); } } Word _Word() : { Token t; } { { token_source.SwitchTo(2); } t= { return new Word(t.image); } } // Lexical specification (largely taken from Java.jack): SKIP : { " " | "\t" | "\n" | "\r" | <"//" (~["\n","\r"])* ("\n"|"\r\n")> | <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> } TOKEN : { /* LITERALS */ < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* (["l","L"])? > | < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ (["l","L"])? > | < OCTAL_LITERAL: "0" (["0"-"7"])* (["l","L"])? > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])+ ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["\'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > | < TEXT_LITERAL: ( "(@" (~["@"])* ( "@" ~[")"] (~["@"])* )* "@)" ) | ( "{{" (~["}"])* ( "}" ~["}"] (~["}"])* )* "}}" ) > | < TRUE: "true" > | < FALSE: "false" > } TOKEN : { /* IDENTIFIERS */ < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } TOKEN : { < LINE: (~["\n","\r"])* > : DEFAULT } SKIP : { " " | "\t" | "\n" | "\r" } TOKEN : { < WORD: (~[" ","\t","\n","\r"])* > : DEFAULT }