PromelaParser.h
Go to the documentation of this file.
1 
20 // bison -v promela.ypp && flex promela.l
21 
22 #ifndef PROMELA_H_9AB78YB1
23 #define PROMELA_H_9AB78YB1
24 
25 #include <stdlib.h>
26 //#include <stdarg.h>
27 #include <cstdarg>
28 #include <string>
29 #include <list>
30 
31 #include "uscxml/messages/Event.h"
32 
33 namespace uscxml {
34 
35 class PromelaParser;
36 
38 public:
39  struct Location {
40  int firstLine;
41  int firstCol;
42  int lastLine;
43  int lastCol;
44  };
45 
46  PromelaParserNode() : type(0), parent(NULL), loc(NULL) {}
47  virtual ~PromelaParserNode();
48 
49  void merge(PromelaParserNode* node);
50  void push(PromelaParserNode* node);
51  void dump(size_t indent = 0);
52 
53  static std::string typeToDesc(int type);
54 
55  int type;
56  std::string value;
57  std::list<PromelaParserNode*> operands;
58  PromelaParserNode* parent;
59  Location* loc;
60 };
61 
63 public:
64  enum Type {
65  PROMELA_EXPR,
66  PROMELA_DECL,
67  PROMELA_STMNT
68  };
69 
70  static std::string typeToDesc(int type);
71 
72  PromelaParser() : ast(NULL) {}
73  PromelaParser(const std::string& expr);
74  PromelaParser(const std::string& expr, int nrArgs, ...);
75  virtual ~PromelaParser();
76 
77  virtual PromelaParserNode* node(int type, int nrArgs, ...);
78  virtual PromelaParserNode* value(int type, void* location, const char* value);
79  void dump();
80 
81  int parseInCompound;
82 
83  PromelaParserNode* ast;
84  Type type;
85 
86  ErrorEvent pendingException;
87  operator bool() const {
88  return ast != NULL;
89  }
90 
91 protected:
92 
93  void init(const std::string& expr);
94  void destroy();
95 
96  void* buffer;
97  void* scanner;
98  char* input;
99  size_t input_length;
100 };
101 
102 }
103 
104 void promela_error (void* yylloc_param, uscxml::PromelaParser* ctx, void* yyscanner, const char* err);
105 
106 #endif /* end of include guard: PROMELA_H_9AB78YB1 */
Definition: Breakpoint.cpp:26
Definition: Event.h:211
Definition: PromelaParser.h:37
Definition: PromelaParser.h:39
Definition: PromelaParser.h:62