105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#line 10146 "../../doc/bison.texi"
205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include "calc++-driver.hh"
305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include "calc++-parser.hh"
405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
505436638acc7c010349a69c3395f1a57c642dc62Ying Wangcalcxx_driver::calcxx_driver ()
605436638acc7c010349a69c3395f1a57c642dc62Ying Wang  : trace_scanning (false), trace_parsing (false)
705436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
805436638acc7c010349a69c3395f1a57c642dc62Ying Wang  variables["one"] = 1;
905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  variables["two"] = 2;
1005436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
1105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1205436638acc7c010349a69c3395f1a57c642dc62Ying Wangcalcxx_driver::~calcxx_driver ()
1305436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
1405436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
1505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1605436638acc7c010349a69c3395f1a57c642dc62Ying Wangint
1705436638acc7c010349a69c3395f1a57c642dc62Ying Wangcalcxx_driver::parse (const std::string &f)
1805436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
1905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  file = f;
2005436638acc7c010349a69c3395f1a57c642dc62Ying Wang  scan_begin ();
2105436638acc7c010349a69c3395f1a57c642dc62Ying Wang  yy::calcxx_parser parser (*this);
2205436638acc7c010349a69c3395f1a57c642dc62Ying Wang  parser.set_debug_level (trace_parsing);
2305436638acc7c010349a69c3395f1a57c642dc62Ying Wang  int res = parser.parse ();
2405436638acc7c010349a69c3395f1a57c642dc62Ying Wang  scan_end ();
2505436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return res;
2605436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
2705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2805436638acc7c010349a69c3395f1a57c642dc62Ying Wangvoid
2905436638acc7c010349a69c3395f1a57c642dc62Ying Wangcalcxx_driver::error (const yy::location& l, const std::string& m)
3005436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
3105436638acc7c010349a69c3395f1a57c642dc62Ying Wang  std::cerr << l << ": " << m << std::endl;
3205436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
3305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3405436638acc7c010349a69c3395f1a57c642dc62Ying Wangvoid
3505436638acc7c010349a69c3395f1a57c642dc62Ying Wangcalcxx_driver::error (const std::string& m)
3605436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
3705436638acc7c010349a69c3395f1a57c642dc62Ying Wang  std::cerr << m << std::endl;
3805436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
39