• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #line 10146 "../../doc/bison.texi"
2 #include "calc++-driver.hh"
3 #include "calc++-parser.hh"
4 
calcxx_driver()5 calcxx_driver::calcxx_driver ()
6   : trace_scanning (false), trace_parsing (false)
7 {
8   variables["one"] = 1;
9   variables["two"] = 2;
10 }
11 
~calcxx_driver()12 calcxx_driver::~calcxx_driver ()
13 {
14 }
15 
16 int
parse(const std::string & f)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   int res = parser.parse ();
24   scan_end ();
25   return res;
26 }
27 
28 void
error(const yy::location & l,const std::string & m)29 calcxx_driver::error (const yy::location& l, const std::string& m)
30 {
31   std::cerr << l << ": " << m << std::endl;
32 }
33 
34 void
error(const std::string & m)35 calcxx_driver::error (const std::string& m)
36 {
37   std::cerr << m << std::endl;
38 }
39