| 1 |
// Generated by Bisonc++ V5.00.00 on Wed, 06 Apr 2016 13:41:57 +0530 |
| 2 |
|
| 3 |
#ifndef Parser_h_included |
| 4 |
#define Parser_h_included |
| 5 |
|
| 6 |
// added for mfcalc's memory |
| 7 |
#include <unordered_map> |
| 8 |
#include <string> |
| 9 |
|
| 10 |
// $insert baseclass |
| 11 |
#include "Parserbase.h" |
| 12 |
|
| 13 |
|
| 14 |
#undef Parser |
| 15 |
class Parser: public ParserBase |
| 16 |
{ |
| 17 |
using FunctionPair = std::pair<char const *, double (*)(double)>; |
| 18 |
|
| 19 |
std::unordered_map<std::string, double> d_symbols; |
| 20 |
|
| 21 |
static std::unordered_map<std::string, double (*)(double)> s_functions; |
| 22 |
static FunctionPair s_funTab[]; |
| 23 |
|
| 24 |
|
| 25 |
public: |
| 26 |
int parse(); |
| 27 |
|
| 28 |
private: |
| 29 |
void error(); // called on (syntax) errors |
| 30 |
int lex(); // returns the next token from the |
| 31 |
// lexical scanner. |
| 32 |
void print(); // use, e.g., d_token, d_loc |
| 33 |
|
| 34 |
void exceptionHandler(std::exception const &exc); |
| 35 |
|
| 36 |
// support functions for parse(): |
| 37 |
void executeAction_(int ruleNr); |
| 38 |
void errorRecovery_(); |
| 39 |
void nextCycle_(); |
| 40 |
void nextToken_(); |
| 41 |
void print_(); |
| 42 |
}; |
| 43 |
|
| 44 |
|
| 45 |
#endif |