Category : Files from Magazines
Archive   : CUJ9405.ZIP
Filename : PARSE.CPP

 
Output of file : PARSE.CPP contained in archive : CUJ9405.ZIP

Listing 7: Function parse() of Pif

BOOL Pif::parse()
{
Token * pTemp;

// create a expression object
Pexpression * pTempExpression = new Pexpression;
if (pTempExpression == NULL) // check out of memory
return FALSE;
else
{ pTempExpression->parse(); // parse an expression
delete pTempExpression; // clean up
} // test for the expression syntax

pTemp = gpTokenizer->getToken(); // get a new token

if (pTemp->tokentype == tkthen) // check for the token then
{
pTemp = gpTokenizer->lookToken();

while ((pTemp->tokentype != tkelse) && // loop to parse statements
(pTemp->tokentype != tkendif) && // after the token then
(!gpTokenizer->eof()) )
{
// create a statement object
Pstatement * pMyStatement = new Pstatement;
if (pMyStatement == NULL) // check out of memory
return FALSE;
else
{ pMyStatement->parse(); // call the parse function
delete pMyStatement; // clean up
}
pTemp = gpTokenizer->peekToken(); // look ahead token
}
}
else ; //output error message
}



  3 Responses to “Category : Files from Magazines
Archive   : CUJ9405.ZIP
Filename : PARSE.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/