]> git.saurik.com Git - bison.git/blob - examples/calc++/calc++-driver.cc
cfce494dad68ef6cad6bbeee04d38b24a18ae4f3
[bison.git] / examples / calc++ / calc++-driver.cc
1 #line 7140 "../../doc/bison.texinfo"
2 #include "calc++-driver.hh"
3 #include "calc++-parser.hh"
4
5 calcxx_driver::calcxx_driver ()
6 : trace_scanning (false), trace_parsing (false)
7 {
8 variables["one"] = 1;
9 variables["two"] = 2;
10 }
11
12 calcxx_driver::~calcxx_driver ()
13 {
14 }
15
16 void
17 calcxx_driver::parse (const std::string &f)
18 {
19 file = f;
20 scan_begin ();
21 yy::calcxx_parser parser (*this);
22 parser.set_debug_level (trace_parsing);
23 parser.parse ();
24 scan_end ();
25 }
26
27 void
28 calcxx_driver::error (const yy::location& l, const std::string& m)
29 {
30 std::cerr << l << ": " << m << std::endl;
31 }
32
33 void
34 calcxx_driver::error (const std::string& m)
35 {
36 std::cerr << m << std::endl;
37 }