#ifndef CALCULATOR_DRIVER_HH
#define CALCULATOR_DRIVER_HH

#include <string>
#include <map>

// Forward declarations.
union YYSTYPE;
namespace yy
{
  class location;
  class Calculator_parser;
}
class Calculator_driver;

// Announce to Flex the prototype we want for lexing function, ...
# define YY_DECL						 \
	int yylex (YYSTYPE* yylval, yy::location* yylloc, Calculator_driver & driver)
// ... and declare it for the parser's sake.
YY_DECL;

// Conducting the whole scanning and parsing of Calc++.
class Calculator_driver
{
public:
	Calculator_driver ();
	virtual ~Calculator_driver ();

	std::map<std::string, int> variables;

	int result;

	// Handling the scanner.
	void scan_begin ();
	void scan_end ();
	bool trace_scanning;

	// Handling the parser.
	void parse (const std::string & f);
	std::string file;
	bool trace_parsing;

	// Error handling.
	void error (const yy::location & l, const std::string & m);
	void error (const std::string & m);
};
#endif // ! CALCULATOR_DRIVER_HH
