public ES3Parser.arrayItem_return arrayItem() // throws RecognitionException [1]
{
ES3Parser.arrayItem_return retval = new ES3Parser.arrayItem_return();
retval.Start = input.LT(1);
object root_0 = null;
ES3Parser.assignmentExpression_return expr = default(ES3Parser.assignmentExpression_return);
try
{
// C:\\Users\\s.ros\\Projets\\Jint\\Jint\\ES3.g:994:2: ( (expr= assignmentExpression | {...}? | {...}?) )
// C:\\Users\\s.ros\\Projets\\Jint\\Jint\\ES3.g:994:4: (expr= assignmentExpression | {...}? | {...}?)
{
root_0 = (object)adaptor.GetNilNode();
// C:\\Users\\s.ros\\Projets\\Jint\\Jint\\ES3.g:994:4: (expr= assignmentExpression | {...}? | {...}?)
int alt9 = 3;
switch ( input.LA(1) )
{
case NULL:
case TRUE:
case FALSE:
case DELETE:
case FUNCTION:
case NEW:
case THIS:
case TYPEOF:
case VOID:
case LBRACE:
case LPAREN:
case LBRACK:
case ADD:
case SUB:
case INC:
case DEC:
case NOT:
case INV:
case Identifier:
case StringLiteral:
case RegularExpressionLiteral:
case DecimalLiteral:
case OctalIntegerLiteral:
case HexIntegerLiteral:
{
alt9 = 1;
}
break;
case COMMA:
{
int LA9_2 = input.LA(2);
if ( (( input.LA(1) == COMMA )) )
{
alt9 = 2;
}
else if ( (( input.LA(1) == RBRACK )) )
{
alt9 = 3;
}
else
{
NoViableAltException nvae_d9s2 =
new NoViableAltException("", 9, 2, input);
throw nvae_d9s2;
}
}
break;
case RBRACK:
{
int LA9_3 = input.LA(2);
if ( (( input.LA(1) == COMMA )) )
{
alt9 = 2;
}
else if ( (( input.LA(1) == RBRACK )) )
{
alt9 = 3;
}
else
{
NoViableAltException nvae_d9s3 =
new NoViableAltException("", 9, 3, input);
throw nvae_d9s3;
}
}
break;
default:
NoViableAltException nvae_d9s0 =
new NoViableAltException("", 9, 0, input);
throw nvae_d9s0;
}
switch (alt9)
{
case 1 :
// C:\\Users\\s.ros\\Projets\\Jint\\Jint\\ES3.g:994:6: expr= assignmentExpression
{
PushFollow(FOLLOW_assignmentExpression_in_arrayItem3300);
expr = assignmentExpression();
state.followingStackPointer--;
adaptor.AddChild(root_0, expr.Tree);
retval.value = expr.value;
}
break;
case 2 :
// C:\\Users\\s.ros\\Projets\\Jint\\Jint\\ES3.g:994:60: {...}?
{
if ( !(( input.LA(1) == COMMA )) )
{
throw new FailedPredicateException(input, "arrayItem", " input.LA(1) == COMMA ");
}
retval.value = new Identifier("undefined");
}
break;
case 3 :
// C:\\Users\\s.ros\\Projets\\Jint\\Jint\\ES3.g:994:130: {...}?
{
if ( !(( input.LA(1) == RBRACK )) )
{
throw new FailedPredicateException(input, "arrayItem", " input.LA(1) == RBRACK ");
}
retval.value = null;
}
break;
}
}
retval.Stop = input.LT(-1);
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
{
}
return retval;
}
// $ANTLR end "arrayItem"