/*
* declOuter presumes that class & type have already been parsed
* this is done to distinguish between a function declaration and a
* variable declaration
*/
void declOuter(Var e)
{
#if DEBUG
Console.WriteLine("declOuter1 token=[" + tok + "]\n");
#endif
e.setName(tok.getValue()); /* use value as the variable name */
addOuter(e); /* add this variable */
emit.FieldDef(e); /* issue the declaration */
if (e.getClassId() == Tok.T_DEFCLASS)
{
e.setClassId(Tok.T_STATIC); /* make sure it knows its storage class */
}
/*
* loop while there are additional variable names
*/
while (io.getNextChar() == ',')
{
tok.scan();
if (tok.getFirstChar() != ',')
{
io.Abort("Expected ','");
}
tok.scan();
if (tok.getId() != Tok.T_IDENT)
{
io.Abort("Expected identifier");
}
e.setName(tok.getValue()); /* use value as the variable name */
addOuter(e); /* add this variable */
emit.FieldDef(e); /* issue the declaration */
if (e.getClassId() == Tok.T_DEFCLASS)
{
e.setClassId(Tok.T_STATIC); /* make sure it knows its storage class */
}
}
/*
* move beyond end of statement indicator
*/
tok.scan();
if (tok.getFirstChar() != ';')
{
io.Abort("Expected ';'");
}
CommentFill();
tok.scan();
#if DEBUG
Console.WriteLine("declOuter2 token=[" + tok + "]\n");
#endif
}