4
#include "PQLQueryParser.parser.hpp"
5
#define SAVE_TOKEN pqlqlval.string = new std::string(pqlqtext, pqlqleng)
6
#define TOKEN(t) (pqlqlval.token = t)
7
extern "C" int pqlqwrap(){return 1;}
8
extern PetriEngine::PQL::Condition* query;
9
extern int pqlqparse();
20
"and" {return TOKEN(AND);}
21
"AND" {return TOKEN(AND);}
22
"or" {return TOKEN(OR);}
23
"OR" {return TOKEN(OR);}
24
"not" {return TOKEN(NOT);}
25
"NOT" {return TOKEN(NOT);}
26
{letter}({letter}|{digit})* {SAVE_TOKEN; return ID;}
27
{digit}+ {SAVE_TOKEN; return INT;}
28
"&&" {return TOKEN(AND);}
29
"||" {return TOKEN(OR);}
30
"!" {return TOKEN(NOT);}
31
"==" {return TOKEN(EQUAL);}
32
"!=" {return TOKEN(NEQUAL);}
33
"<" {return TOKEN(LESS);}
34
"<=" {return TOKEN(LESSEQUAL);}
35
">" {return TOKEN(GREATER);}
36
">=" {return TOKEN(GREATEREQUAL);}
37
"(" {return TOKEN(LPAREN);}
38
")" {return TOKEN(RPAREN);}
39
"+" {return TOKEN(PLUS);}
40
"-" {return TOKEN(MINUS);}
41
"*" {return TOKEN(MULTIPLY);}
42
"=" {return TOKEN(EQUAL);}
43
. {printf("Unknown token %s!\n", pqlqtext); yyterminate();}
46
namespace PetriEngine{ namespace PQL {
47
Condition* ParseQuery(const std::string& queryString) {
50
//Load up input buffer in Flex
51
YY_BUFFER_STATE buf = pqlq_scan_string(queryString.c_str());
57
pqlq_delete_buffer(buf);