📄 guseparser.java
字号:
{ _loop28: do { if ((LA(1)==LITERAL_inv)) { ASTInvariantClause inv; inv=invariantClause(); n.addInvariantClause(inv); } else { break _loop28; } } 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_3); } 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()); } } } 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 _cnt33=0; _loop33: do { if ((LA(1)==IDENT)) { ae=associationEnd(); n.addEnd(ae); } else { if ( _cnt33>=1 ) { break _loop33; } else {throw new NoViableAltException(LT(1), getFilename());} } _cnt33++; } while (true); } { switch ( LA(1)) { case LITERAL_attributes: { match(LITERAL_attributes); ASTAttribute a; { _loop36: do { if ((LA(1)==IDENT)) { a=attributeDefinition(); n.addAttribute(a); } else { break _loop36; } } 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; { _loop39: do { if ((LA(1)==IDENT)) { op=operationDefinition(); n.addOperation(op); } else { break _loop39; } } 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); { _loop42: do { if ((LA(1)==LITERAL_inv)) { ASTInvariantClause inv; inv=invariantClause(); n.addInvariantClause(inv); } else { break _loop42; } } 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_3); } 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_7); } 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); { _loop52: do { if ((LA(1)==LITERAL_pre||LA(1)==LITERAL_post)) { ppc=prePostClause(); n.addPrePostClause(ppc); } else { break _loop52; } } 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_8); } 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_9); } 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_10); } 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_11); } 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); { _loop84: do { if ((LA(1)==COMMA)) { match(COMMA); v=variableDeclaration(); paramList.add(v); } else { break _loop84; } } while (true); } break; } case RPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(RPAREN); } catch (RecognitionException ex) { reportError(ex); consume(); consumeUntil(_tokenSet_12); } return paramList; } 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 */ { _loop93: do {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -