protected void callable_definition(
TypeMemberCollection container
)
{
IToken id = null;
CallableDefinition cd = null;
TypeReference returnType = null;
GenericParameterDeclarationCollection genericParameters = null;
try { // for error handling
match(CALLABLE);
id = LT(1);
match(ID);
if (0==inputState.guessing)
{
cd = new CallableDefinition(ToLexicalInfo(id));
cd.Name = id.getText();
cd.Modifiers = _modifiers;
AddAttributes(cd.Attributes);
container.Add(cd);
genericParameters = cd.GenericParameters;
}
{
switch ( LA(1) )
{
case LBRACK:
{
match(LBRACK);
{
switch ( LA(1) )
{
case OF:
{
match(OF);
break;
}
case ID:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
generic_parameter_declaration_list(genericParameters);
match(RBRACK);
break;
}
case LPAREN:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
match(LPAREN);
parameter_declaration_list(cd.Parameters);
match(RPAREN);
{
switch ( LA(1) )
{
case AS:
{
match(AS);
returnType=type_reference();
if (0==inputState.guessing)
{
cd.ReturnType=returnType;
}
break;
}
case EOL:
case EOS:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
eos();
docstring(cd);
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex, "callable_definition");
recover(ex,tokenSet_22_);
}
else
{
throw ex;
}
}
}