#include "stdafx.h" #include "example.h" #include "lex.h" #include "out.h" #include void PutStd (std::string s) { PutStr (const_cast (s.c_str ())); } void object () { // if (sy != IDENT) // Error ("Identifier expected"); // NextSymbol (); std::string type = IdentVal; CheckSymbol (IDENT); PutStd ("begin of " + type); PutEol (); Indent (); CheckSymbol (LBRACE); while (sy != RBRACE) { std::string name = IdentVal; CheckSymbol (IDENT); CheckSymbol (ASSIGN); std::string value = NumVal; CheckSymbol (NUM); CheckSymbol (SEMICOLON); PutStd (name + " is " + value); PutEol (); } Unindent (); CheckSymbol (RBRACE); PutStd ("end of " + type); PutEol (); } void example () { while (sy!=EOS) { object (); } }