5
#include "LTL/SuccessorGeneration/Heuristics.h"
6
#include "LTL/Structures/BuchiAutomaton.h"
7
#include "HeuristicParser.parser.hpp"
9
#define SAVE_TOKEN heurlval.string = new std::string(heurtext, heurleng)
10
#define SAVE_QUOTED_TOKEN heurlval.string = new std::string(heurtext+1, heurleng-2)
11
#define TOKEN(t) (heurlval.token = t)
14
#pragma clang diagnostic push
15
#pragma clang diagnostic ignored "-Wkeyword-macro"
16
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
19
#define register // Deprecated in C++11.
20
extern "C" int heurwrap(){return 1;}
21
extern std::unique_ptr<LTL::Heuristic> heuristic;
22
extern int heurparse();
32
"aut" {return TOKEN(AUT);}
33
"automaton" {return TOKEN(AUT);}
34
"dist" {return TOKEN(DIST);}
35
"distance" { return TOKEN(DIST); }
36
"fc" { return TOKEN(FIRECOUNT); }
37
"firecount" { return TOKEN(FIRECOUNT); }
38
"fire-count" { return TOKEN(FIRECOUNT); }
39
"fire" { return TOKEN(FIRECOUNT); }
40
"sum" { return TOKEN(SUM);}
41
"(" {return TOKEN(LPAREN);}
42
")" {return TOKEN(RPAREN);}
43
{letter}({letter}|{digit})* {SAVE_TOKEN; return TEXT;}
44
{digit}+ {SAVE_TOKEN; return INT;}
45
"," { return TOKEN(COMMA);}
48
std::unique_ptr<LTL::Heuristic> ParseHeuristic(const PetriEngine::PetriNet *net,
49
const Structures::BuchiAutomaton &aut,
50
const PetriEngine::PQL::Condition_ptr &cond,
51
const char* heurString) {
52
//Load up input buffer in Flex
53
YY_BUFFER_STATE buf = heur_scan_string(heurString);
55
if(heurparse(net, aut, cond) != 0)
59
heur_delete_buffer(buf);
60
return std::move(heuristic);
64
#pragma clang diagnostic pop