📄 ggeneratorparser.java
字号:
} } if (t1.getText().equals("associationClass")) { reportWarning("the 'associationClass' keyword is deprecated and will " + "not be supported in the future, use 'associationclass' instead"); } name = LT(1); match(IDENT); n = new ASTAssociationClass((MyToken) name, isAbstract); { switch ( LA(1)) { case LESS: { match(LESS); idList=idList(); n.addSuperClasses(idList); break; } case LITERAL_between: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(LITERAL_between); ae=associationEnd(); n.addEnd(ae); { int _cnt66=0; _loop66: do { if ((LA(1)==IDENT)) { ae=associationEnd(); n.addEnd(ae); } else { if ( _cnt66>=1 ) { break _loop66; } else {throw new NoViableAltException(LT(1), getFilename());} } _cnt66++; } while (true); } { switch ( LA(1)) { case LITERAL_attributes: { match(LITERAL_attributes); ASTAttribute a; { _loop69: do { if ((LA(1)==IDENT)) { a=attributeDefinition(); n.addAttribute(a); } else { break _loop69; } } while (true); } break; } case LITERAL_constraints: case LITERAL_operations: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_operations: { match(LITERAL_operations); ASTOperation op; { _loop72: do { if ((LA(1)==IDENT)) { op=operationDefinition(); n.addOperation(op); } else { break _loop72; } } while (true); } break; } case LITERAL_constraints: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_constraints: { match(LITERAL_constraints); { _loop75: do { if ((LA(1)==LITERAL_inv)) { ASTInvariantClause inv; inv=invariantClause(); n.addInvariantClause(inv); } else { break _loop75; } } while (true); } break; } case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_aggregation: case LITERAL_composition: { MyToken t = (MyToken) LT(1); { switch ( LA(1)) { case LITERAL_aggregation: { match(LITERAL_aggregation); break; } case LITERAL_composition: { match(LITERAL_composition); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } n.setKind(t); 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 ASTAttribute attributeDefinition() throws RecognitionException, TokenStreamException { ASTAttribute n; Token name = null; ASTType t; n = null; try { // for error handling name = LT(1); match(IDENT); match(COLON); t=type(); { switch ( LA(1)) { case SEMI: { match(SEMI); break; } case IDENT: case LITERAL_constraints: case LITERAL_operations: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } n = new ASTAttribute((MyToken) name, t); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_16); } return n; } public final ASTOperation operationDefinition() throws RecognitionException, TokenStreamException { ASTOperation n; Token name = null; List pl; ASTType t = null; ASTExpression e = null; ASTPrePostClause ppc = null; n = null; try { // for error handling name = LT(1); match(IDENT); pl=paramList(); { switch ( LA(1)) { case COLON: { { match(COLON); t=type(); { switch ( LA(1)) { case EQUAL: { match(EQUAL); e=expression(); break; } case IDENT: case SEMI: case LITERAL_pre: case LITERAL_constraints: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: case LITERAL_post: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } break; } case IDENT: case SEMI: case LITERAL_pre: case LITERAL_constraints: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: case LITERAL_post: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } n = new ASTOperation((MyToken) name, pl, t, e); { _loop85: do { if ((LA(1)==LITERAL_pre||LA(1)==LITERAL_post)) { ppc=prePostClause(); n.addPrePostClause(ppc); } else { break _loop85; } } while (true); } { switch ( LA(1)) { case SEMI: { match(SEMI); break; } case IDENT: case LITERAL_constraints: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_17); } return n; } public final ASTInvariantClause invariantClause() throws RecognitionException, TokenStreamException { ASTInvariantClause n; Token name = null; ASTExpression e; n = null; try { // for error handling match(LITERAL_inv); { switch ( LA(1)) { case IDENT: { name = LT(1); match(IDENT); break; } case COLON: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(COLON); e=expression(); n = new ASTInvariantClause((MyToken) name, e); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_18); } return n; } public final ASTAssociationEnd associationEnd() throws RecognitionException, TokenStreamException { ASTAssociationEnd n; Token name = null; Token rn = null; ASTMultiplicity m; n = null; try { // for error handling name = LT(1); match(IDENT); match(LBRACK); m=multiplicity(); match(RBRACK); n = new ASTAssociationEnd((MyToken) name, m); { switch ( LA(1)) { case LITERAL_role: { match(LITERAL_role); rn = LT(1); match(IDENT); n.setRolename((MyToken) rn); break; } case IDENT: case SEMI: case LITERAL_constraints: case LITERAL_attributes: case LITERAL_operations: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: case LITERAL_ordered: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case LITERAL_ordered: { match(LITERAL_ordered); n.setOrdered(); break; } case IDENT: case SEMI: case LITERAL_constraints: case LITERAL_attributes: case LITERAL_operations: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case SEMI: { match(SEMI); break; } case IDENT: case LITERAL_constraints: case LITERAL_attributes: case LITERAL_operations: case LITERAL_end: case LITERAL_aggregation: case LITERAL_composition: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_19); } return n; } public final ASTType type() throws RecognitionException, TokenStreamException { ASTType n; n = null; try { // for error handling MyToken tok = (MyToken) LT(1); /* remember start of type */ { switch ( LA(1)) { case IDENT: { n=simpleType(); break; } case LITERAL_Set: case LITERAL_Sequence: case LITERAL_Bag: case LITERAL_Collection: { n=collectionType(); break; } case LITERAL_Tuple: { n=tupleType(); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } n.setStartToken(tok); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_20); } return n; } public final List paramList() throws RecognitionException, TokenStreamException { List paramList; ASTVariableDeclaration v; paramList = new ArrayList(); try { // for error handling match(LPAREN); { switch ( LA(1)) { case IDENT: { v=variableDeclaration(); paramList.add(v); { _loop117: do { if ((LA(1)==COMMA)) { match(COMMA); v=variableDeclaration(); paramList.add(v); } else { break _loop117; } } while (true); } break; } case RPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(RPAREN); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_21); } return paramList; } public final ASTPrePostClause prePostClause() throws RecognitionException, TokenStreamException { ASTPrePostClause n; Token name = null; ASTExpression e; n = null; try { // for error handling MyToken t = (MyToken) LT(1); { switch ( LA(1)) { case LITERAL_pre: { match(LITERAL_pre); break; } case LITERAL_post: { match(LITERAL_post); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1)) { case IDENT: { name = LT(1); match(IDENT); break; } case COLON: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(COLON); e=expression(); n = new ASTPrePostClause(t, (MyToken) name, e); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_22); } return n; } public final ASTMultiplicity multiplicity() throws RecognitionException, TokenStreamException { ASTMultiplicity n; ASTMultiplicityRange mr; n = null; try { // for error handling MyToken t = (MyToken) LT(1); // remember start position of expression n = new ASTMultiplicity(t); mr=multiplicityRange(); n.addRange(mr); { _loop97: do { if ((LA(1)==COMMA)) { match(COMMA); mr=multiplicityRange(); n.addRange(mr); } else { break _loop97; } } while (true); } } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_23); } return n; } public final ASTMultiplicityRange multiplicityRange() throws RecognitionException, TokenStreamException { ASTMultiplicityRange n; int ms1, ms2; n = null; try { // for error handling ms1=multiplicitySpec(); n = new ASTMultiplicityRange(ms1); { switch ( LA(1)) { case DOTDOT: {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -