Пример #1
0
void stat()
{
  /*
    stat -> [ AssignStat | ProcCall | IfStat | CaseStat | WhileStat | 
              RepeatStat | ForStat ]
  */

  if ( debugMode) printf( "In stat\n");
  if ( sym == IF_SYM)
  {
    IfStat();
  }
  else if ( sym == CASE_SYM)
  {
    CaseStat();
  }
  else if ( sym == WHILE_SYM)
  {
    WhileStat();
  }
  else if ( sym == REPEAT_SYM)
  {
    RepeatStat();
  }
  else if ( sym == FOR_SYM)
  {
    ForStat();
  }
  else if ( sym == ident)
  {
    designator();
    if ( sym == assign)
    {
      // then it was AssignStat
      writesym();
      nextsym();
      expr();
    }
    else 
    {
      // then it was ProcCall
      if ( sym == lparen)
      {
        ActParams();
      }
    }
  }
  if ( debugMode) printf( "Out stat\n");
}
 FileStat::FileStat (util::String const & str, util::Loc const & loc, bool insert)
   : lexer (str, loc), realname (loc.getFilename ().getRealName ()), insert (insert), status (FILE_START)
   {
     // OK to use null location (only used if missing #endif, so in that case we'll always have pushed a location)
     is_stack.push_back (IfStat (util::Loc (), ON_RS, NONE_SS, false));
   }