| /** |
| * @generated by Gymnast from Emfatic.ast on 09.02.2007 13:03:05 |
| */ |
| |
| options { |
| JDK_VERSION = "1.5"; |
| STATIC = false ; |
| LOOKAHEAD=4; |
| FORCE_LA_CHECK = true; |
| } |
| |
| PARSER_BEGIN(EmfaticParser) |
| package org.eclipse.emf.emfatic.core.lang.gen.parser; |
| |
| import org.eclipse.emf.emfatic.core.lang.gen.ast.*; |
| import org.eclipse.gymnast.runtime.core.ast.*; |
| |
| public class EmfaticParser { |
| |
| public TokenInfo createTokenInfo(Token tok) { |
| if (!(tok instanceof ExtToken)) return null; |
| |
| ExtToken extToken = (ExtToken) tok; |
| return new TokenInfo(tok.image, extToken.tokenOffset, tok.kind); |
| } |
| |
| } |
| PARSER_END(EmfaticParser) |
| |
| SKIP : |
| { |
| < SINGLELINECOMMENT : <DOUBLESLASH> (~["\n","\r"])* ("\n"|"\r\n")> |
| | < WS : ([" ", "\t", "\f", "\r", "\n"])+ > |
| | "/*" : WithinComment |
| } |
| <WithinComment> SKIP : |
| { |
| "*/" : DEFAULT |
| } |
| <WithinComment> MORE : |
| { |
| < ~[] > |
| } |
| |
| TOKEN : |
| { |
| < PACKAGEKW : "package" > |
| | < CLASSKW : "class" > |
| | < IMPORTKW : "import" > |
| | < ABSTRACTKW : "abstract" > |
| | < INTERFACEKW : "interface" > |
| | < EXTENDSKW : "extends" > |
| | < SUPERKW : "super" > |
| | < ATTRKW : "attr" > |
| | < REFKW : "ref" > |
| | < VALKW : "val" > |
| | < READONLYKW : "readonly" > |
| | < VOLATILEKW : "volatile" > |
| | < TRANSIENTKW : "transient" > |
| | < UNSETTABLEKW : "unsettable" > |
| | < DERIVEDKW : "derived" > |
| | < UNIQUEKW : "unique" > |
| | < ORDEREDKW : "ordered" > |
| | < RESOLVEKW : "resolve" > |
| | < IDKW : "id" > |
| | < TRUEKW : "true" > |
| | < FALSEKW : "false" > |
| | < OPKW : "op" > |
| | < VOIDKW : "void" > |
| | < DATATYPEKW : "datatype" > |
| | < ENUMKW : "enum" > |
| | < MAPENTRYKW : "mapentry" > |
| | < THROWSKW : "throws" > |
| |
| | < #DOUBLESLASH : "//" > |
| | < #DOUBLEQUOTE : "\"" > |
| | < #SINGLEQUOTE : "'" > |
| | < #BACKSLASH : "\\" > |
| |
| | < LCURLY : "{" > |
| | < RCURLY : "}" > |
| | < LSQUARE : "[" > |
| | < RSQUARE : "]" > |
| | < LPAREN : "(" > |
| | < RPAREN : ")" > |
| |
| | < DOT : "."> |
| | < COMMA : ","> |
| | < COLON : ":"> |
| | < SEMI : ";"> |
| |
| | < STAR : "*"> |
| | < PLUS : "+"> |
| | < MINUS : "-"> |
| | < EQUALS : "="> |
| |
| | < QMARK : "?"> |
| | < BANG : "!"> |
| | < DOLLAR : "$"> |
| | < HASH : "#"> |
| | < AT : "@"> |
| |
| | < DOT_DOT : ".."> |
| | < MINUS_GT : "->"> |
| | < GT_LT : "><"> |
| | < LT_GT : "<>"> |
| |
| | < AMP : "&" > |
| | < LT : "<" > |
| | < GT : ">" > |
| |
| | < STRING_LITERAL : <DOUBLEQUOTE> (<ESC> | ~["\""])* <DOUBLEQUOTE> > |
| | < CHAR_LITERAL : <SINGLEQUOTE> (<ESC> | (~["'"])) <SINGLEQUOTE> > |
| |
| | < #LETTERORUNDERSCORE : ["a"-"z", "A"-"Z", "_"] > |
| | < #LETTERORUNDERSCOREORDIGIT : ( <LETTERORUNDERSCORE> | <DIGIT> ) > |
| |
| | < INT_LITERAL : (<DIGIT>)+ > |
| |
| | < #DIGIT : ["0"-"9"] > |
| |
| // TODO: The <DIGITDIGITDIGIT> is cheesy it should be something like |
| // ( options { warnWhenFollowAmbig = false; } : (DIGIT)+ ) |
| // but I don't want to deal with parsing that yet. |
| | < #ESC : <BACKSLASH> ("t" | "f" | "r" | "n" | <DOUBLEQUOTE> | <SINGLEQUOTE> | <BACKSLASH> | <DIGITDIGITDIGIT> ) > |
| | < #DIGITDIGITDIGIT : <DIGIT> <DIGIT> <DIGIT> > |
| } |
| |
| TOKEN : |
| { |
| < ID : ("~")? <LETTERORUNDERSCORE> (<LETTERORUNDERSCOREORDIGIT>)* > |
| } |
| |
| |
| CompUnit compUnit() : |
| { CompUnit retVal = null; |
| PackageDecl packageDecl = null; |
| ImportStmts importStmts = null; |
| TopLevelDecls topLevelDecls = null; } |
| { |
| packageDecl=packageDecl() importStmts=importStmts() topLevelDecls=topLevelDecls() <EOF> |
| { retVal = new CompUnit(packageDecl, importStmts, topLevelDecls); |
| return retVal; } |
| } |
| |
| PackageDecl packageDecl() : |
| { PackageDecl retVal = null; |
| Annotations annotations = null; |
| Token package_KW = null; |
| QualifiedID name = null; |
| Token semi = null; } |
| { |
| annotations=annotations() package_KW=<PACKAGEKW> name=qualifiedID() semi=<SEMI> |
| { retVal = new PackageDecl(annotations, createTokenInfo(package_KW), name, createTokenInfo(semi)); |
| return retVal; } |
| } |
| |
| QualifiedID qualifiedID() : |
| { QualifiedID retVal = new QualifiedID(); |
| Token id1 = null; |
| QidSeparator qidSeparator = null; |
| Token idn = null; } |
| { ( id1=<ID> { retVal.addChild(createTokenInfo(id1)); } ) |
| ( qidSeparator=qidSeparator() idn=<ID> { retVal.addChild(qidSeparator); retVal.addChild(createTokenInfo(idn)); } )* { return retVal; } } |
| |
| QidSeparator qidSeparator() : |
| { Token tok; } |
| { tok=<DOT> { return new QidSeparator (createTokenInfo(tok)); } |
| | tok=<DOLLAR> { return new QidSeparator (createTokenInfo(tok)); } |
| } |
| |
| StringLiteralOrQualifiedID stringLiteralOrQualifiedID() : |
| { StringLiteralOrQualifiedID retVal = null; } |
| { |
| ( retVal=stringLiteralContainer() { return retVal; } |
| | retVal=qualifiedIDContainer() { return retVal; } |
| ) |
| } |
| |
| StringLiteralContainer stringLiteralContainer() : |
| { StringLiteralContainer retVal = null; |
| Token string_literal = null; } |
| { |
| string_literal=<STRING_LITERAL> |
| { retVal = new StringLiteralContainer(createTokenInfo(string_literal)); |
| return retVal; } |
| } |
| |
| QualifiedIDContainer qualifiedIDContainer() : |
| { QualifiedIDContainer retVal = null; |
| QualifiedID qualifiedID = null; } |
| { |
| qualifiedID=qualifiedID() |
| { retVal = new QualifiedIDContainer(qualifiedID); |
| return retVal; } |
| } |
| |
| Annotations annotations() : |
| { Annotations retVal = new Annotations(); |
| Annotation annotation = null; } |
| { ( annotation=annotation() { retVal.addChild(annotation); } )* { return retVal; } } |
| |
| Annotation annotation() : |
| { Annotation retVal = null; |
| Token at = null; |
| StringLiteralOrQualifiedID source = null; |
| Token lparen = null; |
| KeyEqualsValueList keyEqualsValueList = null; |
| Token rparen = null; } |
| { |
| at=<AT> source=stringLiteralOrQualifiedID() lparen=<LPAREN> keyEqualsValueList=keyEqualsValueList() rparen=<RPAREN> |
| { retVal = new Annotation(createTokenInfo(at), source, createTokenInfo(lparen), keyEqualsValueList, createTokenInfo(rparen)); |
| return retVal; } |
| } |
| |
| KeyEqualsValueList keyEqualsValueList() : |
| { KeyEqualsValueList retVal = new KeyEqualsValueList(); |
| KeyEqualsValue kv1 = null; |
| Token comma = null; |
| KeyEqualsValue kvn = null; } |
| { ( kv1=keyEqualsValue() { retVal.addChild(kv1); } ) |
| ( comma=<COMMA> kvn=keyEqualsValue() { retVal.addChild(createTokenInfo(comma)); retVal.addChild(kvn); } )* { return retVal; } } |
| |
| KeyEqualsValue keyEqualsValue() : |
| { KeyEqualsValue retVal = null; |
| StringLiteralOrQualifiedID key = null; |
| Token equals = null; |
| StringLiteralOrQualifiedID value = null; } |
| { |
| key=stringLiteralOrQualifiedID() equals=<EQUALS> value=stringLiteralOrQualifiedID() |
| { retVal = new KeyEqualsValue(key, createTokenInfo(equals), value); |
| return retVal; } |
| } |
| |
| ImportStmts importStmts() : |
| { ImportStmts retVal = new ImportStmts(); |
| ImportStmt importStmt = null; } |
| { ( importStmt=importStmt() { retVal.addChild(importStmt); } )* { return retVal; } } |
| |
| ImportStmt importStmt() : |
| |
| { ImportStmt retVal = null; |
| Token import_KW = null; |
| Token alias = null; |
| Token equals = null; |
| StringLiteralOrQualifiedID uri = null; |
| Token semi = null; } |
| { |
| import_KW=<IMPORTKW> ( alias=<ID> equals=<EQUALS> )? uri=stringLiteralOrQualifiedID() semi=<SEMI> |
| { retVal = new ImportStmt(createTokenInfo(import_KW), createTokenInfo(alias), createTokenInfo(equals), uri, createTokenInfo(semi)); |
| return retVal; } |
| } |
| |
| TopLevelDecls topLevelDecls() : |
| { TopLevelDecls retVal = new TopLevelDecls(); |
| TopLevelDecl topLevelDecl = null; } |
| { ( topLevelDecl=topLevelDecl() { retVal.addChild(topLevelDecl); } )* { return retVal; } } |
| |
| TopLevelDecl topLevelDecl() : |
| { TopLevelDecl retVal = null; |
| Annotations annotations = null; } |
| { |
| annotations=annotations() |
| ( retVal=subPackageDecl(annotations) { return retVal; } |
| | retVal=classDecl(annotations) { return retVal; } |
| | retVal=dataTypeDecl(annotations) { return retVal; } |
| | retVal=enumDecl(annotations) { return retVal; } |
| | retVal=mapEntryDecl(annotations) { return retVal; } |
| ) |
| } |
| |
| SubPackageDecl subPackageDecl(Annotations annotations) : |
| { SubPackageDecl retVal = null; |
| Token package_KW = null; |
| Token name = null; |
| Token lcurly = null; |
| TopLevelDecls topLevelDecls = null; |
| Token rcurly = null; } |
| { |
| package_KW=<PACKAGEKW> name=<ID> lcurly=<LCURLY> topLevelDecls=topLevelDecls() rcurly=<RCURLY> |
| { retVal = new SubPackageDecl(annotations, createTokenInfo(package_KW), createTokenInfo(name), createTokenInfo(lcurly), topLevelDecls, createTokenInfo(rcurly)); |
| return retVal; } |
| } |
| |
| ClassDecl classDecl(Annotations annotations) : |
| { ClassDecl retVal = null; |
| AbstractModifier abstractModifier = null; |
| ClassKind classKind = null; |
| Token name = null; |
| TypeParamsInfo typeParamsInfo = null; |
| Token extends_KW = null; |
| CommaListBoundExceptWild superTypes = null; |
| Token colon = null; |
| BoundExceptWildcard instClassName = null; |
| Token lcurly = null; |
| ClassMemberDecls classMemberDecls = null; |
| Token rcurly = null; } |
| { |
| ( abstractModifier=abstractModifier() )? classKind=classKind() name=<ID> ( typeParamsInfo=typeParamsInfo() )? ( extends_KW="extends" superTypes=commaListBoundExceptWild() )? ( colon=<COLON> instClassName=boundExceptWildcard() )? lcurly=<LCURLY> classMemberDecls=classMemberDecls() rcurly=<RCURLY> |
| { retVal = new ClassDecl(annotations, abstractModifier, classKind, createTokenInfo(name), typeParamsInfo, createTokenInfo(extends_KW), superTypes, createTokenInfo(colon), instClassName, createTokenInfo(lcurly), classMemberDecls, createTokenInfo(rcurly)); |
| return retVal; } |
| } |
| |
| CommaListBoundExceptWild commaListBoundExceptWild() : |
| { CommaListBoundExceptWild retVal = new CommaListBoundExceptWild(); |
| BoundExceptWildcard tb1 = null; |
| Token comma = null; |
| BoundExceptWildcard tbn = null; } |
| { ( tb1=boundExceptWildcard() { retVal.addChild(tb1); } ) |
| ( comma=<COMMA> tbn=boundExceptWildcard() { retVal.addChild(createTokenInfo(comma)); retVal.addChild(tbn); } )* { return retVal; } } |
| |
| AbstractModifier abstractModifier() : |
| { AbstractModifier retVal = null; |
| Token abstract_KW = null; } |
| { |
| abstract_KW=<ABSTRACTKW> |
| { retVal = new AbstractModifier(createTokenInfo(abstract_KW)); |
| return retVal; } |
| } |
| |
| ClassKind classKind() : |
| { Token tok; } |
| { tok=<CLASSKW> { return new ClassKind (createTokenInfo(tok)); } |
| | tok=<INTERFACEKW> { return new ClassKind (createTokenInfo(tok)); } |
| } |
| |
| TypeParamsInfo typeParamsInfo() : |
| { TypeParamsInfo retVal = null; |
| Token lt = null; |
| OneOrMoreTypeParams oneOrMoreTypeParams = null; |
| Token gt = null; } |
| { |
| lt=<LT> oneOrMoreTypeParams=oneOrMoreTypeParams() gt=<GT> |
| { retVal = new TypeParamsInfo(createTokenInfo(lt), oneOrMoreTypeParams, createTokenInfo(gt)); |
| return retVal; } |
| } |
| |
| OneOrMoreTypeParams oneOrMoreTypeParams() : |
| { OneOrMoreTypeParams retVal = new OneOrMoreTypeParams(); |
| TypeParam tp1 = null; |
| Token comma = null; |
| TypeParam tpn = null; } |
| { ( tp1=typeParam() { retVal.addChild(tp1); } ) |
| ( comma=<COMMA> tpn=typeParam() { retVal.addChild(createTokenInfo(comma)); retVal.addChild(tpn); } )* { return retVal; } } |
| |
| TypeParam typeParam() : |
| { TypeParam retVal = null; |
| Token typeVarName = null; |
| TypeBoundsInfo typeBoundsInfo = null; } |
| { |
| typeVarName=<ID> ( typeBoundsInfo=typeBoundsInfo() )? |
| { retVal = new TypeParam(createTokenInfo(typeVarName), typeBoundsInfo); |
| return retVal; } |
| } |
| |
| TypeBoundsInfo typeBoundsInfo() : |
| { TypeBoundsInfo retVal = null; |
| Token extends_KW = null; |
| OneOrMoreTypeParamBounds oneOrMoreTypeParamBounds = null; } |
| { |
| extends_KW=<EXTENDSKW> oneOrMoreTypeParamBounds=oneOrMoreTypeParamBounds() |
| { retVal = new TypeBoundsInfo(createTokenInfo(extends_KW), oneOrMoreTypeParamBounds); |
| return retVal; } |
| } |
| |
| OneOrMoreTypeParamBounds oneOrMoreTypeParamBounds() : |
| { OneOrMoreTypeParamBounds retVal = new OneOrMoreTypeParamBounds(); |
| BoundExceptWildcard tb1 = null; |
| Token amp = null; |
| BoundExceptWildcard tbn = null; } |
| { ( tb1=boundExceptWildcard() { retVal.addChild(tb1); } ) |
| ( amp=<AMP> tbn=boundExceptWildcard() { retVal.addChild(createTokenInfo(amp)); retVal.addChild(tbn); } )* { return retVal; } } |
| |
| BoundExceptWildcard boundExceptWildcard() : |
| { BoundExceptWildcard retVal = null; |
| QualifiedID rawTNameOrTVarOrParamzedTName = null; |
| Token lt = null; |
| OneOrMoreTypeArgs oneOrMoreTypeArgs = null; |
| Token gt = null; } |
| { |
| rawTNameOrTVarOrParamzedTName=qualifiedID() ( lt=<LT> oneOrMoreTypeArgs=oneOrMoreTypeArgs() gt=<GT> )? |
| { retVal = new BoundExceptWildcard(rawTNameOrTVarOrParamzedTName, createTokenInfo(lt), oneOrMoreTypeArgs, createTokenInfo(gt)); |
| return retVal; } |
| } |
| |
| OneOrMoreTypeArgs oneOrMoreTypeArgs() : |
| { OneOrMoreTypeArgs retVal = new OneOrMoreTypeArgs(); |
| TypeArg ta1 = null; |
| Token comma = null; |
| TypeArg tan = null; } |
| { ( ta1=typeArg() { retVal.addChild(ta1); } ) |
| ( comma=<COMMA> tan=typeArg() { retVal.addChild(createTokenInfo(comma)); retVal.addChild(tan); } )* { return retVal; } } |
| |
| TypeArg typeArg() : |
| { TypeArg retVal = null; } |
| { |
| ( retVal=boundExceptWildcard() { return retVal; } |
| | retVal=wildcard() { return retVal; } |
| ) |
| } |
| |
| Wildcard wildcard() : |
| { Wildcard retVal = null; |
| Token qmark = null; |
| ExtendsOrSuper extendsOrSuper = null; |
| BoundExceptWildcard boundExceptWildcard = null; } |
| { |
| qmark=<QMARK> ( extendsOrSuper=extendsOrSuper() boundExceptWildcard=boundExceptWildcard() )? |
| { retVal = new Wildcard(createTokenInfo(qmark), extendsOrSuper, boundExceptWildcard); |
| return retVal; } |
| } |
| |
| ExtendsOrSuper extendsOrSuper() : |
| { Token tok; } |
| { tok=<EXTENDSKW> { return new ExtendsOrSuper (createTokenInfo(tok)); } |
| | tok=<SUPERKW> { return new ExtendsOrSuper (createTokenInfo(tok)); } |
| } |
| |
| ClassMemberDecls classMemberDecls() : |
| { ClassMemberDecls retVal = new ClassMemberDecls(); |
| ClassMemberDecl classMemberDecl = null; } |
| { ( classMemberDecl=classMemberDecl() { retVal.addChild(classMemberDecl); } )* { return retVal; } } |
| |
| ClassMemberDecl classMemberDecl() : |
| { ClassMemberDecl retVal = null; |
| Annotations annotations = null; |
| Modifiers modifiers = null; } |
| { |
| annotations=annotations() modifiers=modifiers() |
| ( retVal=attribute(annotations, modifiers) { return retVal; } |
| | retVal=reference(annotations, modifiers) { return retVal; } |
| | retVal=operation(annotations, modifiers) { return retVal; } |
| ) |
| } |
| |
| Attribute attribute(Annotations annotations, Modifiers modifiers) : |
| { Attribute retVal = null; |
| Token attr_KW = null; |
| TypeWithMulti typeWithMulti = null; |
| Token name = null; |
| Token equals = null; |
| DefaultValueExpr defaultValueExpr = null; |
| Token semi = null; } |
| { |
| attr_KW=<ATTRKW> typeWithMulti=typeWithMulti() name=<ID> ( equals=<EQUALS> defaultValueExpr=defaultValueExpr() )? semi=<SEMI> |
| { retVal = new Attribute(annotations, modifiers, createTokenInfo(attr_KW), typeWithMulti, createTokenInfo(name), createTokenInfo(equals), defaultValueExpr, createTokenInfo(semi)); |
| return retVal; } |
| } |
| |
| TypeWithMulti typeWithMulti() : |
| { TypeWithMulti retVal = null; |
| BoundExceptWildcard name = null; |
| Multiplicity multiplicity = null; } |
| { |
| name=boundExceptWildcard() ( multiplicity=multiplicity() )? |
| { retVal = new TypeWithMulti(name, multiplicity); |
| return retVal; } |
| } |
| |
| Multiplicity multiplicity() : |
| { Multiplicity retVal = null; |
| Token lsquare = null; |
| MultiplicityExpr multiplicityExpr = null; |
| Token rsquare = null; } |
| { |
| lsquare=<LSQUARE> ( multiplicityExpr=multiplicityExpr() )? rsquare=<RSQUARE> |
| { retVal = new Multiplicity(createTokenInfo(lsquare), multiplicityExpr, createTokenInfo(rsquare)); |
| return retVal; } |
| } |
| |
| MultiplicityExpr multiplicityExpr() : |
| { MultiplicityExpr retVal = null; |
| SimpleMultiplicityExpr lowerBound = null; |
| Token dot_dot = null; |
| SimpleMultiplicityExpr upperBound = null; } |
| { |
| lowerBound=simpleMultiplicityExpr() ( dot_dot=<DOT_DOT> upperBound=simpleMultiplicityExpr() )? |
| { retVal = new MultiplicityExpr(lowerBound, createTokenInfo(dot_dot), upperBound); |
| return retVal; } |
| } |
| |
| SimpleMultiplicityExpr simpleMultiplicityExpr() : |
| { Token tok; } |
| { tok=<STAR> { return new SimpleMultiplicityExpr (createTokenInfo(tok)); } |
| | tok=<PLUS> { return new SimpleMultiplicityExpr (createTokenInfo(tok)); } |
| | tok=<QMARK> { return new SimpleMultiplicityExpr (createTokenInfo(tok)); } |
| | tok=<INT_LITERAL> { return new SimpleMultiplicityExpr (createTokenInfo(tok)); } |
| } |
| |
| Reference reference(Annotations annotations, Modifiers modifiers) : |
| { Reference retVal = null; |
| ReferenceKind referenceKind = null; |
| TypeWithMulti typeWithMulti = null; |
| Token hash = null; |
| Token oppositeName = null; |
| Token name = null; |
| Token semi = null; } |
| { |
| referenceKind=referenceKind() typeWithMulti=typeWithMulti() ( hash=<HASH> oppositeName=<ID> )? name=<ID> semi=<SEMI> |
| { retVal = new Reference(annotations, modifiers, referenceKind, typeWithMulti, createTokenInfo(hash), createTokenInfo(oppositeName), createTokenInfo(name), createTokenInfo(semi)); |
| return retVal; } |
| } |
| |
| ReferenceKind referenceKind() : |
| { Token tok; } |
| { tok=<REFKW> { return new ReferenceKind (createTokenInfo(tok)); } |
| | tok=<VALKW> { return new ReferenceKind (createTokenInfo(tok)); } |
| } |
| |
| Modifiers modifiers() : |
| { Modifiers retVal = new Modifiers(); |
| OptNegatedModifier optNegatedModifier = null; } |
| { ( optNegatedModifier=optNegatedModifier() { retVal.addChild(optNegatedModifier); } )* { return retVal; } } |
| |
| OptNegatedModifier optNegatedModifier() : |
| { OptNegatedModifier retVal = null; |
| Token bang = null; |
| Modifier modifier = null; } |
| { |
| ( bang=<BANG> )? modifier=modifier() |
| { retVal = new OptNegatedModifier(createTokenInfo(bang), modifier); |
| return retVal; } |
| } |
| |
| Modifier modifier() : |
| { Token tok; } |
| { tok=<READONLYKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<VOLATILEKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<TRANSIENTKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<UNSETTABLEKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<DERIVEDKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<UNIQUEKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<ORDEREDKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<RESOLVEKW> { return new Modifier (createTokenInfo(tok)); } |
| | tok=<IDKW> { return new Modifier (createTokenInfo(tok)); } |
| } |
| |
| DefaultValueExpr defaultValueExpr() : |
| { DefaultValueExpr retVal = null; } |
| { |
| ( retVal=boolExpr() { return retVal; } |
| | retVal=intExpr() { return retVal; } |
| | retVal=stringExpr() { return retVal; } |
| | retVal=charExpr() { return retVal; } |
| ) |
| } |
| |
| BoolExpr boolExpr() : |
| { BoolExpr retVal = null; |
| TrueOrFalse trueOrFalse = null; } |
| { |
| trueOrFalse=trueOrFalse() |
| { retVal = new BoolExpr(trueOrFalse); |
| return retVal; } |
| } |
| |
| TrueOrFalse trueOrFalse() : |
| { Token tok; } |
| { tok=<TRUEKW> { return new TrueOrFalse (createTokenInfo(tok)); } |
| | tok=<FALSEKW> { return new TrueOrFalse (createTokenInfo(tok)); } |
| } |
| |
| IntExpr intExpr() : |
| { IntExpr retVal = null; |
| Token minus = null; |
| Token int_literal = null; } |
| { |
| ( minus=<MINUS> )? int_literal=<INT_LITERAL> |
| { retVal = new IntExpr(createTokenInfo(minus), createTokenInfo(int_literal)); |
| return retVal; } |
| } |
| |
| StringExpr stringExpr() : |
| { StringExpr retVal = null; |
| Token string_literal = null; } |
| { |
| string_literal=<STRING_LITERAL> |
| { retVal = new StringExpr(createTokenInfo(string_literal)); |
| return retVal; } |
| } |
| |
| CharExpr charExpr() : |
| { CharExpr retVal = null; |
| Token char_literal = null; } |
| { |
| char_literal=<CHAR_LITERAL> |
| { retVal = new CharExpr(createTokenInfo(char_literal)); |
| return retVal; } |
| } |
| |
| Operation operation(Annotations annotations, Modifiers modifiers) : |
| { Operation retVal = null; |
| Token op_KW = null; |
| TypeParamsInfo typeParamsInfo = null; |
| ResultType resType = null; |
| Token name = null; |
| Token lparen = null; |
| Params params = null; |
| Token rparen = null; |
| Token throws_KW = null; |
| CommaListBoundExceptWild exceptions = null; |
| Token semi = null; } |
| { |
| op_KW=<OPKW> ( typeParamsInfo=typeParamsInfo() )? resType=resultType() name=<ID> lparen=<LPAREN> ( params=params() )? rparen=<RPAREN> ( throws_KW=<THROWSKW> exceptions=commaListBoundExceptWild() )? semi=<SEMI> |
| { retVal = new Operation(annotations, modifiers, createTokenInfo(op_KW), typeParamsInfo, resType, createTokenInfo(name), createTokenInfo(lparen), params, createTokenInfo(rparen), createTokenInfo(throws_KW), exceptions, createTokenInfo(semi)); |
| return retVal; } |
| } |
| |
| ResultType resultType() : |
| { ResultType retVal = null; } |
| { |
| ( retVal=typeWithMulti() { return retVal; } |
| | retVal=voidContainer() { return retVal; } |
| ) |
| } |
| |
| VoidContainer voidContainer() : |
| { VoidContainer retVal = null; |
| Token void_KW = null; } |
| { |
| void_KW=<VOIDKW> |
| { retVal = new VoidContainer(createTokenInfo(void_KW)); |
| return retVal; } |
| } |
| |
| Params params() : |
| { Params retVal = new Params(); |
| Param p1 = null; |
| Token comma = null; |
| Param pn = null; } |
| { ( p1=param() { retVal.addChild(p1); } ) |
| ( comma=<COMMA> pn=param() { retVal.addChild(createTokenInfo(comma)); retVal.addChild(pn); } )* { return retVal; } } |
| |
| Param param() : |
| { Param retVal = null; |
| Annotations leadingAnnotations = null; |
| Modifiers modifiers = null; |
| TypeWithMulti typeWithMulti = null; |
| Token name = null; |
| Annotations trailingAnnotations = null; } |
| { |
| leadingAnnotations=annotations() modifiers=modifiers() typeWithMulti=typeWithMulti() name=<ID> trailingAnnotations=annotations() |
| { retVal = new Param(leadingAnnotations, modifiers, typeWithMulti, createTokenInfo(name), trailingAnnotations); |
| return retVal; } |
| } |
| |
| DataTypeDecl dataTypeDecl(Annotations annotations) : |
| { DataTypeDecl retVal = null; |
| TransientModifier transientModifier = null; |
| Token datatype_KW = null; |
| Token name = null; |
| Token colon = null; |
| StringLiteralOrQualifiedID instClassName = null; |
| Token semi = null; } |
| { |
| ( transientModifier=transientModifier() )? datatype_KW=<DATATYPEKW> name=<ID> colon=<COLON> instClassName=stringLiteralOrQualifiedID() semi=<SEMI> |
| { retVal = new DataTypeDecl(annotations, transientModifier, createTokenInfo(datatype_KW), createTokenInfo(name), createTokenInfo(colon), instClassName, createTokenInfo(semi)); |
| return retVal; } |
| } |
| |
| TransientModifier transientModifier() : |
| { TransientModifier retVal = null; |
| Token transient_KW = null; } |
| { |
| transient_KW=<TRANSIENTKW> |
| { retVal = new TransientModifier(createTokenInfo(transient_KW)); |
| return retVal; } |
| } |
| |
| EnumDecl enumDecl(Annotations annotations) : |
| { EnumDecl retVal = null; |
| Token enum_KW = null; |
| Token name = null; |
| Token lcurly = null; |
| EnumLiterals enumLiterals = null; |
| Token rcurly = null; } |
| { |
| enum_KW=<ENUMKW> name=<ID> lcurly=<LCURLY> enumLiterals=enumLiterals() rcurly=<RCURLY> |
| { retVal = new EnumDecl(annotations, createTokenInfo(enum_KW), createTokenInfo(name), createTokenInfo(lcurly), enumLiterals, createTokenInfo(rcurly)); |
| return retVal; } |
| } |
| |
| EnumLiterals enumLiterals() : |
| { EnumLiterals retVal = new EnumLiterals(); |
| EnumLiteral enumLiteral = null; } |
| { ( enumLiteral=enumLiteral() { retVal.addChild(enumLiteral); } )* { return retVal; } } |
| |
| EnumLiteral enumLiteral() : |
| { EnumLiteral retVal = null; |
| Annotations leadingAnnotations = null; |
| Token name = null; |
| Token equals = null; |
| Token val = null; |
| Annotations trailingAnnotations = null; |
| Token semi = null; } |
| { |
| leadingAnnotations=annotations() name=<ID> ( equals=<EQUALS> val=<INT_LITERAL> )? trailingAnnotations=annotations() semi=<SEMI> |
| { retVal = new EnumLiteral(leadingAnnotations, createTokenInfo(name), createTokenInfo(equals), createTokenInfo(val), trailingAnnotations, createTokenInfo(semi)); |
| return retVal; } |
| } |
| |
| MapEntryDecl mapEntryDecl(Annotations annotations) : |
| { MapEntryDecl retVal = null; |
| Token mapentry_KW = null; |
| Token name = null; |
| Token colon = null; |
| TypeWithMulti key = null; |
| Token minus_gt = null; |
| TypeWithMulti value = null; |
| Token semi = null; } |
| { |
| mapentry_KW=<MAPENTRYKW> name=<ID> colon=<COLON> key=typeWithMulti() minus_gt=<MINUS_GT> value=typeWithMulti() semi=<SEMI> |
| { retVal = new MapEntryDecl(annotations, createTokenInfo(mapentry_KW), createTokenInfo(name), createTokenInfo(colon), key, createTokenInfo(minus_gt), value, createTokenInfo(semi)); |
| return retVal; } |
| } |
| |