// $ANTLR start "primary_expression"
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1223:1: primary_expression returns [PrimaryExpression expression] : (id1= IDENTIFIER |id2= constant |id3= STRING_LITERAL | ( '(' exp= assignment_expression ')' ) );
public final PrimaryExpression primary_expression() throws RecognitionException {
PrimaryExpression expression = null;
Token id1=null;
Token id3=null;
ObjectiveCParser.constant_return id2 =null;
AssignmentExpression exp =null;
try {
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1225:2: (id1= IDENTIFIER |id2= constant |id3= STRING_LITERAL | ( '(' exp= assignment_expression ')' ) )
int alt84=4;
switch ( input.LA(1) ) {
case IDENTIFIER:
{
alt84=1;
}
break;
case CHARACTER_LITERAL:
case DECIMAL_LITERAL:
case FLOATING_POINT_LITERAL:
case HEX_LITERAL:
case OCTAL_LITERAL:
{
alt84=2;
}
break;
case STRING_LITERAL:
{
alt84=3;
}
break;
case 27:
{
alt84=4;
}
break;
default:
if (state.backtracking>0) {state.failed=true; return expression;}
NoViableAltException nvae =
new NoViableAltException("", 84, 0, input);
throw nvae;
}
switch (alt84) {
case 1 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1226:4: id1= IDENTIFIER
{
id1=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_primary_expression3679); if (state.failed) return expression;
if ( state.backtracking==0 ) {expression =new PrimaryExpression(null,-1,(id1!=null?id1.getText():null),RefType.IDENTIFIER);}
}
break;
case 2 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1227:4: id2= constant
{
pushFollow(FOLLOW_constant_in_primary_expression3688);
id2=constant();
state._fsp--;
if (state.failed) return expression;
if ( state.backtracking==0 ) {expression =new PrimaryExpression(null,-1,(id2!=null?input.toString(id2.start,id2.stop):null),RefType.CONSTANT);}
}
break;
case 3 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1228:4: id3= STRING_LITERAL
{
id3=(Token)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_primary_expression3697); if (state.failed) return expression;
if ( state.backtracking==0 ) {expression =new PrimaryExpression(null,-1,(id3!=null?id3.getText():null),RefType.STRING);}
}
break;
case 4 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1229:4: ( '(' exp= assignment_expression ')' )
{
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1229:4: ( '(' exp= assignment_expression ')' )
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1229:5: '(' exp= assignment_expression ')'
{
match(input,27,FOLLOW_27_in_primary_expression3705); if (state.failed) return expression;
pushFollow(FOLLOW_assignment_expression_in_primary_expression3709);
exp=assignment_expression();
state._fsp--;
if (state.failed) return expression;
match(input,28,FOLLOW_28_in_primary_expression3711); if (state.failed) return expression;
}
if ( state.backtracking==0 ) {expression =new PrimaryExpression(null,-1,exp);expression.setHasParanthesis(true);}
}
break;
}