#include "Calculator_driver.hpp"
#include "Calculator.y.hpp"

Calculator_driver::Calculator_driver () : trace_scanning (false), trace_parsing (false)
{
	variables["one"] = 1;
	variables["two"] = 2;
}

Calculator_driver::~Calculator_driver ()
{
}

void Calculator_driver::parse (const std::string & f)
{
	file = f;
	scan_begin ();
	yy::Calculator_parser parser (*this);
	parser.set_debug_level (trace_parsing);
	parser.parse ();
	scan_end ();
}

void Calculator_driver::error (const yy::location & l, const std::string & m)
{
	std::cerr << l << ": " << m << std::endl;
}

void Calculator_driver::error (const std::string & m)
{
	std::cerr << m << std::endl;
}
