protected Declaration declaration()
{
Declaration d;
IToken id = null;
d = null;
TypeReference tr = null;
try { // for error handling
id = LT(1);
match(ID);
{
switch ( LA(1) )
{
case AS:
{
match(AS);
tr=type_reference();
break;
}
case IN:
case ASSIGN:
case COMMA:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if (0==inputState.guessing)
{
d = new Declaration(ToLexicalInfo(id));
d.Name = id.getText();
d.Type = tr;
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex, "declaration");
recover(ex,tokenSet_92_);
}
else
{
throw ex;
}
}
return d;
}