// $ANTLR start "bindingDeclArg" // AS3_ex.g3:1600:1: bindingDeclArg : (I= IDENTIFIER E= ASSIGN )? ( stringLiteral | numericLiteral | eitherIdentifier ) ; public AS3_exParser.bindingDeclArg_return bindingDeclArg() // throws RecognitionException [1] { AS3_exParser.bindingDeclArg_return retval = new AS3_exParser.bindingDeclArg_return(); retval.Start = input.LT(1); int bindingDeclArg_StartIndex = input.Index(); object root_0 = null; IToken I = null; IToken E = null; AS3_exParser.stringLiteral_return stringLiteral82 = null; AS3_exParser.numericLiteral_return numericLiteral83 = null; AS3_exParser.eitherIdentifier_return eitherIdentifier84 = null; object I_tree=null; object E_tree=null; try { if ( (state.backtracking > 0) && AlreadyParsedRule(input, 42) ) { return retval; } // AS3_ex.g3:1601:2: ( (I= IDENTIFIER E= ASSIGN )? ( stringLiteral | numericLiteral | eitherIdentifier ) ) // AS3_ex.g3:1608:5: (I= IDENTIFIER E= ASSIGN )? ( stringLiteral | numericLiteral | eitherIdentifier ) { root_0 = (object)adaptor.GetNilNode(); // AS3_ex.g3:1608:5: (I= IDENTIFIER E= ASSIGN )? int alt47 = 2; int LA47_0 = input.LA(1); if ( (LA47_0 == IDENTIFIER) ) { int LA47_1 = input.LA(2); if ( (LA47_1 == ASSIGN) ) { alt47 = 1; } } switch (alt47) { case 1 : // AS3_ex.g3:1608:6: I= IDENTIFIER E= ASSIGN { I=(IToken)Match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_bindingDeclArg6545); if (state.failed) return retval; if ( state.backtracking == 0 ) {I_tree = (object)adaptor.Create(I); adaptor.AddChild(root_0, I_tree); } if ( state.backtracking == 0 ) { Emit((CommonToken)I); } E=(IToken)Match(input,ASSIGN,FOLLOW_ASSIGN_in_bindingDeclArg6551); if (state.failed) return retval; if ( state.backtracking == 0 ) {E_tree = (object)adaptor.Create(E); adaptor.AddChild(root_0, E_tree); } if ( state.backtracking == 0 ) { Emit((CommonToken)E); } } break; } // AS3_ex.g3:1609:2: ( stringLiteral | numericLiteral | eitherIdentifier ) int alt48 = 3; switch ( input.LA(1) ) { case SINGLE_QUOTE_LITERAL: case DOUBLE_QUOTE_LITERAL: { alt48 = 1; } break; case HEX_NUMBER_LITERAL: case DEC_NUMBER_LITERAL: { alt48 = 2; } break; case AS: case BREAK: case CASE: case CATCH: case CLASS: case CONST: case CONTINUE: case DEFAULT: case DELETE: case DO: case ELSE: case EXTENDS: case FALSE: case FINALLY: case FOR: case FUNCTION: case IF: case IMPLEMENTS: case IMPORT: case IN: case INSTANCEOF: case INTERFACE: case INTERNAL: case IS: case NATIVE: case NEW: case NULL: case PACKAGE: case PRIVATE: case PROTECTED: case PUBLIC: case RETURN: case SUPER: case SWITCH: case THIS: case THROW: case TO: case TRUE: case TRY: case TYPEOF: case USE: case VAR: case VOID: case WHILE: case WITH: case EACH: case GET: case SET: case NAMESPACE: case INCLUDE: case DYNAMIC: case FINAL: case OVERRIDE: case STATIC: case STAR: case XML_AT: case IDENTIFIER: { alt48 = 3; } break; default: if ( state.backtracking > 0 ) {state.failed = true; return retval;} NoViableAltException nvae_d48s0 = new NoViableAltException("", 48, 0, input); throw nvae_d48s0; } switch (alt48) { case 1 : // AS3_ex.g3:1610:3: stringLiteral { PushFollow(FOLLOW_stringLiteral_in_bindingDeclArg6564); stringLiteral82 = stringLiteral(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, stringLiteral82.Tree); } break; case 2 : // AS3_ex.g3:1610:19: numericLiteral { PushFollow(FOLLOW_numericLiteral_in_bindingDeclArg6568); numericLiteral83 = numericLiteral(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, numericLiteral83.Tree); } break; case 3 : // AS3_ex.g3:1610:36: eitherIdentifier { PushFollow(FOLLOW_eitherIdentifier_in_bindingDeclArg6572); eitherIdentifier84 = eitherIdentifier(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, eitherIdentifier84.Tree); } break; } } retval.Stop = input.LT(-1); if ( state.backtracking==0 ) { retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);} } catch (RecognitionException re) { ReportError(re); Recover(input,re); // Conversion of the second argument necessary, but harmless retval.Tree = (object)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re); } finally { if ( state.backtracking > 0 ) { Memoize(input, 42, bindingDeclArg_StartIndex); } } return retval; }
// $ANTLR start "bindingDeclArg" // AS3_ex.g3:1985:1: bindingDeclArg : ( eitherIdentifier E= ASSIGN )? ( stringLiteral | (P= PLUS | S= SUB )? numericLiteral | ( eitherIdentifier (D= DOT eitherIdentifier )* ) ) ; public AS3_exParser.bindingDeclArg_return bindingDeclArg() // throws RecognitionException [1] { AS3_exParser.bindingDeclArg_return retval = new AS3_exParser.bindingDeclArg_return(); retval.Start = input.LT(1); int bindingDeclArg_StartIndex = input.Index(); object root_0 = null; IToken E = null; IToken P = null; IToken S = null; IToken D = null; AS3_exParser.eitherIdentifier_return eitherIdentifier87 = null; AS3_exParser.stringLiteral_return stringLiteral88 = null; AS3_exParser.numericLiteral_return numericLiteral89 = null; AS3_exParser.eitherIdentifier_return eitherIdentifier90 = null; AS3_exParser.eitherIdentifier_return eitherIdentifier91 = null; object E_tree=null; object P_tree=null; object S_tree=null; object D_tree=null; try { if ( (state.backtracking > 0) && AlreadyParsedRule(input, 42) ) { return retval; } // AS3_ex.g3:1986:2: ( ( eitherIdentifier E= ASSIGN )? ( stringLiteral | (P= PLUS | S= SUB )? numericLiteral | ( eitherIdentifier (D= DOT eitherIdentifier )* ) ) ) // AS3_ex.g3:1993:5: ( eitherIdentifier E= ASSIGN )? ( stringLiteral | (P= PLUS | S= SUB )? numericLiteral | ( eitherIdentifier (D= DOT eitherIdentifier )* ) ) { root_0 = (object)adaptor.GetNilNode(); // AS3_ex.g3:1993:5: ( eitherIdentifier E= ASSIGN )? int alt49 = 2; alt49 = dfa49.Predict(input); switch (alt49) { case 1 : // AS3_ex.g3:1993:6: eitherIdentifier E= ASSIGN { PushFollow(FOLLOW_eitherIdentifier_in_bindingDeclArg6700); eitherIdentifier87 = eitherIdentifier(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, eitherIdentifier87.Tree); E=(IToken)Match(input,ASSIGN,FOLLOW_ASSIGN_in_bindingDeclArg6704); if (state.failed) return retval; if ( state.backtracking == 0 ) {E_tree = (object)adaptor.Create(E); adaptor.AddChild(root_0, E_tree); } if ( state.backtracking == 0 ) { insertWS(mPrinter.getAdvancedSpacesAroundAssignmentInMetatags()); emit(E); insertWS(mPrinter.getAdvancedSpacesAroundAssignmentInMetatags()); } } break; } // AS3_ex.g3:1994:2: ( stringLiteral | (P= PLUS | S= SUB )? numericLiteral | ( eitherIdentifier (D= DOT eitherIdentifier )* ) ) int alt52 = 3; switch ( input.LA(1) ) { case SINGLE_QUOTE_LITERAL: case DOUBLE_QUOTE_LITERAL: { alt52 = 1; } break; case PLUS: case SUB: case HEX_NUMBER_LITERAL: case DEC_NUMBER_LITERAL: { alt52 = 2; } break; case AS: case BREAK: case CASE: case CATCH: case CLASS: case CONST: case CONTINUE: case DEFAULT: case DELETE: case DO: case ELSE: case EXTENDS: case FALSE: case FINALLY: case FOR: case FUNCTION: case IF: case IMPLEMENTS: case IMPORT: case IN: case INSTANCEOF: case INTERFACE: case INTERNAL: case IS: case NATIVE: case NEW: case NULL: case PACKAGE: case PRIVATE: case PROTECTED: case PUBLIC: case RETURN: case SUPER: case SWITCH: case THIS: case THROW: case TO: case TRUE: case TRY: case TYPEOF: case USE: case VAR: case VOID: case WHILE: case WITH: case EACH: case GET: case SET: case NAMESPACE: case INCLUDE: case DYNAMIC: case FINAL: case OVERRIDE: case STATIC: case STAR: case XML_AT: case IDENTIFIER: { alt52 = 3; } break; default: if ( state.backtracking > 0 ) {state.failed = true; return retval;} NoViableAltException nvae_d52s0 = new NoViableAltException("", 52, 0, input); throw nvae_d52s0; } switch (alt52) { case 1 : // AS3_ex.g3:1995:3: stringLiteral { PushFollow(FOLLOW_stringLiteral_in_bindingDeclArg6717); stringLiteral88 = stringLiteral(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, stringLiteral88.Tree); } break; case 2 : // AS3_ex.g3:1995:19: (P= PLUS | S= SUB )? numericLiteral { // AS3_ex.g3:1995:19: (P= PLUS | S= SUB )? int alt50 = 3; int LA50_0 = input.LA(1); if ( (LA50_0 == PLUS) ) { alt50 = 1; } else if ( (LA50_0 == SUB) ) { alt50 = 2; } switch (alt50) { case 1 : // AS3_ex.g3:1995:20: P= PLUS { P=(IToken)Match(input,PLUS,FOLLOW_PLUS_in_bindingDeclArg6724); if (state.failed) return retval; if ( state.backtracking == 0 ) {P_tree = (object)adaptor.Create(P); adaptor.AddChild(root_0, P_tree); } if ( state.backtracking == 0 ) { emit(P); } } break; case 2 : // AS3_ex.g3:1995:41: S= SUB { S=(IToken)Match(input,SUB,FOLLOW_SUB_in_bindingDeclArg6732); if (state.failed) return retval; if ( state.backtracking == 0 ) {S_tree = (object)adaptor.Create(S); adaptor.AddChild(root_0, S_tree); } if ( state.backtracking == 0 ) { emit(S); } } break; } PushFollow(FOLLOW_numericLiteral_in_bindingDeclArg6739); numericLiteral89 = numericLiteral(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, numericLiteral89.Tree); } break; case 3 : // AS3_ex.g3:1995:79: ( eitherIdentifier (D= DOT eitherIdentifier )* ) { // AS3_ex.g3:1995:79: ( eitherIdentifier (D= DOT eitherIdentifier )* ) // AS3_ex.g3:1995:80: eitherIdentifier (D= DOT eitherIdentifier )* { PushFollow(FOLLOW_eitherIdentifier_in_bindingDeclArg6744); eitherIdentifier90 = eitherIdentifier(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, eitherIdentifier90.Tree); // AS3_ex.g3:1995:97: (D= DOT eitherIdentifier )* do { int alt51 = 2; int LA51_0 = input.LA(1); if ( (LA51_0 == DOT) ) { alt51 = 1; } switch (alt51) { case 1 : // AS3_ex.g3:1995:98: D= DOT eitherIdentifier { D=(IToken)Match(input,DOT,FOLLOW_DOT_in_bindingDeclArg6749); if (state.failed) return retval; if ( state.backtracking == 0 ) {D_tree = (object)adaptor.Create(D); adaptor.AddChild(root_0, D_tree); } if ( state.backtracking == 0 ) { emit(D); } PushFollow(FOLLOW_eitherIdentifier_in_bindingDeclArg6753); eitherIdentifier91 = eitherIdentifier(); state.followingStackPointer--; if (state.failed) return retval; if ( state.backtracking == 0 ) adaptor.AddChild(root_0, eitherIdentifier91.Tree); } break; default: goto loop51; } } while (true); loop51: ; // Stops C# compiler whining that label 'loop51' has no statements } } break; } } retval.Stop = input.LT(-1); if ( state.backtracking==0 ) { retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);} } catch (RecognitionException re) { ReportError(re); Recover(input,re); // Conversion of the second argument necessary, but harmless retval.Tree = (object)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re); } finally { if ( state.backtracking > 0 ) { Memoize(input, 42, bindingDeclArg_StartIndex); } } return retval; }