Exemple #1
0
 sptr<SymFunc> Parser::ParseFunc(bool program)
 {
     Types t = currToken->type;
     if (program)
     {
         Expect(PROGRAM, -1);
     }
     else Expect(FUNCTION, PROCEDURE, -1);
     string name = currToken->lexeme;
     sptr<FuncSymType> functype(new FuncSymType(NextTable()));
     NextToken();
     Expect(OPENBRAC, -1);
     if (!MatchSkip(CLOSEBRAC, -1))
     {
         do
         {
             functype->PushArgs(ParseVarList(functype->symTable));
         } while (MatchSkip(SEMICOLON, -1));
         Expect(CLOSEBRAC, -1);
     }
     if (t == FUNCTION)
     {
         Expect(COLON, -1);
         functype->SetType(currSymTable->GetType(currToken->lexeme));
         NextToken();
     }
     else
     {
         functype->SetType(SymType::voidType);
     }
     Expect(SEMICOLON, -1);
     sptr<SymFunc> func(new SymFunc(name, functype, ParseBodyBlock()));
     LastTable()->Push(func);
     return func;
 }
// { ----- begin table iteration methods -----
NS_IMETHODIMP
morkPortTableCursor::NextTable( // get table at next position in the db
  nsIMdbEnv* mev, // context
  nsIMdbTable** acqTable)
{
  nsresult outErr = NS_OK;
  nsIMdbTable* outTable = 0;
  morkEnv* ev =
    CanUsePortTableCursor(mev, /*inMutable*/ morkBool_kFalse, &outErr);
  if ( ev )
  {
    morkTable* table = NextTable(ev);
    if ( table && ev->Good() )
      outTable = table->AcquireTableHandle(ev);
        
    outErr = ev->AsErr();
  }
  if ( acqTable )
    *acqTable = outTable;
  return outErr;
}