Column-oriented GPU-accelerated Database Management System
CoGaDB
|
00001 // Generated by Bisonc++ V2.09.03 on Sat, 08 Jun 2013 19:08:05 +0200 00002 00003 #ifndef ParserBase_h_included 00004 #define ParserBase_h_included 00005 00006 #include <vector> 00007 #include <iostream> 00008 00009 // $insert preincludes 00010 #include "cmath" 00011 00012 namespace // anonymous 00013 { 00014 struct PI__; 00015 } 00016 00017 00018 class ParserBase 00019 { 00020 public: 00021 // $insert tokens 00022 00023 // Symbolic tokens: 00024 enum Tokens__ 00025 { 00026 NUM = 257, 00027 NEG, 00028 }; 00029 00030 // $insert STYPE 00031 typedef double STYPE__; 00032 00033 00034 private: 00035 int d_stackIdx__; 00036 std::vector<size_t> d_stateStack__; 00037 std::vector<STYPE__> d_valueStack__; 00038 00039 protected: 00040 enum Return__ 00041 { 00042 PARSE_ACCEPT__ = 0, // values used as parse()'s return values 00043 PARSE_ABORT__ = 1 00044 }; 00045 enum ErrorRecovery__ 00046 { 00047 DEFAULT_RECOVERY_MODE__, 00048 UNEXPECTED_TOKEN__, 00049 }; 00050 bool d_debug__; 00051 size_t d_nErrors__; 00052 size_t d_requiredTokens__; 00053 size_t d_acceptedTokens__; 00054 int d_token__; 00055 int d_nextToken__; 00056 size_t d_state__; 00057 STYPE__ *d_vsp__; 00058 STYPE__ d_val__; 00059 STYPE__ d_nextVal__; 00060 00061 ParserBase(); 00062 00063 void ABORT() const; 00064 void ACCEPT() const; 00065 void ERROR() const; 00066 void clearin(); 00067 bool debug() const; 00068 void pop__(size_t count = 1); 00069 void push__(size_t nextState); 00070 void popToken__(); 00071 void pushToken__(int token); 00072 void reduce__(PI__ const &productionInfo); 00073 void errorVerbose__(); 00074 size_t top__() const; 00075 00076 public: 00077 void setDebug(bool mode); 00078 }; 00079 00080 inline bool ParserBase::debug() const 00081 { 00082 return d_debug__; 00083 } 00084 00085 inline void ParserBase::setDebug(bool mode) 00086 { 00087 d_debug__ = mode; 00088 } 00089 00090 inline void ParserBase::ABORT() const 00091 { 00092 throw PARSE_ABORT__; 00093 } 00094 00095 inline void ParserBase::ACCEPT() const 00096 { 00097 throw PARSE_ACCEPT__; 00098 } 00099 00100 inline void ParserBase::ERROR() const 00101 { 00102 throw UNEXPECTED_TOKEN__; 00103 } 00104 00105 00106 // As a convenience, when including ParserBase.h its symbols are available as 00107 // symbols in the class Parser, too. 00108 #define Parser ParserBase 00109 00110 00111 #endif 00112 00113