// $ANTLR start "unary_expression"
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1187:1: unary_expression returns [UnaryExpression expression] : (exp= postfix_expression | '++' exp= unary_expression | '--' exp= unary_expression |op= unary_operator exp= cast_expression );
public final UnaryExpression unary_expression() throws RecognitionException {
UnaryExpression expression = null;
Expression exp =null;
UnarySymbol op =null;
UnarySymbol operator=null;
try {
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1192:2: (exp= postfix_expression | '++' exp= unary_expression | '--' exp= unary_expression |op= unary_operator exp= cast_expression )
int alt82=4;
switch ( input.LA(1) ) {
case CHARACTER_LITERAL:
case DECIMAL_LITERAL:
case FLOATING_POINT_LITERAL:
case HEX_LITERAL:
case IDENTIFIER:
case OCTAL_LITERAL:
case STRING_LITERAL:
case 27:
{
alt82=1;
}
break;
case 32:
{
alt82=2;
}
break;
case 36:
{
alt82=3;
}
break;
case 20:
case 25:
case 29:
case 35:
case 98:
{
alt82=4;
}
break;
default:
if (state.backtracking>0) {state.failed=true; return expression;}
NoViableAltException nvae =
new NoViableAltException("", 82, 0, input);
throw nvae;
}
switch (alt82) {
case 1 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1193:4: exp= postfix_expression
{
pushFollow(FOLLOW_postfix_expression_in_unary_expression3534);
exp=postfix_expression();
state._fsp--;
if (state.failed) return expression;
if ( state.backtracking==0 ) {expression =new UnaryExpression(null,-1,null,(Expression)exp);}
}
break;
case 2 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1194:4: '++' exp= unary_expression
{
match(input,32,FOLLOW_32_in_unary_expression3541); if (state.failed) return expression;
pushFollow(FOLLOW_unary_expression_in_unary_expression3545);
exp=unary_expression();
state._fsp--;
if (state.failed) return expression;
if ( state.backtracking==0 ) {expression =new UnaryExpression(null,-1,UnarySymbol.PRE_INC,(Expression)exp);}
}
break;
case 3 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1195:4: '--' exp= unary_expression
{
match(input,36,FOLLOW_36_in_unary_expression3553); if (state.failed) return expression;
pushFollow(FOLLOW_unary_expression_in_unary_expression3557);
exp=unary_expression();
state._fsp--;
if (state.failed) return expression;
if ( state.backtracking==0 ) {expression =new UnaryExpression(null,-1,UnarySymbol.PRE_DEC,(Expression)exp);}
}
break;
case 4 :
// C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:1196:4: op= unary_operator exp= cast_expression
{
pushFollow(FOLLOW_unary_operator_in_unary_expression3567);
op=unary_operator();
state._fsp--;
if (state.failed) return expression;
if ( state.backtracking==0 ) {operator=op;}
pushFollow(FOLLOW_cast_expression_in_unary_expression3572);
exp=cast_expression();
state._fsp--;
if (state.failed) return expression;
if ( state.backtracking==0 ) {expression =new UnaryExpression(null,-1,operator,(Expression)exp);}
}
break;
}