LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
tiger-parser.hh
Go to the documentation of this file.
1 
6 #ifndef PARSE_TIGER_PARSER_HH
7 # define PARSE_TIGER_PARSER_HH
8 
9 # include <memory>
10 # include <map>
11 # include <stack>
12 # include <common.hh>
13 # include <misc/error.hh>
14 # include <misc/path.hh>
15 # include <misc/file-library.hh>
16 # include <ast/fwd.hh>
17 # include <parse/parsetiger.hh>
18 # include <parse/tweast.hh>
19 
20 // Announce to Bison the lexing function it must use.
21 // Unfortunately, SWIG 2.0.7 cannot parse this declaration.
22 #ifndef SWIG
23  YY_DECL_ ();
24 #endif
25 
26 namespace parse
27 {
28 
31  {
32  public:
36 
38 
39  virtual ~TigerParser();
40 
41  friend class parser;
42  // SWIG can't parse this declaration either!
43 #ifndef SWIG
44  friend YY_DECL_(::);
45 #endif
46 
48  ast_type parse_file(const std::string& name);
50  ast_type parse(Tweast& s);
52  ast_type parse(const std::string& s);
53 
55  ast::DecsList* parse_import(const std::string& name,
56  const location& loc);
57 
59  const misc::error& error_get() const;
60 
62  const char* prelude() const;
63 
65  TigerParser& scan_trace(bool b = true);
66 
68  TigerParser& parse_trace(bool b = true);
69 
71  TigerParser& enable_object_extensions (bool b = true);
72 
74  TigerParser& enable_extensions(bool b = true);
75 
76  private:
80  std::unique_ptr<yyFlexLexer> scanner_;
81 
84 
86  std::map<std::string, location> open_files_;
88 
92  ast_type parse_();
93 
97  ast_type parse_input(Tweast& input, bool extensions);
98 
100  ast::DecsList* parse_prelude(const std::string& f);
101 
102  public:
110 
112  location location_;
121  };
122 
123 }
124 
125 #endif // !PARSE_TIGER_PARSER_HH