// -*- Mode: C++ -*- // // Pretty Printer, Copyright (C) Richard C. Bilson and Rodolfo G. Esteves 2001 // // parse.h - Various declarations that are needed so that the generated parser // and lexer compile with C++, and to share information between the // parser, lexer, and driver program // // Author : Richard C. Bilson and Rodolfo G. Esteves // Created On : Sun Dec 16 15:00:49 2001 // Last Modified By : Peter A. Buhr // Last Modified On : Tue Dec 17 10:55:31 2002 // Update Count : 163 // #ifndef __PARSE_H__ #define __PARSE_H__ #define YYDEBUG_LEXER_TEXT( yylval ) // lexer loads this up each time #define YYDEBUG 1 // get the pretty debugging code to compile int yylex(); #include #include #include using std::cout; using std::cerr; using std::endl; using std::string; using std::list; struct Token { string text; // text of terminal or non-terminal token int kind; // kind of terminal or non-terminal token list ws_list; // list of whitespace and comments before terminal token Token *left, *down; // binary parse tree links Token( const string &, int ); Token( const string &, list &, int ); void addLeftTail( Token * ); void addDownLeftTail( Token * ); bool isTerminal(); int getKind() const; string getText() const; string getWS(); bool isComment(); string getComment(); }; #endif /* __PARSE_H__ */ // Local Variables: // // compile-command: "gmake" // // End: //