protected Expression callable_expression()
{
Expression e;
IToken doAnchor = null;
IToken defAnchor = null;
e = null;
Block body = null;
BlockExpression cbe = null;
TypeReference rt = null;
IToken anchor = null;
try { // for error handling
switch ( LA(1) )
{
case COLON:
{
{
if (0==inputState.guessing)
{
body = new Block();
}
compound_stmt(body);
if (0==inputState.guessing)
{
e = new BlockExpression(body.LexicalInfo, body);
}
}
break;
}
case DEF:
case DO:
{
{
{
switch ( LA(1) )
{
case DO:
{
{
doAnchor = LT(1);
match(DO);
if (0==inputState.guessing)
{
anchor = doAnchor;
}
}
break;
}
case DEF:
{
{
defAnchor = LT(1);
match(DEF);
if (0==inputState.guessing)
{
anchor = defAnchor;
}
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if (0==inputState.guessing)
{
e = cbe = new BlockExpression(ToLexicalInfo(anchor));
body = cbe.Body;
}
{
switch ( LA(1) )
{
case LPAREN:
{
match(LPAREN);
parameter_declaration_list(cbe.Parameters);
match(RPAREN);
{
switch ( LA(1) )
{
case AS:
{
match(AS);
rt=type_reference();
if (0==inputState.guessing)
{
cbe.ReturnType = rt;
}
break;
}
case COLON:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
break;
}
case COLON:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
compound_stmt(body);
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex, "callable_expression");
recover(ex,tokenSet_22_);
}
else
{
throw ex;
}
}
return e;
}