source: tools/prettyprinter/parse.h@ fda8168

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since fda8168 was fda8168, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

format tool for pretty printing grammar

  • Property mode set to 100644
File size: 1.5 KB
Line 
1// -*- Mode: C++ -*-
2//
3// Pretty Printer, Copyright (C) Richard C. Bilson and Rodolfo G. Esteves 2001
4//
5// parse.h - Various declarations that are needed so that the generated parser
6// and lexer compile with C++, and to share information between the
7// parser, lexer, and driver program
8//
9// Author : Richard C. Bilson and Rodolfo G. Esteves
10// Created On : Sun Dec 16 15:00:49 2001
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Tue Dec 17 10:55:31 2002
13// Update Count : 163
14//
15
16#ifndef __PARSE_H__
17#define __PARSE_H__
18
19#define YYDEBUG_LEXER_TEXT( yylval ) // lexer loads this up each time
20#define YYDEBUG 1 // get the pretty debugging code to compile
21
22int yylex();
23
24#include <iostream>
25#include <string>
26#include <list>
27
28using std::cout;
29using std::cerr;
30using std::endl;
31using std::string;
32using std::list;
33
34struct Token {
35 string text; // text of terminal or non-terminal token
36 int kind; // kind of terminal or non-terminal token
37 list<string> ws_list; // list of whitespace and comments before terminal token
38 Token *left, *down; // binary parse tree links
39
40 Token( const string &, int );
41 Token( const string &, list<string> &, int );
42 void addLeftTail( Token * );
43 void addDownLeftTail( Token * );
44 bool isTerminal();
45 int getKind() const;
46 string getText() const;
47 string getWS();
48 bool isComment();
49 string getComment();
50};
51
52#endif /* __PARSE_H__ */
53
54
55// Local Variables: //
56// compile-command: "gmake" //
57// End: //
Note: See TracBrowser for help on using the repository browser.