2015-10-28 20:37:12 +01:00
|
|
|
#ifndef EVAL_CONTEXT_H
|
|
|
|
#define EVAL_CONTEXT_H
|
2015-10-28 20:13:59 +01:00
|
|
|
# include <string>
|
|
|
|
# include <map>
|
|
|
|
# include "parser.h"
|
|
|
|
|
|
|
|
// Tell Flex the lexer's prototype ...
|
|
|
|
# define YY_DECL \
|
2015-10-28 20:53:40 +01:00
|
|
|
isc::eval::EvalParser::symbol_type yylex (EvalContext& driver)
|
2015-10-28 20:13:59 +01:00
|
|
|
|
|
|
|
// ... and declare it for the parser's sake.
|
|
|
|
YY_DECL;
|
|
|
|
|
|
|
|
// Conducting the whole scanning and parsing of Calc++.
|
2015-10-28 20:37:12 +01:00
|
|
|
class EvalContext
|
2015-10-28 20:13:59 +01:00
|
|
|
{
|
|
|
|
public:
|
2015-10-28 20:37:12 +01:00
|
|
|
EvalContext ();
|
|
|
|
virtual ~EvalContext ();
|
2015-10-28 20:13:59 +01:00
|
|
|
|
2015-10-29 01:02:57 +01:00
|
|
|
isc::dhcp::Expression expression;
|
2015-10-28 20:13:59 +01:00
|
|
|
|
|
|
|
int result;
|
|
|
|
|
|
|
|
// Handling the scanner.
|
|
|
|
void scan_begin ();
|
|
|
|
void scan_end ();
|
|
|
|
bool trace_scanning;
|
|
|
|
|
|
|
|
// Run the parser on file F.
|
|
|
|
// Return 0 on success.
|
2015-10-28 20:37:12 +01:00
|
|
|
int parseFile(const std::string& filename);
|
|
|
|
|
|
|
|
int parseString(const std::string& str);
|
2015-10-28 20:13:59 +01:00
|
|
|
|
|
|
|
// The name of the file being parsed.
|
|
|
|
// Used later to pass the file name to the location tracker.
|
|
|
|
|
|
|
|
std::string file;
|
|
|
|
// Whether parser traces should be generated.
|
|
|
|
bool trace_parsing;
|
|
|
|
|
|
|
|
// Error handling.
|
2015-10-28 20:53:40 +01:00
|
|
|
void error (const isc::eval::location& l, const std::string& m);
|
2015-10-28 20:13:59 +01:00
|
|
|
void error (const std::string& m);
|
|
|
|
};
|
2015-10-28 20:37:12 +01:00
|
|
|
#endif // ! EVALCONTEXT_HH
|