📄 ggeneratorparser.java
字号:
consumeUntil(_tokenSet_10); } return t; } public final ASTExpression expression() throws RecognitionException, TokenStreamException { ASTExpression n; Token name = null; ASTLetExpression prevLet = null, firstLet = null; ASTType t = null; ASTExpression e1, e2; n = null; try { // for error handling MyToken tok = (MyToken) LT(1); /* remember start of expression */ { _loop126: do { if ((LA(1)==LITERAL_let)) { match(LITERAL_let); name = LT(1); match(IDENT); { switch ( LA(1)) { case COLON: { match(COLON); t=type(); break; } case EQUAL: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(EQUAL); e1=expression(); match(LITERAL_in); ASTLetExpression nextLet = new ASTLetExpression((MyToken) name, t, e1); if ( firstLet == null ) firstLet = nextLet; if ( prevLet != null ) prevLet.setInExpr(nextLet); prevLet = nextLet; } else { break _loop126; } } while (true); } n=conditionalImpliesExpression(); if ( n != null ) n.setStartToken(tok); if ( prevLet != null ) { prevLet.setInExpr(n); n = firstLet; n.setStartToken(tok); } } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_11); } return n; } public final ASTGProcedureCall procedureCallOnly() throws RecognitionException, TokenStreamException { ASTGProcedureCall call; Token name = null; call = null; ASTExpression ocl; try { // for error handling name = LT(1); match(IDENT); call = new ASTGProcedureCall((MyToken)name); match(LPAREN); { switch ( LA(1)) { case LPAREN: case IDENT: case LITERAL_let: case PLUS: case MINUS: case LITERAL_not: case LITERAL_iterate: case LITERAL_oclAsType: case LITERAL_oclIsKindOf: case LITERAL_oclIsTypeOf: case LITERAL_if: case LITERAL_true: case LITERAL_false: case INT: case REAL: case STRING: case HASH: case LITERAL_Set: case LITERAL_Sequence: case LITERAL_Bag: case LITERAL_oclEmpty: case LITERAL_oclUndefined: case LITERAL_Tuple: { ocl=expression(); call.addParameter(ocl); { _loop33: do { if ((LA(1)==COMMA)) { match(COMMA); ocl=expression(); call.addParameter(ocl); } else { break _loop33; } } while (true); } break; } case RPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(RPAREN); match(Token.EOF_TYPE); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_0); } return call; } public final ASTModel model() throws RecognitionException, TokenStreamException { ASTModel n; Token name = null; ASTEnumTypeDefinition e = null; ASTAssociation a = null; ASTConstraintDefinition cons = null; ASTPrePost ppc = null; n = null; try { // for error handling match(LITERAL_model); name = LT(1); match(IDENT); n = new ASTModel((MyToken) name); { _loop36: do { if ((LA(1)==LITERAL_enum)) { e=enumTypeDefinition(); n.addEnumTypeDef(e); } else { break _loop36; } } while (true); } { _loop43: do { switch ( LA(1)) { case LITERAL_abstract: case LITERAL_class: case LITERAL_associationClass: case LITERAL_associationclass: { { generalClassDefinition(n); } break; } case LITERAL_aggregation: case LITERAL_composition: case LITERAL_association: { { a=associationDefinition(); n.addAssociation(a); } break; } case LITERAL_constraints: { { match(LITERAL_constraints); { _loop42: do { if ((LA(1)==LITERAL_context) && (LA(2)==IDENT) && (_tokenSet_12.member(LA(3)))) { cons=invariant(); n.addConstraint(cons); } else if ((LA(1)==LITERAL_context) && (LA(2)==IDENT) && (LA(3)==COLON_COLON)) { ppc=prePost(); n.addPrePost(ppc); } else { break _loop42; } } while (true); } } break; } default: { break _loop43; } } } while (true); } match(Token.EOF_TYPE); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_0); } return n; } public final ASTEnumTypeDefinition enumTypeDefinition() throws RecognitionException, TokenStreamException { ASTEnumTypeDefinition n; Token name = null; List idList; n = null; try { // for error handling match(LITERAL_enum); name = LT(1); match(IDENT); match(LBRACE); idList=idList(); match(RBRACE); { switch ( LA(1)) { case SEMI: { match(SEMI); break; } case EOF: case LITERAL_constraints: case LITERAL_enum: case LITERAL_abstract: case LITERAL_class: case LITERAL_associationClass: case LITERAL_associationclass: case LITERAL_aggregation: case LITERAL_composition: case LITERAL_association: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } n = new ASTEnumTypeDefinition((MyToken) name, idList); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_13); } return n; } public final void generalClassDefinition( ASTModel n ) throws RecognitionException, TokenStreamException { boolean isAbstract = false; ASTClass c = null; ASTAssociationClass ac = null; try { // for error handling { switch ( LA(1)) { case LITERAL_abstract: { match(LITERAL_abstract); isAbstract = true; break; } case LITERAL_class: case LITERAL_associationClass: case LITERAL_associationclass: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_class: { { c=classDefinition(isAbstract); n.addClass(c); } break; } case LITERAL_associationClass: case LITERAL_associationclass: { { ac=associationClassDefinition(isAbstract); n.addAssociationClass(ac); } break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_14); } } public final ASTAssociation associationDefinition() throws RecognitionException, TokenStreamException { ASTAssociation n; Token name = null; ASTAssociationEnd ae; n = null; try { // for error handling MyToken t = (MyToken) LT(1); { switch ( LA(1)) { case LITERAL_association: { match(LITERAL_association); break; } case LITERAL_aggregation: { match(LITERAL_aggregation); break; } case LITERAL_composition: { match(LITERAL_composition); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } name = LT(1); match(IDENT); n = new ASTAssociation(t, (MyToken) name); match(LITERAL_between); ae=associationEnd(); n.addEnd(ae); { int _cnt90=0; _loop90: do { if ((LA(1)==IDENT)) { ae=associationEnd(); n.addEnd(ae); } else { if ( _cnt90>=1 ) { break _loop90; } else {throw new NoViableAltException(LT(1), getFilename());} } _cnt90++; } while (true); } match(LITERAL_end); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_14); } return n; } public final ASTPrePost prePost() throws RecognitionException, TokenStreamException { ASTPrePost n; Token classname = null; Token opname = null; n = null; List pl = null; ASTType rt = null; ASTPrePostClause ppc = null; try { // for error handling match(LITERAL_context); classname = LT(1); match(IDENT); match(COLON_COLON); opname = LT(1); match(IDENT); pl=paramList(); { switch ( LA(1)) { case COLON: { match(COLON); rt=type(); break; } case LITERAL_pre: case LITERAL_post: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } n = new ASTPrePost((MyToken) classname, (MyToken) opname, pl, rt); { int _cnt110=0; _loop110: do { if ((LA(1)==LITERAL_pre||LA(1)==LITERAL_post)) { ppc=prePostClause(); n.addPrePostClause(ppc); } else { if ( _cnt110>=1 ) { break _loop110; } else {throw new NoViableAltException(LT(1), getFilename());} } _cnt110++; } while (true); } } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_2); } return n; } public final List idList() throws RecognitionException, TokenStreamException { List idList; Token id0 = null; Token idn = null; idList = new ArrayList(); try { // for error handling id0 = LT(1); match(IDENT); idList.add((MyToken) id0); { _loop120: do { if ((LA(1)==COMMA)) { match(COMMA); idn = LT(1); match(IDENT); idList.add((MyToken) idn); } else { break _loop120; } } while (true); } } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_15); } return idList; } public final ASTClass classDefinition( boolean isAbstract ) throws RecognitionException, TokenStreamException { ASTClass n; Token name = null; List idList; n = null; try { // for error handling match(LITERAL_class); name = LT(1); match(IDENT); n = new ASTClass((MyToken) name, isAbstract); { switch ( LA(1)) { case LESS: { match(LESS); idList=idList(); n.addSuperClasses(idList); break; } case LITERAL_constraints: case LITERAL_attributes: case LITERAL_operations: case LITERAL_end: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_attributes: { match(LITERAL_attributes); ASTAttribute a; { _loop55: do { if ((LA(1)==IDENT)) { a=attributeDefinition(); n.addAttribute(a); } else { break _loop55; } } while (true); } break; } case LITERAL_constraints: case LITERAL_operations: case LITERAL_end: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_operations: { match(LITERAL_operations); ASTOperation op; { _loop58: do { if ((LA(1)==IDENT)) { op=operationDefinition(); n.addOperation(op); } else { break _loop58; } } while (true); } break; } case LITERAL_constraints: case LITERAL_end: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_constraints: { match(LITERAL_constraints); { _loop61: do { if ((LA(1)==LITERAL_inv)) { ASTInvariantClause inv; inv=invariantClause(); n.addInvariantClause(inv); } else { break _loop61; } } while (true); } break; } case LITERAL_end: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(LITERAL_end); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_14); } return n; } public final ASTAssociationClass associationClassDefinition( boolean isAbstract ) throws RecognitionException, TokenStreamException { ASTAssociationClass n; Token name = null; List idList; n = null; ASTAssociationEnd ae; try { // for error handling MyToken t1 = (MyToken) LT(1); { switch ( LA(1)) { case LITERAL_associationClass: { match(LITERAL_associationClass); break; } case LITERAL_associationclass: { match(LITERAL_associationclass); break; } default: { throw new NoViableAltException(LT(1), getFilename()); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -