Intended usage:
parser reader;
ifstream input_file1, input_file2;
// read the first file...
ex e1 = reader(input_file1);
// ... add extra entry into the symbol table used by parser
symbol x;
parser.get_syms()["x"] = x;
// Disable the parser to introduce new symbols, e.g. to ensure the expression
// in input_file2 contains the same symbols as e1 (read from input_file1).
parser.strict = true;
ex e2;
try {
e2 = reader(input_file2);
} catch (...) {
abort();
}
{
return syms;
}
+ /// read/write access to the symbol table
+ symtab& get_syms()
+ {
+ return syms;
+ }
-private:
/// If true, throw an exception if an unknown symbol is encountered.
- const bool strict;
+ bool strict;
+private:
/**
* Function/ctor table, maps a prototype (which is a name and number
* arguments) to a C++ function. Used for parsing identifier_expr's