Merge lp:~verifydtapn-contributers/verifydtapn/ArithmeticQueries into lp:verifydtapn

Proposed by Peter Gjøl Jensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 297
Merged at revision: 297
Proposed branch: lp:~verifydtapn-contributers/verifydtapn/ArithmeticQueries
Merge into: lp:verifydtapn
Diff against target: 2202 lines (+915/-361)
19 files modified
src/Core/QueryParser/AST.cpp (+66/-16)
src/Core/QueryParser/AST.hpp (+202/-37)
src/Core/QueryParser/Generated/lexer.cpp (+116/-99)
src/Core/QueryParser/Generated/parser.cpp (+214/-118)
src/Core/QueryParser/Generated/parser.hpp (+10/-6)
src/Core/QueryParser/NormalizationVisitor.cpp (+21/-11)
src/Core/QueryParser/NormalizationVisitor.hpp (+6/-1)
src/Core/QueryParser/Visitor.hpp (+15/-2)
src/Core/QueryParser/flex.ll (+6/-2)
src/Core/QueryParser/grammar.yy (+49/-30)
src/DiscreteVerification/DeadlockVisitor.cpp (+24/-4)
src/DiscreteVerification/DeadlockVisitor.hpp (+6/-1)
src/DiscreteVerification/PlaceVisitor.cpp (+18/-7)
src/DiscreteVerification/PlaceVisitor.hpp (+7/-1)
src/DiscreteVerification/QueryVisitor.hpp (+57/-10)
src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.cpp (+43/-7)
src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.hpp (+6/-1)
src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.cpp (+43/-7)
src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.hpp (+6/-1)
To merge this branch: bzr merge lp:~verifydtapn-contributers/verifydtapn/ArithmeticQueries
Reviewer Review Type Date Requested Status
Mathias Grund Sørensen code Approve
Jakob Taankvist Approve
Jiri Srba Approve
Review via email: mp+211946@code.launchpad.net

Description of the change

Branch contains changes implementing arithmetic operations in verifydtapn.
A lot of the changes are generated code and the remaining should be fairly straightforward.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Tested and it works.

review: Approve
Revision history for this message
Jakob Taankvist (jakob-taankvist) wrote :

I looked over the code, and I think it looks as expected.

review: Approve
Revision history for this message
Mathias Grund Sørensen (mathias.grund) wrote :

Looks as expected

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Core/QueryParser/AST.cpp'
2--- src/Core/QueryParser/AST.cpp 2013-08-09 21:47:22 +0000
3+++ src/Core/QueryParser/AST.cpp 2014-03-20 14:00:01 +0000
4@@ -47,7 +47,7 @@
5 {
6 return new AndExpression(*this);
7 }
8-
9+
10 void AndExpression::accept(Visitor& visitor, Result& context) const
11 {
12 visitor.visit(*this, context);
13@@ -58,21 +58,71 @@
14 return new OrExpression(*this);
15 }
16
17- void OrExpression::accept(Visitor& visitor, Result& context) const
18- {
19- visitor.visit(*this, context);
20- }
21-
22- ParExpression* ParExpression::clone() const
23- {
24- return new ParExpression(*this);
25- }
26-
27- void ParExpression::accept(Visitor& visitor, Result& context) const
28- {
29- visitor.visit(*this, context);
30- }
31-
32+ void OrExpression::accept(Visitor& visitor, Result& context) const
33+ {
34+ visitor.visit(*this, context);
35+ }
36+
37+ void PlusExpression::accept(Visitor& visitor, Result& context) const
38+ {
39+ visitor.visit(*this, context);
40+ }
41+
42+ PlusExpression* PlusExpression::clone() const
43+ {
44+ return new PlusExpression(*this);
45+ }
46+
47+ void SubtractExpression::accept(Visitor& visitor, Result& context) const
48+ {
49+ visitor.visit(*this, context);
50+ }
51+
52+ SubtractExpression* SubtractExpression::clone() const
53+ {
54+ return new SubtractExpression(*this);
55+ }
56+
57+ void MinusExpression::accept(Visitor& visitor, Result& context) const
58+ {
59+ visitor.visit(*this, context);
60+ }
61+
62+ MinusExpression* MinusExpression::clone() const
63+ {
64+ return new MinusExpression(*this);
65+ }
66+
67+ void MultiplyExpression::accept(Visitor& visitor, Result& context) const
68+ {
69+ visitor.visit(*this, context);
70+ }
71+
72+ MultiplyExpression* MultiplyExpression::clone() const
73+ {
74+ return new MultiplyExpression(*this);
75+ }
76+
77+ void NumberExpression::accept(Visitor& visitor, Result& context) const
78+ {
79+ visitor.visit(*this, context);
80+ }
81+
82+ NumberExpression* NumberExpression::clone() const
83+ {
84+ return new NumberExpression(*this);
85+ }
86+
87+ void IdentifierExpression::accept(Visitor& visitor, Result& context) const
88+ {
89+ visitor.visit(*this, context);
90+ }
91+
92+ IdentifierExpression* IdentifierExpression::clone() const
93+ {
94+ return new IdentifierExpression(*this);
95+ }
96+
97 Query* Query::clone() const
98 {
99 return new Query(*this);
100
101=== modified file 'src/Core/QueryParser/AST.hpp'
102--- src/Core/QueryParser/AST.hpp 2013-10-19 19:33:33 +0000
103+++ src/Core/QueryParser/AST.hpp 2014-03-20 14:00:01 +0000
104@@ -75,30 +75,31 @@
105 class AtomicProposition : public Expression
106 {
107 public:
108- AtomicProposition(int placeIndex, std::string* op, int n) : place(placeIndex), op(op->begin(), op->end()), n(n){};
109- AtomicProposition(const AtomicProposition& other) : place(other.place), op(other.op), n(other.n) { };
110+ AtomicProposition(ArithmeticExpression* left, std::string* op,ArithmeticExpression* right) : left(left), op(op->begin(), op->end()), right(right){};
111+ AtomicProposition(const AtomicProposition& other) : left(other.left), op(other.op), right(other.right) { };
112 AtomicProposition& operator=(const AtomicProposition& other)
113 {
114 if(&other != this){
115- place = other.place;
116+ left = other.left;
117 op = other.op;
118- n = other.n;
119+ right = other.right;
120 }
121 return *this;
122 }
123
124 virtual ~AtomicProposition() { };
125
126+ ArithmeticExpression& getLeft() const {return *left;};
127+ ArithmeticExpression& getRight() const {return *right;};
128+ std::string getOperator() const {return op;};
129+
130 virtual AtomicProposition* clone() const;
131 virtual void accept(Visitor& visitor, Result& context) const;
132
133- const int getPlace() const { return place; }
134- const std::string& getOperator() const { return op; }
135- int getNumberOfTokens() const { return n; }
136 private:
137- int place;
138+ ArithmeticExpression* left;
139 std::string op;
140- int n;
141+ ArithmeticExpression* right;
142 };
143
144 class AndExpression : public Expression
145@@ -167,34 +168,198 @@
146 Expression* left;
147 Expression* right;
148 };
149-
150- class ParExpression : public Expression
151- {
152- public:
153- explicit ParExpression(Expression* expr) : expr(expr) { };
154- ParExpression(const ParExpression& other) : expr(other.expr->clone()) { };
155- ParExpression& operator=(const ParExpression& other)
156- {
157- if(&other != this){
158- delete expr;
159- expr = other.expr->clone();
160- }
161-
162- return *this;
163- }
164-
165- virtual ~ParExpression(){
166- if( expr ) delete expr;
167- };
168-
169- virtual ParExpression* clone() const;
170- virtual void accept(Visitor& visitor, Result& context) const;
171-
172- const Expression& getChild() const { return *expr; }
173- private:
174- Expression* expr;
175- };
176-
177+
178+ class ArithmeticExpression : public Visitable
179+ {
180+ public:
181+ virtual ~ArithmeticExpression() { };
182+ virtual ArithmeticExpression* clone() const = 0;
183+ };
184+
185+ class OperationExpression : public ArithmeticExpression {
186+ protected:
187+
188+ OperationExpression(ArithmeticExpression* left, ArithmeticExpression* right) : left(left), right(right) {
189+ };
190+
191+ OperationExpression(const OperationExpression& other) : left(other.left), right(other.right) {
192+ };
193+
194+ OperationExpression& operator=(const OperationExpression& other) {
195+ if (&other != this) {
196+ delete left;
197+ left = other.left;
198+ delete right;
199+ right = other.right;
200+ }
201+ return *this;
202+ }
203+
204+ virtual ~OperationExpression() {
205+ };
206+
207+ public:
208+ ArithmeticExpression& getLeft() const {return *left;};
209+ ArithmeticExpression& getRight() const {return *right;};
210+
211+ protected:
212+ ArithmeticExpression* left;
213+ ArithmeticExpression* right;
214+ };
215+
216+ class PlusExpression : public OperationExpression {
217+ public:
218+
219+ PlusExpression(ArithmeticExpression* left, ArithmeticExpression* right)
220+ : OperationExpression(left, right) {
221+ };
222+
223+ PlusExpression(const PlusExpression& other)
224+ : OperationExpression(other) {
225+ };
226+
227+ PlusExpression& operator=(const PlusExpression& other) {
228+ if (&other != this) {
229+ left = other.left;
230+ right = other.right;
231+ }
232+ return *this;
233+ }
234+
235+ virtual ~PlusExpression() {
236+ };
237+
238+ virtual PlusExpression* clone() const;
239+ virtual void accept(Visitor& visitor, Result& context) const;
240+
241+ };
242+
243+ class SubtractExpression : public OperationExpression {
244+ public:
245+
246+ SubtractExpression(ArithmeticExpression* left, ArithmeticExpression* right)
247+ : OperationExpression(left, right) {
248+ };
249+
250+ SubtractExpression(const SubtractExpression& other)
251+ : OperationExpression(other) {
252+ };
253+
254+ SubtractExpression& operator=(const SubtractExpression& other) {
255+ if (&other != this) {
256+ left = other.left;
257+ right = other.right;
258+ }
259+ return *this;
260+ }
261+
262+ virtual ~SubtractExpression() {
263+ };
264+
265+ virtual SubtractExpression* clone() const;
266+ virtual void accept(Visitor& visitor, Result& context) const;
267+ };
268+
269+ class MinusExpression : public ArithmeticExpression {
270+ public:
271+ MinusExpression(ArithmeticExpression* value) : value(value) {
272+ };
273+
274+ MinusExpression(const MinusExpression& other)
275+ : value(other.value) {
276+ };
277+
278+ MinusExpression& operator=(const MinusExpression& other) {
279+ if (&other != this) {
280+ value = other.value;
281+ }
282+ return *this;
283+ }
284+
285+ ArithmeticExpression& getValue() const { return *value;};
286+
287+ virtual ~MinusExpression() {
288+ };
289+ virtual MinusExpression* clone() const;
290+ virtual void accept(Visitor& visitor, Result& context) const;
291+ private:
292+ ArithmeticExpression* value;
293+ };
294+
295+ class MultiplyExpression : public OperationExpression {
296+ public:
297+
298+ MultiplyExpression(ArithmeticExpression* left, ArithmeticExpression* right)
299+ : OperationExpression(left, right) {
300+ };
301+
302+ MultiplyExpression(const MultiplyExpression& other)
303+ : OperationExpression(other) {
304+ };
305+
306+ MultiplyExpression& operator=(const MultiplyExpression& other) {
307+ if (&other != this) {
308+ left = other.left;
309+ right = other.right;
310+ }
311+ return *this;
312+ }
313+
314+ virtual ~MultiplyExpression() {
315+ };
316+ virtual MultiplyExpression* clone() const;
317+ virtual void accept(Visitor& visitor, Result& context) const;
318+ };
319+
320+ class NumberExpression : public ArithmeticExpression {
321+ public:
322+
323+ NumberExpression(int i) : value(i) {
324+ }
325+
326+ NumberExpression(const NumberExpression& other) : value(other.value) {
327+ };
328+
329+ NumberExpression& operator=(const NumberExpression& other) {
330+ value = other.value;
331+ return *this;
332+ };
333+
334+ int getValue() const {return value;};
335+
336+ virtual ~NumberExpression() {
337+ };
338+ virtual NumberExpression* clone() const;
339+ virtual void accept(Visitor& visitor, Result& context) const;
340+ private:
341+ int value;
342+ };
343+
344+ class IdentifierExpression : public ArithmeticExpression {
345+ public:
346+
347+ IdentifierExpression(int placeIndex) : place(placeIndex) {
348+ }
349+
350+ IdentifierExpression(const IdentifierExpression& other) : place(other.place) {
351+ };
352+
353+ IdentifierExpression& operator=(const IdentifierExpression& other) {
354+ place = other.place;
355+ return *this;
356+ };
357+
358+ int getPlace() const { return place;};
359+
360+ virtual ~IdentifierExpression() {
361+ };
362+ virtual IdentifierExpression* clone() const;
363+ virtual void accept(Visitor& visitor, Result& context) const;
364+ private:
365+ int place;
366+ };
367+
368+
369 enum Quantifier { EF, AG, EG, AF};
370
371 class Query : public Visitable
372
373=== modified file 'src/Core/QueryParser/Generated/lexer.cpp'
374--- src/Core/QueryParser/Generated/lexer.cpp 2013-08-28 19:51:15 +0000
375+++ src/Core/QueryParser/Generated/lexer.cpp 2014-03-20 14:00:01 +0000
376@@ -9,7 +9,7 @@
377 #define FLEX_SCANNER
378 #define YY_FLEX_MAJOR_VERSION 2
379 #define YY_FLEX_MINOR_VERSION 5
380-#define YY_FLEX_SUBMINOR_VERSION 35
381+#define YY_FLEX_SUBMINOR_VERSION 37
382 #if YY_FLEX_SUBMINOR_VERSION > 0
383 #define FLEX_BETA
384 #endif
385@@ -47,7 +47,6 @@
386 typedef uint16_t flex_uint16_t;
387 typedef int32_t flex_int32_t;
388 typedef uint32_t flex_uint32_t;
389-typedef uint64_t flex_uint64_t;
390 #else
391 typedef signed char flex_int8_t;
392 typedef short int flex_int16_t;
393@@ -55,7 +54,6 @@
394 typedef unsigned char flex_uint8_t;
395 typedef unsigned short int flex_uint16_t;
396 typedef unsigned int flex_uint32_t;
397-#endif /* ! C99 */
398
399 /* Limits of integral types. */
400 #ifndef INT8_MIN
401@@ -86,6 +84,8 @@
402 #define UINT32_MAX (4294967295U)
403 #endif
404
405+#endif /* ! C99 */
406+
407 #endif /* ! FLEXINT_H */
408
409 #ifdef __cplusplus
410@@ -333,7 +333,7 @@
411
412 /* Begin user sect3 */
413
414-#define yywrap(n) 1
415+#define yywrap() 1
416 #define YY_SKIP_YYWRAP
417
418 typedef unsigned char YY_CHAR;
419@@ -359,13 +359,13 @@
420 */
421 #define YY_DO_BEFORE_ACTION \
422 (yytext_ptr) = yy_bp; \
423- yyleng = (yy_size_t) (yy_cp - yy_bp); \
424+ yyleng = (size_t) (yy_cp - yy_bp); \
425 (yy_hold_char) = *yy_cp; \
426 *yy_cp = '\0'; \
427 (yy_c_buf_p) = yy_cp;
428
429-#define YY_NUM_RULES 23
430-#define YY_END_OF_BUFFER 24
431+#define YY_NUM_RULES 26
432+#define YY_END_OF_BUFFER 27
433 /* This struct is not used in this scanner,
434 but its presence is necessary. */
435 struct yy_trans_info
436@@ -373,14 +373,14 @@
437 flex_int32_t yy_verify;
438 flex_int32_t yy_nxt;
439 };
440-static yyconst flex_int16_t yy_accept[58] =
441+static yyconst flex_int16_t yy_accept[61] =
442 { 0,
443- 0, 0, 24, 23, 1, 2, 13, 23, 14, 15,
444- 3, 16, 18, 21, 22, 22, 22, 22, 22, 22,
445- 22, 23, 22, 22, 1, 2, 9, 3, 17, 19,
446- 20, 22, 22, 22, 22, 22, 8, 22, 8, 6,
447- 5, 4, 7, 9, 22, 22, 13, 22, 22, 22,
448- 10, 22, 11, 22, 22, 12, 0
449+ 0, 0, 27, 26, 1, 2, 13, 26, 20, 21,
450+ 24, 22, 23, 3, 14, 16, 19, 25, 25, 25,
451+ 25, 25, 25, 25, 26, 25, 25, 1, 2, 9,
452+ 3, 15, 17, 18, 25, 25, 25, 25, 25, 8,
453+ 25, 8, 6, 5, 4, 7, 9, 25, 25, 13,
454+ 25, 25, 25, 10, 25, 11, 25, 25, 12, 0
455 } ;
456
457 static yyconst flex_int32_t yy_ec[256] =
458@@ -389,16 +389,16 @@
459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
460 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
461 1, 2, 4, 1, 1, 1, 1, 5, 1, 6,
462- 7, 1, 1, 1, 1, 1, 1, 8, 8, 8,
463- 8, 8, 8, 8, 8, 8, 8, 1, 1, 9,
464- 10, 11, 1, 1, 12, 13, 13, 13, 14, 15,
465- 16, 13, 13, 13, 13, 13, 13, 13, 13, 13,
466- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
467- 1, 1, 1, 1, 13, 1, 17, 13, 18, 19,
468+ 7, 8, 9, 1, 10, 1, 1, 11, 11, 11,
469+ 11, 11, 11, 11, 11, 11, 11, 1, 1, 12,
470+ 13, 14, 1, 1, 15, 16, 16, 16, 17, 18,
471+ 19, 16, 16, 16, 16, 16, 16, 16, 16, 16,
472+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
473+ 1, 1, 1, 1, 16, 1, 20, 16, 21, 22,
474
475- 20, 21, 13, 13, 13, 13, 22, 23, 13, 24,
476- 25, 13, 13, 26, 27, 28, 29, 13, 13, 13,
477- 13, 13, 1, 30, 1, 1, 1, 1, 1, 1,
478+ 23, 24, 16, 16, 16, 16, 25, 26, 16, 27,
479+ 28, 16, 16, 29, 30, 31, 32, 16, 16, 16,
480+ 16, 16, 1, 33, 1, 1, 1, 1, 1, 1,
481 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
482 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
483 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
484@@ -415,61 +415,66 @@
485 1, 1, 1, 1, 1
486 } ;
487
488-static yyconst flex_int32_t yy_meta[31] =
489- { 0,
490- 1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
491- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492- 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
493- } ;
494-
495-static yyconst flex_int16_t yy_base[59] =
496- { 0,
497- 0, 19, 68, 69, 65, 63, 69, 60, 69, 69,
498- 56, 53, 52, 51, 0, 36, 39, 41, 32, 30,
499- 29, 24, 19, 21, 51, 49, 69, 43, 69, 69,
500- 69, 0, 31, 32, 25, 19, 0, 17, 69, 0,
501- 0, 0, 0, 0, 26, 17, 0, 23, 19, 21,
502- 0, 15, 0, 21, 16, 0, 69, 30
503- } ;
504-
505-static yyconst flex_int16_t yy_def[59] =
506- { 0,
507- 57, 1, 57, 57, 57, 57, 57, 57, 57, 57,
508- 57, 57, 57, 57, 58, 58, 58, 58, 58, 58,
509- 58, 57, 58, 58, 57, 57, 57, 57, 57, 57,
510- 57, 58, 58, 58, 58, 58, 58, 58, 57, 58,
511- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
512- 58, 58, 58, 58, 58, 58, 0, 57
513- } ;
514-
515-static yyconst flex_int16_t yy_nxt[100] =
516+static yyconst flex_int32_t yy_meta[34] =
517+ { 0,
518+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
519+ 2, 1, 1, 1, 2, 2, 2, 2, 2, 2,
520+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521+ 2, 2, 1
522+ } ;
523+
524+static yyconst flex_int16_t yy_base[62] =
525+ { 0,
526+ 0, 19, 71, 72, 68, 66, 72, 63, 72, 72,
527+ 72, 72, 72, 56, 53, 52, 51, 0, 36, 39,
528+ 41, 32, 30, 29, 24, 19, 21, 54, 52, 72,
529+ 43, 72, 72, 72, 0, 31, 32, 25, 19, 0,
530+ 17, 72, 0, 0, 0, 0, 0, 26, 17, 0,
531+ 23, 19, 21, 0, 15, 0, 21, 16, 0, 72,
532+ 33
533+ } ;
534+
535+static yyconst flex_int16_t yy_def[62] =
536+ { 0,
537+ 60, 1, 60, 60, 60, 60, 60, 60, 60, 60,
538+ 60, 60, 60, 60, 60, 60, 60, 61, 61, 61,
539+ 61, 61, 61, 61, 60, 61, 61, 60, 60, 60,
540+ 60, 60, 60, 60, 61, 61, 61, 61, 61, 61,
541+ 61, 60, 61, 61, 61, 61, 61, 61, 61, 61,
542+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 0,
543+ 60
544+ } ;
545+
546+static yyconst flex_int16_t yy_nxt[106] =
547 { 0,
548 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
549- 14, 15, 15, 15, 15, 15, 16, 15, 17, 15,
550- 18, 15, 15, 19, 20, 15, 15, 21, 15, 22,
551- 23, 32, 24, 40, 41, 42, 43, 56, 55, 54,
552- 53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
553- 28, 26, 25, 39, 38, 37, 36, 35, 34, 33,
554- 31, 30, 29, 28, 27, 26, 25, 57, 3, 57,
555- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
556- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
557- 57, 57, 57, 57, 57, 57, 57, 57, 57
558+ 14, 15, 16, 17, 18, 18, 18, 18, 18, 19,
559+ 18, 20, 18, 21, 18, 18, 22, 23, 18, 18,
560+ 24, 18, 25, 26, 35, 27, 43, 44, 45, 46,
561+ 59, 58, 57, 56, 55, 54, 53, 52, 51, 50,
562+ 49, 48, 47, 31, 29, 28, 42, 41, 40, 39,
563+ 38, 37, 36, 34, 33, 32, 31, 30, 29, 28,
564+ 60, 3, 60, 60, 60, 60, 60, 60, 60, 60,
565+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
566+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
567
568+ 60, 60, 60, 60, 60
569 } ;
570
571-static yyconst flex_int16_t yy_chk[100] =
572+static yyconst flex_int16_t yy_chk[106] =
573 { 0,
574 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
575 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
576 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
577- 2, 58, 2, 23, 23, 24, 24, 55, 54, 52,
578- 50, 49, 48, 46, 45, 38, 36, 35, 34, 33,
579- 28, 26, 25, 22, 21, 20, 19, 18, 17, 16,
580- 14, 13, 12, 11, 8, 6, 5, 3, 57, 57,
581- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
582- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
583- 57, 57, 57, 57, 57, 57, 57, 57, 57
584+ 1, 1, 1, 2, 61, 2, 26, 26, 27, 27,
585+ 58, 57, 55, 53, 52, 51, 49, 48, 41, 39,
586+ 38, 37, 36, 31, 29, 28, 25, 24, 23, 22,
587+ 21, 20, 19, 17, 16, 15, 14, 8, 6, 5,
588+ 3, 60, 60, 60, 60, 60, 60, 60, 60, 60,
589+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
590+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
591
592+ 60, 60, 60, 60, 60
593 } ;
594
595 static yy_state_type yy_last_accepting_state;
596@@ -505,7 +510,7 @@
597 #define yyterminate() return token::END
598 #line 26 "Core/QueryParser/flex.ll"
599 # define YY_USER_ACTION yylloc->columns (yyleng);
600-#line 509 "Core/QueryParser/Generated/lexer.cpp"
601+#line 514 "Core/QueryParser/Generated/lexer.cpp"
602
603 #define INITIAL 0
604
605@@ -592,7 +597,7 @@
606 /* This used to be an fputs(), but since the string might contain NUL's,
607 * we now use fwrite().
608 */
609-#define ECHO fwrite( yytext, yyleng, 1, yyout )
610+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
611 #endif
612
613 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
614@@ -603,7 +608,7 @@
615 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
616 { \
617 int c = '*'; \
618- yy_size_t n; \
619+ size_t n; \
620 for ( n = 0; n < max_size && \
621 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
622 buf[n] = (char) c; \
623@@ -693,7 +698,7 @@
624
625 yylloc->step ();
626
627-#line 697 "Core/QueryParser/Generated/lexer.cpp"
628+#line 702 "Core/QueryParser/Generated/lexer.cpp"
629
630 if ( !(yy_init) )
631 {
632@@ -747,13 +752,13 @@
633 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
634 {
635 yy_current_state = (int) yy_def[yy_current_state];
636- if ( yy_current_state >= 58 )
637+ if ( yy_current_state >= 61 )
638 yy_c = yy_meta[(unsigned int) yy_c];
639 }
640 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
641 ++yy_cp;
642 }
643- while ( yy_current_state != 57 );
644+ while ( yy_current_state != 60 );
645 yy_cp = (yy_last_accepting_cpos);
646 yy_current_state = (yy_last_accepting_state);
647
648@@ -845,54 +850,69 @@
649 case 14:
650 YY_RULE_SETUP
651 #line 50 "Core/QueryParser/flex.ll"
652-{ return token::LPARAN; }
653+{ yylval->string = new std::string(yytext); return token::LESS; }
654 YY_BREAK
655 case 15:
656 YY_RULE_SETUP
657 #line 51 "Core/QueryParser/flex.ll"
658-{ return token::RPARAN; }
659+{ yylval->string = new std::string(yytext); return token::LESSEQUAL; }
660 YY_BREAK
661 case 16:
662 YY_RULE_SETUP
663 #line 52 "Core/QueryParser/flex.ll"
664-{ yylval->string = new std::string(yytext); return token::LESS; }
665+{ yylval->string = new std::string(yytext); return token::EQUAL; }
666 YY_BREAK
667 case 17:
668 YY_RULE_SETUP
669 #line 53 "Core/QueryParser/flex.ll"
670-{ yylval->string = new std::string(yytext); return token::LESSEQUAL; }
671+{ yylval->string = new std::string(yytext); return token::EQUAL; }
672 YY_BREAK
673 case 18:
674 YY_RULE_SETUP
675 #line 54 "Core/QueryParser/flex.ll"
676-{ yylval->string = new std::string(yytext); return token::EQUAL; }
677+{ yylval->string = new std::string(yytext); return token::GREATEREQUAL; }
678 YY_BREAK
679 case 19:
680 YY_RULE_SETUP
681 #line 55 "Core/QueryParser/flex.ll"
682-{ yylval->string = new std::string(yytext); return token::EQUAL; }
683+{ yylval->string = new std::string(yytext); return token::GREATER; }
684 YY_BREAK
685 case 20:
686 YY_RULE_SETUP
687 #line 56 "Core/QueryParser/flex.ll"
688-{ yylval->string = new std::string(yytext); return token::GREATEREQUAL; }
689+{return token::LPARAN;}
690 YY_BREAK
691 case 21:
692 YY_RULE_SETUP
693 #line 57 "Core/QueryParser/flex.ll"
694-{ yylval->string = new std::string(yytext); return token::GREATER; }
695+{return token::RPARAN;}
696 YY_BREAK
697 case 22:
698 YY_RULE_SETUP
699 #line 58 "Core/QueryParser/flex.ll"
700+{return token::PLUS;}
701+ YY_BREAK
702+case 23:
703+YY_RULE_SETUP
704+#line 59 "Core/QueryParser/flex.ll"
705+{return token::MINUS;}
706+ YY_BREAK
707+case 24:
708+YY_RULE_SETUP
709+#line 60 "Core/QueryParser/flex.ll"
710+{return token::MULTIPLY;}
711+ YY_BREAK
712+case 25:
713+YY_RULE_SETUP
714+#line 62 "Core/QueryParser/flex.ll"
715 { yylval->string = new std::string(yytext); return token::IDENTIFIER; }
716 YY_BREAK
717-case 23:
718+case 26:
719 YY_RULE_SETUP
720-#line 60 "Core/QueryParser/flex.ll"
721+#line 64 "Core/QueryParser/flex.ll"
722 ECHO;
723 YY_BREAK
724-#line 896 "Core/QueryParser/Generated/lexer.cpp"
725+#line 916 "Core/QueryParser/Generated/lexer.cpp"
726 case YY_STATE_EOF(INITIAL):
727 yyterminate();
728
729@@ -1086,7 +1106,7 @@
730 { /* Not enough room in the buffer - grow it. */
731
732 /* just a shorter name for the current buffer */
733- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
734+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
735
736 int yy_c_buf_p_offset =
737 (int) ((yy_c_buf_p) - b->yy_ch_buf);
738@@ -1186,7 +1206,7 @@
739 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
740 {
741 yy_current_state = (int) yy_def[yy_current_state];
742- if ( yy_current_state >= 58 )
743+ if ( yy_current_state >= 61 )
744 yy_c = yy_meta[(unsigned int) yy_c];
745 }
746 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
747@@ -1214,13 +1234,13 @@
748 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
749 {
750 yy_current_state = (int) yy_def[yy_current_state];
751- if ( yy_current_state >= 58 )
752+ if ( yy_current_state >= 61 )
753 yy_c = yy_meta[(unsigned int) yy_c];
754 }
755 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
756- yy_is_jam = (yy_current_state == 57);
757+ yy_is_jam = (yy_current_state == 60);
758
759- return yy_is_jam ? 0 : yy_current_state;
760+ return yy_is_jam ? 0 : yy_current_state;
761 }
762
763 #ifndef YY_NO_INPUT
764@@ -1271,7 +1291,7 @@
765 case EOB_ACT_END_OF_FILE:
766 {
767 if ( yywrap( ) )
768- return 0;
769+ return EOF;
770
771 if ( ! (yy_did_buffer_switch_on_eof) )
772 YY_NEW_FILE;
773@@ -1409,10 +1429,6 @@
774 yyfree((void *) b );
775 }
776
777-#ifndef __cplusplus
778-extern int isatty (int );
779-#endif /* __cplusplus */
780-
781 /* Initializes or reinitializes a buffer.
782 * This function is sometimes called more than once on the same buffer,
783 * such as during a yyrestart() or at EOF.
784@@ -1617,8 +1633,8 @@
785
786 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
787 * scan from a @e copy of @a bytes.
788- * @param bytes the byte buffer to scan
789- * @param len the number of bytes in the buffer pointed to by @a bytes.
790+ * @param yybytes the byte buffer to scan
791+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
792 *
793 * @return the newly allocated buffer state object.
794 */
795@@ -1626,7 +1642,8 @@
796 {
797 YY_BUFFER_STATE b;
798 char *buf;
799- yy_size_t n, i;
800+ yy_size_t n;
801+ int i;
802
803 /* Get memory for full buffer, including space for trailing EOB's. */
804 n = _yybytes_len + 2;
805@@ -1856,7 +1873,7 @@
806
807 #define YYTABLES_NAME "yytables"
808
809-#line 60 "Core/QueryParser/flex.ll"
810+#line 64 "Core/QueryParser/flex.ll"
811
812
813 namespace VerifyTAPN
814
815=== modified file 'src/Core/QueryParser/Generated/parser.cpp'
816--- src/Core/QueryParser/Generated/parser.cpp 2013-08-28 19:51:15 +0000
817+++ src/Core/QueryParser/Generated/parser.cpp 2014-03-20 14:00:01 +0000
818@@ -45,7 +45,7 @@
819 #line 46 "Core/QueryParser/Generated/parser.cpp"
820 /* Unqualified %code blocks. */
821 /* Line 290 of lalr1.cc */
822-#line 37 "Core/QueryParser/grammar.yy"
823+#line 38 "Core/QueryParser/grammar.yy"
824
825 #include "../TAPNQueryParser.hpp"
826
827@@ -247,109 +247,130 @@
828 {
829 case 3: /* IDENTIFIER */
830 /* Line 452 of lalr1.cc */
831-#line 53 "Core/QueryParser/grammar.yy"
832+#line 56 "Core/QueryParser/grammar.yy"
833 { delete ((*yyvaluep).string); };
834 /* Line 452 of lalr1.cc */
835 #line 254 "Core/QueryParser/Generated/parser.cpp"
836 break;
837 case 4: /* LESS */
838 /* Line 452 of lalr1.cc */
839-#line 53 "Core/QueryParser/grammar.yy"
840+#line 56 "Core/QueryParser/grammar.yy"
841 { delete ((*yyvaluep).string); };
842 /* Line 452 of lalr1.cc */
843 #line 261 "Core/QueryParser/Generated/parser.cpp"
844 break;
845 case 5: /* LESSEQUAL */
846 /* Line 452 of lalr1.cc */
847-#line 53 "Core/QueryParser/grammar.yy"
848+#line 56 "Core/QueryParser/grammar.yy"
849 { delete ((*yyvaluep).string); };
850 /* Line 452 of lalr1.cc */
851 #line 268 "Core/QueryParser/Generated/parser.cpp"
852 break;
853 case 6: /* EQUAL */
854 /* Line 452 of lalr1.cc */
855-#line 53 "Core/QueryParser/grammar.yy"
856+#line 56 "Core/QueryParser/grammar.yy"
857 { delete ((*yyvaluep).string); };
858 /* Line 452 of lalr1.cc */
859 #line 275 "Core/QueryParser/Generated/parser.cpp"
860 break;
861 case 7: /* GREATEREQUAL */
862 /* Line 452 of lalr1.cc */
863-#line 53 "Core/QueryParser/grammar.yy"
864+#line 56 "Core/QueryParser/grammar.yy"
865 { delete ((*yyvaluep).string); };
866 /* Line 452 of lalr1.cc */
867 #line 282 "Core/QueryParser/Generated/parser.cpp"
868 break;
869 case 8: /* GREATER */
870 /* Line 452 of lalr1.cc */
871-#line 53 "Core/QueryParser/grammar.yy"
872+#line 56 "Core/QueryParser/grammar.yy"
873 { delete ((*yyvaluep).string); };
874 /* Line 452 of lalr1.cc */
875 #line 289 "Core/QueryParser/Generated/parser.cpp"
876 break;
877- case 23: /* query */
878+ case 26: /* query */
879 /* Line 452 of lalr1.cc */
880-#line 55 "Core/QueryParser/grammar.yy"
881+#line 58 "Core/QueryParser/grammar.yy"
882 { delete ((*yyvaluep).query); };
883 /* Line 452 of lalr1.cc */
884 #line 296 "Core/QueryParser/Generated/parser.cpp"
885 break;
886- case 24: /* expression */
887+ case 27: /* expression */
888 /* Line 452 of lalr1.cc */
889-#line 54 "Core/QueryParser/grammar.yy"
890+#line 57 "Core/QueryParser/grammar.yy"
891 { delete ((*yyvaluep).expr); };
892 /* Line 452 of lalr1.cc */
893 #line 303 "Core/QueryParser/Generated/parser.cpp"
894 break;
895- case 25: /* parExpression */
896+ case 28: /* arithmeticExpression */
897 /* Line 452 of lalr1.cc */
898-#line 54 "Core/QueryParser/grammar.yy"
899- { delete ((*yyvaluep).expr); };
900+#line 57 "Core/QueryParser/grammar.yy"
901+ { delete ((*yyvaluep).arexpr); };
902 /* Line 452 of lalr1.cc */
903 #line 310 "Core/QueryParser/Generated/parser.cpp"
904 break;
905- case 26: /* notExpression */
906+ case 29: /* multiplyExpression */
907 /* Line 452 of lalr1.cc */
908-#line 54 "Core/QueryParser/grammar.yy"
909- { delete ((*yyvaluep).expr); };
910+#line 57 "Core/QueryParser/grammar.yy"
911+ { delete ((*yyvaluep).arexpr); };
912 /* Line 452 of lalr1.cc */
913 #line 317 "Core/QueryParser/Generated/parser.cpp"
914 break;
915- case 27: /* orExpression */
916+ case 30: /* arithmeticParantheses */
917 /* Line 452 of lalr1.cc */
918-#line 54 "Core/QueryParser/grammar.yy"
919- { delete ((*yyvaluep).expr); };
920+#line 57 "Core/QueryParser/grammar.yy"
921+ { delete ((*yyvaluep).arexpr); };
922 /* Line 452 of lalr1.cc */
923 #line 324 "Core/QueryParser/Generated/parser.cpp"
924 break;
925- case 28: /* andExpression */
926+ case 31: /* parExpression */
927 /* Line 452 of lalr1.cc */
928-#line 54 "Core/QueryParser/grammar.yy"
929+#line 57 "Core/QueryParser/grammar.yy"
930 { delete ((*yyvaluep).expr); };
931 /* Line 452 of lalr1.cc */
932 #line 331 "Core/QueryParser/Generated/parser.cpp"
933 break;
934- case 29: /* boolExpression */
935+ case 32: /* notExpression */
936 /* Line 452 of lalr1.cc */
937-#line 54 "Core/QueryParser/grammar.yy"
938+#line 57 "Core/QueryParser/grammar.yy"
939 { delete ((*yyvaluep).expr); };
940 /* Line 452 of lalr1.cc */
941 #line 338 "Core/QueryParser/Generated/parser.cpp"
942 break;
943- case 30: /* atomicProposition */
944+ case 33: /* orExpression */
945 /* Line 452 of lalr1.cc */
946-#line 54 "Core/QueryParser/grammar.yy"
947+#line 57 "Core/QueryParser/grammar.yy"
948 { delete ((*yyvaluep).expr); };
949 /* Line 452 of lalr1.cc */
950 #line 345 "Core/QueryParser/Generated/parser.cpp"
951 break;
952- case 31: /* compareOp */
953+ case 34: /* andExpression */
954 /* Line 452 of lalr1.cc */
955-#line 53 "Core/QueryParser/grammar.yy"
956- { delete ((*yyvaluep).string); };
957+#line 57 "Core/QueryParser/grammar.yy"
958+ { delete ((*yyvaluep).expr); };
959 /* Line 452 of lalr1.cc */
960 #line 352 "Core/QueryParser/Generated/parser.cpp"
961 break;
962+ case 35: /* boolExpression */
963+/* Line 452 of lalr1.cc */
964+#line 57 "Core/QueryParser/grammar.yy"
965+ { delete ((*yyvaluep).expr); };
966+/* Line 452 of lalr1.cc */
967+#line 359 "Core/QueryParser/Generated/parser.cpp"
968+ break;
969+ case 36: /* atomicProposition */
970+/* Line 452 of lalr1.cc */
971+#line 57 "Core/QueryParser/grammar.yy"
972+ { delete ((*yyvaluep).expr); };
973+/* Line 452 of lalr1.cc */
974+#line 366 "Core/QueryParser/Generated/parser.cpp"
975+ break;
976+ case 37: /* compareOp */
977+/* Line 452 of lalr1.cc */
978+#line 56 "Core/QueryParser/grammar.yy"
979+ { delete ((*yyvaluep).string); };
980+/* Line 452 of lalr1.cc */
981+#line 373 "Core/QueryParser/Generated/parser.cpp"
982+ break;
983
984 default:
985 break;
986@@ -449,7 +470,7 @@
987 yylloc.begin.filename = yylloc.end.filename = &driver.file;
988 }
989 /* Line 539 of lalr1.cc */
990-#line 453 "Core/QueryParser/Generated/parser.cpp"
991+#line 474 "Core/QueryParser/Generated/parser.cpp"
992
993 /* Initialize the stacks. The initial state will be pushed in
994 yynewstate, since the latter expects the semantical and the
995@@ -569,121 +590,174 @@
996 {
997 case 2:
998 /* Line 664 of lalr1.cc */
999-#line 59 "Core/QueryParser/grammar.yy"
1000+#line 62 "Core/QueryParser/grammar.yy"
1001 { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EF, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); }
1002 break;
1003
1004 case 3:
1005 /* Line 664 of lalr1.cc */
1006-#line 60 "Core/QueryParser/grammar.yy"
1007+#line 63 "Core/QueryParser/grammar.yy"
1008 { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AG, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); }
1009 break;
1010
1011 case 4:
1012 /* Line 664 of lalr1.cc */
1013-#line 61 "Core/QueryParser/grammar.yy"
1014+#line 64 "Core/QueryParser/grammar.yy"
1015 { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EG, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); }
1016 break;
1017
1018 case 5:
1019 /* Line 664 of lalr1.cc */
1020-#line 62 "Core/QueryParser/grammar.yy"
1021+#line 65 "Core/QueryParser/grammar.yy"
1022 { (yyval.query) = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AF, (yysemantic_stack_[(2) - (2)].expr)); driver.setAST((yyval.query)); }
1023 break;
1024
1025 case 6:
1026 /* Line 664 of lalr1.cc */
1027-#line 65 "Core/QueryParser/grammar.yy"
1028+#line 68 "Core/QueryParser/grammar.yy"
1029 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); }
1030 break;
1031
1032 case 7:
1033 /* Line 664 of lalr1.cc */
1034-#line 66 "Core/QueryParser/grammar.yy"
1035+#line 69 "Core/QueryParser/grammar.yy"
1036 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); }
1037 break;
1038
1039 case 8:
1040 /* Line 664 of lalr1.cc */
1041-#line 67 "Core/QueryParser/grammar.yy"
1042+#line 70 "Core/QueryParser/grammar.yy"
1043 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); }
1044 break;
1045
1046 case 9:
1047 /* Line 664 of lalr1.cc */
1048-#line 68 "Core/QueryParser/grammar.yy"
1049+#line 71 "Core/QueryParser/grammar.yy"
1050 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); }
1051 break;
1052
1053 case 10:
1054 /* Line 664 of lalr1.cc */
1055-#line 69 "Core/QueryParser/grammar.yy"
1056+#line 72 "Core/QueryParser/grammar.yy"
1057 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); }
1058 break;
1059
1060 case 11:
1061 /* Line 664 of lalr1.cc */
1062-#line 70 "Core/QueryParser/grammar.yy"
1063+#line 73 "Core/QueryParser/grammar.yy"
1064 { (yyval.expr) = (yysemantic_stack_[(1) - (1)].expr); }
1065 break;
1066
1067 case 12:
1068 /* Line 664 of lalr1.cc */
1069-#line 76 "Core/QueryParser/grammar.yy"
1070- { (yyval.expr) = new VerifyTAPN::AST::ParExpression((yysemantic_stack_[(3) - (2)].expr)); }
1071+#line 79 "Core/QueryParser/grammar.yy"
1072+ { (yyval.arexpr) = new VerifyTAPN::AST::PlusExpression((yysemantic_stack_[(3) - (1)].arexpr), (yysemantic_stack_[(3) - (3)].arexpr)); }
1073 break;
1074
1075 case 13:
1076 /* Line 664 of lalr1.cc */
1077-#line 77 "Core/QueryParser/grammar.yy"
1078- { (yyval.expr) = new VerifyTAPN::AST::NotExpression((yysemantic_stack_[(2) - (2)].expr)); }
1079+#line 80 "Core/QueryParser/grammar.yy"
1080+ { (yyval.arexpr) = new VerifyTAPN::AST::SubtractExpression((yysemantic_stack_[(3) - (1)].arexpr), (yysemantic_stack_[(3) - (3)].arexpr)); }
1081 break;
1082
1083 case 14:
1084 /* Line 664 of lalr1.cc */
1085-#line 78 "Core/QueryParser/grammar.yy"
1086- { (yyval.expr) = new VerifyTAPN::AST::OrExpression((yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); }
1087+#line 81 "Core/QueryParser/grammar.yy"
1088+ { (yyval.arexpr) = new VerifyTAPN::AST::MinusExpression((yysemantic_stack_[(2) - (2)].arexpr)); }
1089 break;
1090
1091 case 15:
1092 /* Line 664 of lalr1.cc */
1093-#line 79 "Core/QueryParser/grammar.yy"
1094- { (yyval.expr) = new VerifyTAPN::AST::AndExpression((yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); }
1095+#line 82 "Core/QueryParser/grammar.yy"
1096+ { (yyval.arexpr) = (yysemantic_stack_[(1) - (1)].arexpr); }
1097 break;
1098
1099 case 16:
1100 /* Line 664 of lalr1.cc */
1101-#line 80 "Core/QueryParser/grammar.yy"
1102- { (yyval.expr) = new VerifyTAPN::AST::BoolExpression(true); }
1103+#line 85 "Core/QueryParser/grammar.yy"
1104+ { (yyval.arexpr) = new VerifyTAPN::AST::MultiplyExpression((yysemantic_stack_[(3) - (1)].arexpr), (yysemantic_stack_[(3) - (3)].arexpr)); }
1105 break;
1106
1107 case 17:
1108 /* Line 664 of lalr1.cc */
1109-#line 81 "Core/QueryParser/grammar.yy"
1110- { (yyval.expr) = new VerifyTAPN::AST::BoolExpression(false); }
1111+#line 86 "Core/QueryParser/grammar.yy"
1112+ { (yyval.arexpr) = (yysemantic_stack_[(1) - (1)].arexpr); }
1113 break;
1114
1115 case 18:
1116 /* Line 664 of lalr1.cc */
1117-#line 83 "Core/QueryParser/grammar.yy"
1118+#line 89 "Core/QueryParser/grammar.yy"
1119+ { (yyval.arexpr) = (yysemantic_stack_[(3) - (2)].arexpr); }
1120+ break;
1121+
1122+ case 19:
1123+/* Line 664 of lalr1.cc */
1124+#line 90 "Core/QueryParser/grammar.yy"
1125+ { (yyval.arexpr) = new VerifyTAPN::AST::NumberExpression((yysemantic_stack_[(1) - (1)].number));}
1126+ break;
1127+
1128+ case 20:
1129+/* Line 664 of lalr1.cc */
1130+#line 91 "Core/QueryParser/grammar.yy"
1131 {
1132- int placeIndex = driver.getTAPN().getPlaceIndex(*(yysemantic_stack_[(3) - (1)].string));
1133- delete (yysemantic_stack_[(3) - (1)].string);
1134- if(placeIndex == -1) error((yylocation_stack_[(3) - (1)]), "unknown place");
1135- (yyval.expr) = new VerifyTAPN::AST::AtomicProposition(placeIndex, (yysemantic_stack_[(3) - (2)].string), (yysemantic_stack_[(3) - (3)].number));
1136- delete (yysemantic_stack_[(3) - (2)].string);
1137- }
1138- break;
1139-
1140- case 19:
1141-/* Line 664 of lalr1.cc */
1142-#line 89 "Core/QueryParser/grammar.yy"
1143+ int placeIndex = driver.getTAPN().getPlaceIndex(*(yysemantic_stack_[(1) - (1)].string));
1144+ delete (yysemantic_stack_[(1) - (1)].string);
1145+ if(placeIndex == -1) error((yylocation_stack_[(1) - (1)]), "unknown place");
1146+ (yyval.arexpr) = new VerifyTAPN::AST::IdentifierExpression(placeIndex);
1147+ }
1148+ break;
1149+
1150+ case 21:
1151+/* Line 664 of lalr1.cc */
1152+#line 99 "Core/QueryParser/grammar.yy"
1153+ { (yyval.expr) = (yysemantic_stack_[(3) - (2)].expr); }
1154+ break;
1155+
1156+ case 22:
1157+/* Line 664 of lalr1.cc */
1158+#line 100 "Core/QueryParser/grammar.yy"
1159+ { (yyval.expr) = new VerifyTAPN::AST::NotExpression((yysemantic_stack_[(2) - (2)].expr)); }
1160+ break;
1161+
1162+ case 23:
1163+/* Line 664 of lalr1.cc */
1164+#line 101 "Core/QueryParser/grammar.yy"
1165+ { (yyval.expr) = new VerifyTAPN::AST::OrExpression((yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); }
1166+ break;
1167+
1168+ case 24:
1169+/* Line 664 of lalr1.cc */
1170+#line 102 "Core/QueryParser/grammar.yy"
1171+ { (yyval.expr) = new VerifyTAPN::AST::AndExpression((yysemantic_stack_[(3) - (1)].expr), (yysemantic_stack_[(3) - (3)].expr)); }
1172+ break;
1173+
1174+ case 25:
1175+/* Line 664 of lalr1.cc */
1176+#line 103 "Core/QueryParser/grammar.yy"
1177+ { (yyval.expr) = new VerifyTAPN::AST::BoolExpression(true); }
1178+ break;
1179+
1180+ case 26:
1181+/* Line 664 of lalr1.cc */
1182+#line 104 "Core/QueryParser/grammar.yy"
1183+ { (yyval.expr) = new VerifyTAPN::AST::BoolExpression(false); }
1184+ break;
1185+
1186+ case 27:
1187+/* Line 664 of lalr1.cc */
1188+#line 106 "Core/QueryParser/grammar.yy"
1189+ { (yyval.expr) = new VerifyTAPN::AST::AtomicProposition((yysemantic_stack_[(3) - (1)].arexpr), (yysemantic_stack_[(3) - (2)].string), (yysemantic_stack_[(3) - (3)].arexpr)); }
1190+ break;
1191+
1192+ case 28:
1193+/* Line 664 of lalr1.cc */
1194+#line 107 "Core/QueryParser/grammar.yy"
1195 { (yyval.expr) = new VerifyTAPN::AST::DeadlockExpression(); }
1196 break;
1197
1198
1199 /* Line 664 of lalr1.cc */
1200-#line 687 "Core/QueryParser/Generated/parser.cpp"
1201+#line 761 "Core/QueryParser/Generated/parser.cpp"
1202 default:
1203 break;
1204 }
1205@@ -983,14 +1057,16 @@
1206
1207 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1208 STATE-NUM. */
1209- const signed char Parser::yypact_ninf_ = -5;
1210+ const signed char Parser::yypact_ninf_ = -29;
1211 const signed char
1212 Parser::yypact_[] =
1213 {
1214- 12, 0, 0, 0, 0, 4, 2, 0, 3, -5,
1215- -5, -5, -1, -5, -5, -5, -5, -5, -5, -1,
1216- -1, -1, -5, -5, -5, -5, -5, -5, 17, -4,
1217- -5, 0, 0, -5, -5, 10, -5
1218+ 46, -1, -1, -1, -1, 7, -29, -29, -1, 9,
1219+ -29, -29, -29, 25, -2, 43, 14, -29, -29, -29,
1220+ -29, -29, -29, -29, -2, -2, -2, -29, -6, 38,
1221+ -1, -29, 18, 14, -1, -1, -29, -29, -29, -29,
1222+ -29, 25, 25, 18, 25, -29, -29, 40, -5, -29,
1223+ 14, 14, 3, -29
1224 };
1225
1226 /* YYDEFACT[S] -- default reduction number in state S. Performed when
1227@@ -999,24 +1075,28 @@
1228 const unsigned char
1229 Parser::yydefact_[] =
1230 {
1231- 0, 0, 0, 0, 0, 0, 0, 0, 0, 16,
1232- 17, 19, 2, 6, 7, 8, 9, 11, 10, 3,
1233- 5, 4, 1, 20, 21, 22, 23, 24, 0, 0,
1234- 13, 0, 0, 18, 12, 14, 15
1235+ 0, 0, 0, 0, 0, 0, 20, 19, 0, 0,
1236+ 25, 26, 28, 0, 2, 0, 15, 17, 6, 7,
1237+ 8, 9, 11, 10, 3, 5, 4, 1, 0, 0,
1238+ 0, 22, 0, 14, 0, 0, 29, 30, 31, 32,
1239+ 33, 0, 0, 0, 0, 21, 18, 0, 23, 24,
1240+ 12, 13, 27, 16
1241 };
1242
1243 /* YYPGOTO[NTERM-NUM]. */
1244 const signed char
1245 Parser::yypgoto_[] =
1246 {
1247- -5, -5, -2, 20, -5, -5, -5, -5, -5, -5
1248+ -29, -29, 2, -8, -12, -28, 22, -29, -29, -29,
1249+ -29, -29, -29
1250 };
1251
1252 /* YYDEFGOTO[NTERM-NUM]. */
1253 const signed char
1254 Parser::yydefgoto_[] =
1255 {
1256- -1, 5, 12, 13, 14, 15, 16, 17, 18, 28
1257+ -1, 5, 28, 15, 16, 17, 18, 19, 20, 21,
1258+ 22, 23, 43
1259 };
1260
1261 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1262@@ -1026,20 +1106,26 @@
1263 const unsigned char
1264 Parser::yytable_[] =
1265 {
1266- 19, 20, 21, 6, 22, 29, 23, 24, 25, 26,
1267- 27, 34, 31, 32, 7, 31, 32, 7, 8, 9,
1268- 10, 11, 1, 2, 3, 4, 33, 32, 30, 35,
1269- 36
1270+ 29, 33, 6, 14, 24, 25, 26, 27, 7, 45,
1271+ 34, 35, 35, 8, 34, 35, 53, 9, 10, 11,
1272+ 12, 6, 13, 30, 47, 41, 42, 7, 6, 50,
1273+ 51, 31, 32, 0, 7, 52, 48, 49, 44, 32,
1274+ 0, 13, 36, 37, 38, 39, 40, 36, 37, 38,
1275+ 39, 40, 0, 46, 0, 46, 1, 2, 3, 4,
1276+ 41, 42, 41, 42, 0, 41, 42
1277 };
1278
1279 /* YYCHECK. */
1280- const unsigned char
1281+ const signed char
1282 Parser::yycheck_[] =
1283 {
1284- 2, 3, 4, 3, 0, 7, 4, 5, 6, 7,
1285- 8, 15, 16, 17, 14, 16, 17, 14, 18, 19,
1286- 20, 21, 10, 11, 12, 13, 9, 17, 8, 31,
1287- 32
1288+ 8, 13, 3, 1, 2, 3, 4, 0, 9, 15,
1289+ 16, 17, 17, 14, 16, 17, 44, 18, 19, 20,
1290+ 21, 3, 23, 14, 32, 22, 23, 9, 3, 41,
1291+ 42, 9, 14, -1, 9, 43, 34, 35, 24, 14,
1292+ -1, 23, 4, 5, 6, 7, 8, 4, 5, 6,
1293+ 7, 8, -1, 15, -1, 15, 10, 11, 12, 13,
1294+ 22, 23, 22, 23, -1, 22, 23
1295 };
1296
1297 /* STOS_[STATE-NUM] -- The (internal number of the) accessing
1298@@ -1047,10 +1133,12 @@
1299 const unsigned char
1300 Parser::yystos_[] =
1301 {
1302- 0, 10, 11, 12, 13, 23, 3, 14, 18, 19,
1303- 20, 21, 24, 25, 26, 27, 28, 29, 30, 24,
1304- 24, 24, 0, 4, 5, 6, 7, 8, 31, 24,
1305- 25, 16, 17, 9, 15, 24, 24
1306+ 0, 10, 11, 12, 13, 26, 3, 9, 14, 18,
1307+ 19, 20, 21, 23, 27, 28, 29, 30, 31, 32,
1308+ 33, 34, 35, 36, 27, 27, 27, 0, 27, 28,
1309+ 14, 31, 14, 29, 16, 17, 4, 5, 6, 7,
1310+ 8, 22, 23, 37, 24, 15, 15, 28, 27, 27,
1311+ 29, 29, 28, 30
1312 };
1313
1314 #if YYDEBUG
1315@@ -1061,7 +1149,7 @@
1316 {
1317 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1318 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1319- 275, 276
1320+ 275, 276, 277, 278, 279
1321 };
1322 #endif
1323
1324@@ -1069,9 +1157,10 @@
1325 const unsigned char
1326 Parser::yyr1_[] =
1327 {
1328- 0, 22, 23, 23, 23, 23, 24, 24, 24, 24,
1329- 24, 24, 25, 26, 27, 28, 29, 29, 30, 30,
1330- 31, 31, 31, 31, 31
1331+ 0, 25, 26, 26, 26, 26, 27, 27, 27, 27,
1332+ 27, 27, 28, 28, 28, 28, 29, 29, 30, 30,
1333+ 30, 31, 32, 33, 34, 35, 35, 36, 36, 37,
1334+ 37, 37, 37, 37
1335 };
1336
1337 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1338@@ -1079,8 +1168,9 @@
1339 Parser::yyr2_[] =
1340 {
1341 0, 2, 2, 2, 2, 2, 1, 1, 1, 1,
1342- 1, 1, 3, 2, 3, 3, 1, 1, 3, 1,
1343- 1, 1, 1, 1, 1
1344+ 1, 1, 3, 3, 2, 1, 3, 1, 3, 1,
1345+ 1, 3, 2, 3, 3, 1, 1, 3, 1, 1,
1346+ 1, 1, 1, 1
1347 };
1348
1349
1350@@ -1092,9 +1182,11 @@
1351 "END", "error", "$undefined", "IDENTIFIER", "LESS", "LESSEQUAL",
1352 "EQUAL", "GREATEREQUAL", "GREATER", "NUMBER", "EF", "AG", "AF", "EG",
1353 "LPARAN", "RPARAN", "OR", "AND", "NOT", "BOOL_TRUE", "BOOL_FALSE",
1354- "DEADLOCK", "$accept", "query", "expression", "parExpression",
1355- "notExpression", "orExpression", "andExpression", "boolExpression",
1356- "atomicProposition", "compareOp", YY_NULL
1357+ "DEADLOCK", "PLUS", "MINUS", "MULTIPLY", "$accept", "query",
1358+ "expression", "arithmeticExpression", "multiplyExpression",
1359+ "arithmeticParantheses", "parExpression", "notExpression",
1360+ "orExpression", "andExpression", "boolExpression", "atomicProposition",
1361+ "compareOp", YY_NULL
1362 };
1363
1364 #if YYDEBUG
1365@@ -1102,13 +1194,15 @@
1366 const Parser::rhs_number_type
1367 Parser::yyrhs_[] =
1368 {
1369- 23, 0, -1, 10, 24, -1, 11, 24, -1, 13,
1370- 24, -1, 12, 24, -1, 25, -1, 26, -1, 27,
1371- -1, 28, -1, 30, -1, 29, -1, 14, 24, 15,
1372- -1, 18, 25, -1, 24, 16, 24, -1, 24, 17,
1373- 24, -1, 19, -1, 20, -1, 3, 31, 9, -1,
1374- 21, -1, 4, -1, 5, -1, 6, -1, 7, -1,
1375- 8, -1
1376+ 26, 0, -1, 10, 27, -1, 11, 27, -1, 13,
1377+ 27, -1, 12, 27, -1, 31, -1, 32, -1, 33,
1378+ -1, 34, -1, 36, -1, 35, -1, 28, 22, 29,
1379+ -1, 28, 23, 29, -1, 23, 29, -1, 29, -1,
1380+ 29, 24, 30, -1, 30, -1, 14, 28, 15, -1,
1381+ 9, -1, 3, -1, 14, 27, 15, -1, 18, 31,
1382+ -1, 27, 16, 27, -1, 27, 17, 27, -1, 19,
1383+ -1, 20, -1, 28, 37, 28, -1, 21, -1, 4,
1384+ -1, 5, -1, 6, -1, 7, -1, 8, -1
1385 };
1386
1387 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1388@@ -1117,17 +1211,19 @@
1389 Parser::yyprhs_[] =
1390 {
1391 0, 0, 3, 6, 9, 12, 15, 17, 19, 21,
1392- 23, 25, 27, 31, 34, 38, 42, 44, 46, 50,
1393- 52, 54, 56, 58, 60
1394+ 23, 25, 27, 31, 35, 38, 40, 44, 46, 50,
1395+ 52, 54, 58, 61, 65, 69, 71, 73, 77, 79,
1396+ 81, 83, 85, 87
1397 };
1398
1399 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1400 const unsigned char
1401 Parser::yyrline_[] =
1402 {
1403- 0, 59, 59, 60, 61, 62, 65, 66, 67, 68,
1404- 69, 70, 76, 77, 78, 79, 80, 81, 82, 89,
1405- 90, 90, 90, 90, 90
1406+ 0, 62, 62, 63, 64, 65, 68, 69, 70, 71,
1407+ 72, 73, 79, 80, 81, 82, 85, 86, 89, 90,
1408+ 91, 99, 100, 101, 102, 103, 104, 106, 107, 109,
1409+ 109, 109, 109, 109
1410 };
1411
1412 // Print the state stack on the debug stream.
1413@@ -1194,7 +1290,7 @@
1414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1415 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1416 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1417- 15, 16, 17, 18, 19, 20, 21
1418+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
1419 };
1420 if ((unsigned int) t <= yyuser_token_number_max_)
1421 return translate_table[t];
1422@@ -1203,24 +1299,24 @@
1423 }
1424
1425 const int Parser::yyeof_ = 0;
1426- const int Parser::yylast_ = 30;
1427- const int Parser::yynnts_ = 10;
1428+ const int Parser::yylast_ = 66;
1429+ const int Parser::yynnts_ = 13;
1430 const int Parser::yyempty_ = -2;
1431- const int Parser::yyfinal_ = 22;
1432+ const int Parser::yyfinal_ = 27;
1433 const int Parser::yyterror_ = 1;
1434 const int Parser::yyerrcode_ = 256;
1435- const int Parser::yyntokens_ = 22;
1436+ const int Parser::yyntokens_ = 25;
1437
1438- const unsigned int Parser::yyuser_token_number_max_ = 276;
1439+ const unsigned int Parser::yyuser_token_number_max_ = 279;
1440 const Parser::token_number_type Parser::yyundef_token_ = 2;
1441
1442 /* Line 1135 of lalr1.cc */
1443 #line 5 "Core/QueryParser/grammar.yy"
1444 } // VerifyTAPN
1445 /* Line 1135 of lalr1.cc */
1446-#line 1222 "Core/QueryParser/Generated/parser.cpp"
1447+#line 1318 "Core/QueryParser/Generated/parser.cpp"
1448 /* Line 1136 of lalr1.cc */
1449-#line 92 "Core/QueryParser/grammar.yy"
1450+#line 111 "Core/QueryParser/grammar.yy"
1451
1452
1453 void
1454
1455=== modified file 'src/Core/QueryParser/Generated/parser.hpp'
1456--- src/Core/QueryParser/Generated/parser.hpp 2013-08-28 19:51:15 +0000
1457+++ src/Core/QueryParser/Generated/parser.hpp 2014-03-20 14:00:01 +0000
1458@@ -84,12 +84,13 @@
1459
1460 int number;
1461 std::string* string;
1462- VerifyTAPN::AST::Expression* expr;
1463- VerifyTAPN::AST::Query* query;
1464+ VerifyTAPN::AST::Expression* expr;
1465+ VerifyTAPN::AST::ArithmeticExpression* arexpr;
1466+ VerifyTAPN::AST::Query* query;
1467
1468
1469 /* Line 33 of lalr1.cc */
1470-#line 93 "Core/QueryParser/Generated/parser.hpp"
1471+#line 94 "Core/QueryParser/Generated/parser.hpp"
1472 };
1473 #else
1474 typedef YYSTYPE semantic_type;
1475@@ -120,7 +121,10 @@
1476 NOT = 273,
1477 BOOL_TRUE = 274,
1478 BOOL_FALSE = 275,
1479- DEADLOCK = 276
1480+ DEADLOCK = 276,
1481+ PLUS = 277,
1482+ MINUS = 278,
1483+ MULTIPLY = 279
1484 };
1485
1486 };
1487@@ -229,7 +233,7 @@
1488 static const unsigned char yytable_[];
1489 static const signed char yytable_ninf_;
1490
1491- static const unsigned char yycheck_[];
1492+ static const signed char yycheck_[];
1493
1494 /// For a state, its accessing symbol.
1495 static const unsigned char yystos_[];
1496@@ -303,7 +307,7 @@
1497 #line 5 "Core/QueryParser/grammar.yy"
1498 } // VerifyTAPN
1499 /* Line 33 of lalr1.cc */
1500-#line 307 "Core/QueryParser/Generated/parser.hpp"
1501+#line 311 "Core/QueryParser/Generated/parser.hpp"
1502
1503
1504
1505
1506=== modified file 'src/Core/QueryParser/NormalizationVisitor.cpp'
1507--- src/Core/QueryParser/NormalizationVisitor.cpp 2013-08-13 20:59:28 +0000
1508+++ src/Core/QueryParser/NormalizationVisitor.cpp 2014-03-20 14:00:01 +0000
1509@@ -14,14 +14,6 @@
1510 tuple.returnExpr = static_cast<Tuple&>(any).returnExpr;
1511 }
1512
1513- void NormalizationVisitor::visit(const ParExpression& expr, Result& context)
1514- {
1515- Tuple& tuple = static_cast<Tuple&>(context);
1516- Tuple any = Tuple(tuple.negate, NULL);
1517- expr.getChild().accept(*this, any);
1518- tuple.returnExpr = new ParExpression(static_cast<Tuple&>(any).returnExpr);
1519- }
1520-
1521 void NormalizationVisitor::visit(const OrExpression& expr, Result& context)
1522 {
1523 Tuple& tuple = static_cast<Tuple&>(context);
1524@@ -61,10 +53,28 @@
1525 }else{
1526 op = expr.getOperator();
1527 }
1528- tuple.returnExpr = new AtomicProposition(expr.getPlace(), &op, expr.getNumberOfTokens());
1529+ tuple.returnExpr = new AtomicProposition(&expr.getLeft(), &op, &expr.getRight());// dont visit arithmetics for now
1530 }
1531-
1532- void NormalizationVisitor::visit(const DeadlockExpression& expr, Result& context) {
1533+
1534+ void NormalizationVisitor::visit(const NumberExpression& expr, Result& context){
1535+ }
1536+
1537+ void NormalizationVisitor::visit(const IdentifierExpression& expr, Result& context){
1538+ }
1539+
1540+ void NormalizationVisitor::visit(const MultiplyExpression& expr, Result& context){
1541+ }
1542+
1543+ void NormalizationVisitor::visit(const MinusExpression& expr, Result& context){
1544+ }
1545+
1546+ void NormalizationVisitor::visit(const SubtractExpression& expr, Result& context){
1547+ }
1548+
1549+ void NormalizationVisitor::visit(const PlusExpression& expr, Result& context){
1550+ }
1551+
1552+ void NormalizationVisitor::visit(const DeadlockExpression& expr, Result& context) {
1553 Tuple& tuple = static_cast<Tuple&>(context);
1554 tuple.returnExpr = new DeadlockExpression();
1555 }
1556
1557=== modified file 'src/Core/QueryParser/NormalizationVisitor.hpp'
1558--- src/Core/QueryParser/NormalizationVisitor.hpp 2013-08-09 21:47:22 +0000
1559+++ src/Core/QueryParser/NormalizationVisitor.hpp 2014-03-20 14:00:01 +0000
1560@@ -28,13 +28,18 @@
1561 virtual ~NormalizationVisitor() {};
1562
1563 virtual void visit(const NotExpression& expr, Result& context);
1564- virtual void visit(const ParExpression& expr, Result& context);
1565 virtual void visit(const OrExpression& expr, Result& context);
1566 virtual void visit(const AndExpression& expr, Result& context);
1567 virtual void visit(const AtomicProposition& expr, Result& context);
1568 virtual void visit(const BoolExpression& expr, Result& context);
1569 virtual void visit(const Query& query, Result& context);
1570 virtual void visit(const DeadlockExpression& expr, Result& context);
1571+ virtual void visit(const NumberExpression& expr, Result& context);
1572+ virtual void visit(const IdentifierExpression& expr, Result& context);
1573+ virtual void visit(const MultiplyExpression& expr, Result& context);
1574+ virtual void visit(const MinusExpression& expr, Result& context);
1575+ virtual void visit(const SubtractExpression& expr, Result& context);
1576+ virtual void visit(const PlusExpression& expr, Result& context);
1577
1578 AST::Query* normalize(const AST::Query& query) { Tuple any(false, NULL); query.accept(*this, any);
1579 return normalizedQuery; };
1580
1581=== modified file 'src/Core/QueryParser/Visitor.hpp'
1582--- src/Core/QueryParser/Visitor.hpp 2013-08-09 21:47:22 +0000
1583+++ src/Core/QueryParser/Visitor.hpp 2014-03-20 14:00:01 +0000
1584@@ -8,12 +8,20 @@
1585 namespace AST
1586 {
1587 class NotExpression;
1588- class ParExpression;
1589 class OrExpression;
1590 class AndExpression;
1591 class AtomicProposition;
1592 class DeadlockExpression;
1593 class BoolExpression;
1594+ class NumberExpression;
1595+ class IdentifierExpression;
1596+ class MultiplyExpression;
1597+ class MinusExpression;
1598+ class SubtractExpression;
1599+ class PlusExpression;
1600+ class ArithmeticExpression;
1601+
1602+
1603 class Query;
1604
1605 class Result {};
1606@@ -28,13 +36,18 @@
1607 public:
1608 virtual ~Visitor() { };
1609 virtual void visit(const NotExpression& expr, Result& context) = 0;
1610- virtual void visit(const ParExpression& expr, Result& context) = 0;
1611 virtual void visit(const OrExpression& expr, Result& context) = 0;
1612 virtual void visit(const AndExpression& expr, Result& context) = 0;
1613 virtual void visit(const AtomicProposition& expr, Result& context) = 0;
1614 virtual void visit(const BoolExpression& expr, Result& context) = 0;
1615 virtual void visit(const Query& query, Result& context) = 0;
1616 virtual void visit(const DeadlockExpression& expr, Result& context) = 0;
1617+ virtual void visit(const NumberExpression& expr, Result& context) = 0;
1618+ virtual void visit(const IdentifierExpression& expr, Result& context) = 0;
1619+ virtual void visit(const MultiplyExpression& expr, Result& context) = 0;
1620+ virtual void visit(const MinusExpression& expr, Result& context) = 0;
1621+ virtual void visit(const SubtractExpression& expr, Result& context) = 0;
1622+ virtual void visit(const PlusExpression& expr, Result& context) = 0;
1623 };
1624 }
1625 }
1626
1627=== modified file 'src/Core/QueryParser/flex.ll'
1628--- src/Core/QueryParser/flex.ll 2013-04-08 19:04:49 +0000
1629+++ src/Core/QueryParser/flex.ll 2014-03-20 14:00:01 +0000
1630@@ -47,14 +47,18 @@
1631 false { return token::BOOL_FALSE; }
1632 deadlock { return token::DEADLOCK; }
1633 "!"|not { return token::NOT; }
1634-"(" { return token::LPARAN; }
1635-")" { return token::RPARAN; }
1636 "<" { yylval->string = new std::string(yytext); return token::LESS; }
1637 "<=" { yylval->string = new std::string(yytext); return token::LESSEQUAL; }
1638 "=" { yylval->string = new std::string(yytext); return token::EQUAL; }
1639 "==" { yylval->string = new std::string(yytext); return token::EQUAL; }
1640 ">=" { yylval->string = new std::string(yytext); return token::GREATEREQUAL; }
1641 ">" { yylval->string = new std::string(yytext); return token::GREATER; }
1642+"(" {return token::LPARAN;}
1643+")" {return token::RPARAN;}
1644+"+" {return token::PLUS;}
1645+"-" {return token::MINUS;}
1646+"*" {return token::MULTIPLY;}
1647+
1648 [a-zA-Z_][a-zA-Z_0-9]* { yylval->string = new std::string(yytext); return token::IDENTIFIER; }
1649
1650 %%
1651
1652=== modified file 'src/Core/QueryParser/grammar.yy'
1653--- src/Core/QueryParser/grammar.yy 2013-08-10 15:15:43 +0000
1654+++ src/Core/QueryParser/grammar.yy 2014-03-20 14:00:01 +0000
1655@@ -30,8 +30,9 @@
1656 {
1657 int number;
1658 std::string* string;
1659- VerifyTAPN::AST::Expression* expr;
1660- VerifyTAPN::AST::Query* query;
1661+ VerifyTAPN::AST::Expression* expr;
1662+ VerifyTAPN::AST::ArithmeticExpression* arexpr;
1663+ VerifyTAPN::AST::Query* query;
1664 };
1665
1666 %code{
1667@@ -46,48 +47,66 @@
1668 %token OR AND NOT
1669 %token BOOL_TRUE BOOL_FALSE
1670 %token DEADLOCK
1671-%type <expr> expression notExpression parExpression orExpression andExpression boolExpression atomicProposition
1672+%token PLUS MINUS MULTIPLY
1673+%type <expr> expression notExpression parExpression orExpression andExpression boolExpression atomicProposition
1674+%type <arexpr> arithmeticExpression multiplyExpression arithmeticParantheses
1675 %type <query> query
1676 %type <string> compareOp
1677
1678 %destructor { delete $$; } IDENTIFIER LESS LESSEQUAL EQUAL GREATEREQUAL GREATER compareOp
1679-%destructor { delete $$; } expression notExpression parExpression orExpression andExpression boolExpression atomicProposition
1680+%destructor { delete $$; } expression notExpression parExpression orExpression andExpression boolExpression atomicProposition arithmeticExpression multiplyExpression arithmeticParantheses
1681 %destructor { delete $$; } query
1682
1683 %%
1684 %start query;
1685-query : EF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EF, $2); driver.setAST($$); }
1686- | AG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AG, $2); driver.setAST($$); }
1687- | EG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EG, $2); driver.setAST($$); }
1688- | AF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AF, $2); driver.setAST($$); }
1689-;
1690+query : EF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EF, $2); driver.setAST($$); }
1691+ | AG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AG, $2); driver.setAST($$); }
1692+ | EG expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::EG, $2); driver.setAST($$); }
1693+ | AF expression { $$ = new VerifyTAPN::AST::Query(VerifyTAPN::AST::AF, $2); driver.setAST($$); }
1694+ ;
1695
1696-expression : parExpression { $$ = $1; }
1697- | notExpression { $$ = $1; }
1698- | orExpression { $$ = $1; }
1699- | andExpression { $$ = $1; }
1700- | atomicProposition { $$ = $1; }
1701- | boolExpression { $$ = $1; }
1702-;
1703+expression : parExpression { $$ = $1; }
1704+ | notExpression { $$ = $1; }
1705+ | orExpression { $$ = $1; }
1706+ | andExpression { $$ = $1; }
1707+ | atomicProposition { $$ = $1; }
1708+ | boolExpression { $$ = $1; }
1709+ ;
1710
1711 %left OR;
1712 %left AND;
1713
1714-parExpression : LPARAN expression RPARAN { $$ = new VerifyTAPN::AST::ParExpression($2); };
1715-notExpression : NOT parExpression { $$ = new VerifyTAPN::AST::NotExpression($2); };
1716-orExpression : expression OR expression { $$ = new VerifyTAPN::AST::OrExpression($1, $3); };
1717+arithmeticExpression : arithmeticExpression PLUS multiplyExpression { $$ = new VerifyTAPN::AST::PlusExpression($1, $3); }
1718+ | arithmeticExpression MINUS multiplyExpression { $$ = new VerifyTAPN::AST::SubtractExpression($1, $3); }
1719+ | MINUS multiplyExpression { $$ = new VerifyTAPN::AST::MinusExpression($2); }
1720+ | multiplyExpression { $$ = $1; }
1721+ ;
1722+
1723+multiplyExpression : multiplyExpression MULTIPLY arithmeticParantheses { $$ = new VerifyTAPN::AST::MultiplyExpression($1, $3); }
1724+ | arithmeticParantheses { $$ = $1; }
1725+ ;
1726+
1727+arithmeticParantheses : LPARAN arithmeticExpression RPARAN { $$ = $2; }
1728+ | NUMBER { $$ = new VerifyTAPN::AST::NumberExpression($1);}
1729+ | IDENTIFIER {
1730+ int placeIndex = driver.getTAPN().getPlaceIndex(*$1);
1731+ delete $1;
1732+ if(placeIndex == -1) error(@1, "unknown place");
1733+ $$ = new VerifyTAPN::AST::IdentifierExpression(placeIndex);
1734+ }
1735+ ;
1736+
1737+parExpression : LPARAN expression RPARAN { $$ = $2; };
1738+notExpression : NOT parExpression { $$ = new VerifyTAPN::AST::NotExpression($2); };
1739+orExpression : expression OR expression { $$ = new VerifyTAPN::AST::OrExpression($1, $3); };
1740 andExpression : expression AND expression { $$ = new VerifyTAPN::AST::AndExpression($1, $3); };
1741-boolExpression : BOOL_TRUE { $$ = new VerifyTAPN::AST::BoolExpression(true); }
1742- | BOOL_FALSE { $$ = new VerifyTAPN::AST::BoolExpression(false); };
1743-atomicProposition : IDENTIFIER compareOp NUMBER
1744- {
1745- int placeIndex = driver.getTAPN().getPlaceIndex(*$1);
1746- delete $1;
1747- if(placeIndex == -1) error(@1, "unknown place");
1748- $$ = new VerifyTAPN::AST::AtomicProposition(placeIndex, $2, $3);
1749- delete $2;
1750- } | DEADLOCK { $$ = new VerifyTAPN::AST::DeadlockExpression(); } ;
1751-compareOp : LESS | LESSEQUAL | EQUAL | GREATEREQUAL | GREATER;
1752+boolExpression : BOOL_TRUE { $$ = new VerifyTAPN::AST::BoolExpression(true); }
1753+ | BOOL_FALSE { $$ = new VerifyTAPN::AST::BoolExpression(false); };
1754+
1755+atomicProposition : arithmeticExpression compareOp arithmeticExpression { $$ = new VerifyTAPN::AST::AtomicProposition($1, $2, $3); }
1756+ | DEADLOCK { $$ = new VerifyTAPN::AST::DeadlockExpression(); } ;
1757+
1758+compareOp : LESS | LESSEQUAL | EQUAL | GREATEREQUAL | GREATER;
1759
1760 %%
1761
1762
1763=== modified file 'src/DiscreteVerification/DeadlockVisitor.cpp'
1764--- src/DiscreteVerification/DeadlockVisitor.cpp 2013-08-09 21:47:22 +0000
1765+++ src/DiscreteVerification/DeadlockVisitor.cpp 2014-03-20 14:00:01 +0000
1766@@ -16,10 +16,6 @@
1767 expr.getChild().accept(*this, context);
1768 }
1769
1770- void DeadlockVisitor::visit(const ParExpression& expr, Result& context) {
1771- expr.getChild().accept(*this, context);
1772- }
1773-
1774 void DeadlockVisitor::visit(const OrExpression& expr, Result& context) {
1775 BoolResult left, right;
1776 expr.getLeft().accept(*this, left);
1777@@ -53,5 +49,29 @@
1778 void DeadlockVisitor::visit(const DeadlockExpression& expr, Result& context) {
1779 static_cast<BoolResult&>(context).value = true;
1780 }
1781+
1782+ void DeadlockVisitor::visit(const NumberExpression& expr, Result& context){
1783+ static_cast<BoolResult&>(context).value = false;
1784+ }
1785+
1786+ void DeadlockVisitor::visit(const IdentifierExpression& expr, Result& context){
1787+ static_cast<BoolResult&>(context).value = false;
1788+ }
1789+
1790+ void DeadlockVisitor::visit(const MultiplyExpression& expr, Result& context){
1791+ static_cast<BoolResult&>(context).value = false;
1792+ }
1793+
1794+ void DeadlockVisitor::visit(const MinusExpression& expr, Result& context){
1795+ static_cast<BoolResult&>(context).value = false;
1796+ }
1797+
1798+ void DeadlockVisitor::visit(const SubtractExpression& expr, Result& context){
1799+ static_cast<BoolResult&>(context).value = false;
1800+ }
1801+
1802+ void DeadlockVisitor::visit(const PlusExpression& expr, Result& context){
1803+ static_cast<BoolResult&>(context).value = false;
1804+ }
1805 }
1806 }
1807
1808=== modified file 'src/DiscreteVerification/DeadlockVisitor.hpp'
1809--- src/DiscreteVerification/DeadlockVisitor.hpp 2013-08-13 20:59:28 +0000
1810+++ src/DiscreteVerification/DeadlockVisitor.hpp 2014-03-20 14:00:01 +0000
1811@@ -28,13 +28,18 @@
1812
1813 public: // visitor methods
1814 virtual void visit(const NotExpression& expr, Result& context);
1815- virtual void visit(const ParExpression& expr, Result& context);
1816 virtual void visit(const OrExpression& expr, Result& context);
1817 virtual void visit(const AndExpression& expr, Result& context);
1818 virtual void visit(const AtomicProposition& expr, Result& context);
1819 virtual void visit(const BoolExpression& expr, Result& context);
1820 virtual void visit(const Query& query, Result& context);
1821 virtual void visit(const DeadlockExpression& expr, Result& context);
1822+ virtual void visit(const NumberExpression& expr, Result& context);
1823+ virtual void visit(const IdentifierExpression& expr, Result& context);
1824+ virtual void visit(const MultiplyExpression& expr, Result& context);
1825+ virtual void visit(const MinusExpression& expr, Result& context);
1826+ virtual void visit(const SubtractExpression& expr, Result& context);
1827+ virtual void visit(const PlusExpression& expr, Result& context);
1828
1829 };
1830 } /* namespace DiscreteVerification */
1831
1832=== modified file 'src/DiscreteVerification/PlaceVisitor.cpp'
1833--- src/DiscreteVerification/PlaceVisitor.cpp 2013-08-09 21:47:22 +0000
1834+++ src/DiscreteVerification/PlaceVisitor.cpp 2014-03-20 14:00:01 +0000
1835@@ -15,11 +15,6 @@
1836 expr.getChild().accept(*this, context);
1837 }
1838
1839- void PlaceVisitor::visit(const ParExpression& expr, Result& context)
1840- {
1841- expr.getChild().accept(*this, context);
1842- }
1843-
1844 void PlaceVisitor::visit(const OrExpression& expr, Result& context)
1845 {
1846 expr.getLeft().accept(*this, context);
1847@@ -34,8 +29,8 @@
1848
1849 void PlaceVisitor::visit(const AtomicProposition& expr, Result& context)
1850 {
1851- AST::IntVectorResult& v = static_cast< AST::IntVectorResult & >(context);
1852- v.value.push_back(expr.getPlace());
1853+ expr.getLeft().accept(*this,context);
1854+ expr.getRight().accept(*this,context);
1855 }
1856
1857 void PlaceVisitor::visit(const DeadlockExpression& expr, Result& context)
1858@@ -50,5 +45,21 @@
1859 {
1860 query.getChild().accept(*this, context);
1861 }
1862+
1863+ void PlaceVisitor::visit(const NumberExpression& expr, Result& context){};
1864+
1865+ void PlaceVisitor::visit(const IdentifierExpression& expr, Result& context){
1866+ AST::IntVectorResult& v = static_cast< AST::IntVectorResult & >(context);
1867+ v.value.push_back(expr.getPlace());
1868+ };
1869+
1870+ void PlaceVisitor::visit(const MinusExpression& expr, Result& context){
1871+ expr.getValue().accept(*this,context);
1872+ };
1873+
1874+ void PlaceVisitor::visit(const OperationExpression& expr, Result& context){
1875+ expr.getLeft().accept(*this,context);
1876+ expr.getRight().accept(*this,context);
1877+ };
1878 } /* namespace DiscreteVerification */
1879 } /* namespace VerifyTAPN */
1880
1881=== modified file 'src/DiscreteVerification/PlaceVisitor.hpp'
1882--- src/DiscreteVerification/PlaceVisitor.hpp 2013-08-09 21:47:22 +0000
1883+++ src/DiscreteVerification/PlaceVisitor.hpp 2014-03-20 14:00:01 +0000
1884@@ -25,13 +25,19 @@
1885
1886 public: // visitor methods
1887 virtual void visit(const NotExpression& expr, Result& context);
1888- virtual void visit(const ParExpression& expr, Result& context);
1889 virtual void visit(const OrExpression& expr, Result& context);
1890 virtual void visit(const AndExpression& expr, Result& context);
1891 virtual void visit(const AtomicProposition& expr, Result& context);
1892 virtual void visit(const BoolExpression& expr, Result& context);
1893 virtual void visit(const Query& query, Result& context);
1894 virtual void visit(const DeadlockExpression& expr, Result& context);
1895+ virtual void visit(const NumberExpression& expr, Result& context);
1896+ virtual void visit(const IdentifierExpression& expr, Result& context);
1897+ virtual void visit(const MinusExpression& expr, Result& context);
1898+ virtual void visit(const OperationExpression& expr, Result& context);
1899+ virtual void visit(const MultiplyExpression& expr, Result& context){visit((OperationExpression&)expr, context);};
1900+ virtual void visit(const SubtractExpression& expr, Result& context){visit((OperationExpression&)expr, context);};;
1901+ virtual void visit(const PlusExpression& expr, Result& context){visit((OperationExpression&)expr, context);};;
1902 };
1903
1904 } /* namespace DiscreteVerification */
1905
1906=== modified file 'src/DiscreteVerification/QueryVisitor.hpp'
1907--- src/DiscreteVerification/QueryVisitor.hpp 2013-08-19 09:20:39 +0000
1908+++ src/DiscreteVerification/QueryVisitor.hpp 2014-03-20 14:00:01 +0000
1909@@ -34,17 +34,22 @@
1910
1911 virtual ~QueryVisitor() {
1912 };
1913-
1914+
1915 public: // visitor methods
1916
1917 virtual void visit(const NotExpression& expr, AST::Result& context);
1918- virtual void visit(const ParExpression& expr, AST::Result& context);
1919 virtual void visit(const OrExpression& expr, AST::Result& context);
1920 virtual void visit(const AndExpression& expr, AST::Result& context);
1921 virtual void visit(const AtomicProposition& expr, AST::Result& context);
1922 virtual void visit(const BoolExpression& expr, AST::Result& context);
1923 virtual void visit(const Query& query, AST::Result& context);
1924 virtual void visit(const DeadlockExpression& expr, AST::Result& context);
1925+ virtual void visit(const NumberExpression& expr, AST::Result& context);
1926+ virtual void visit(const IdentifierExpression& expr, AST::Result& context);
1927+ virtual void visit(const MultiplyExpression& expr, AST::Result& context);
1928+ virtual void visit(const MinusExpression& expr, AST::Result& context);
1929+ virtual void visit(const SubtractExpression& expr, AST::Result& context);
1930+ virtual void visit(const PlusExpression& expr, AST::Result& context);
1931 private:
1932 bool compare(int numberOfTokensInPlace, const std::string& op, int n) const;
1933
1934@@ -64,11 +69,6 @@
1935 }
1936
1937 template<typename T>
1938- void QueryVisitor<T>::visit(const ParExpression& expr, AST::Result& context) {
1939- expr.getChild().accept(*this, context);
1940- }
1941-
1942- template<typename T>
1943 void QueryVisitor<T>::visit(const OrExpression& expr, AST::Result& context) {
1944 BoolResult left, right;
1945 expr.getLeft().accept(*this, left);
1946@@ -98,9 +98,13 @@
1947 template<typename T>
1948
1949 void QueryVisitor<T>::visit(const AtomicProposition& expr, AST::Result& context) {
1950- int numberOfTokens = marking.numberOfTokensInPlace(expr.getPlace());
1951+ IntResult left;
1952+ expr.getLeft().accept(*this, left);
1953+ IntResult right;
1954+ expr.getRight().accept(*this, right);
1955+
1956 static_cast<BoolResult&>(context).value
1957- = compare(numberOfTokens, expr.getOperator(), expr.getNumberOfTokens());
1958+ = compare(left.value, expr.getOperator(), right.value);
1959 }
1960
1961 template<typename T>
1962@@ -110,7 +114,50 @@
1963 }
1964
1965 template<typename T>
1966- void QueryVisitor<T>::visit(const Query& query, AST::Result& context) {
1967+ void QueryVisitor<T>::visit(const NumberExpression& expr, AST::Result& context){
1968+ ((IntResult&)context).value = expr.getValue();
1969+ }
1970+
1971+ template<typename T>
1972+ void QueryVisitor<T>::visit(const IdentifierExpression& expr, AST::Result& context){
1973+ ((IntResult&)context).value = marking.numberOfTokensInPlace(expr.getPlace());
1974+ }
1975+ template<typename T>
1976+ void QueryVisitor<T>::visit(const MultiplyExpression& expr, AST::Result& context){
1977+ IntResult left;
1978+ expr.getLeft().accept(*this, left);
1979+ IntResult right;
1980+ expr.getRight().accept(*this, right);
1981+ ((IntResult&)context).value = left.value * right.value;
1982+ }
1983+ template<typename T>
1984+ void QueryVisitor<T>::visit(const MinusExpression& expr, AST::Result& context){
1985+ IntResult value;
1986+ expr.getValue().accept(*this, value);
1987+ ((IntResult&)context).value = -value.value;
1988+ }
1989+
1990+ template<typename T>
1991+ void QueryVisitor<T>::visit(const SubtractExpression& expr, AST::Result& context){
1992+ IntResult left;
1993+ expr.getLeft().accept(*this, left);
1994+ IntResult right;
1995+ expr.getRight().accept(*this, right);
1996+ ((IntResult&)context).value = left.value - right.value;
1997+ }
1998+
1999+ template<typename T>
2000+ void QueryVisitor<T>::visit(const PlusExpression& expr, AST::Result& context){
2001+ IntResult left;
2002+ expr.getLeft().accept(*this, left);
2003+ IntResult right;
2004+ expr.getRight().accept(*this, right);
2005+ ((IntResult&)context).value = left.value + right.value;
2006+ }
2007+
2008+
2009+ template<typename T>
2010+ void QueryVisitor<T>::visit(const Query& query, AST::Result& context) {
2011 query.getChild().accept(*this, context);
2012 if (query.getQuantifier() == AG || query.getQuantifier() == AF) {
2013 static_cast<BoolResult&>(context).value
2014
2015=== modified file 'src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.cpp'
2016--- src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.cpp 2013-08-09 22:46:32 +0000
2017+++ src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.cpp 2014-03-20 14:00:01 +0000
2018@@ -15,11 +15,6 @@
2019 assert(false);
2020 }
2021
2022- void LivenessWeightQueryVisitor::visit(const ParExpression& expr, Result& context)
2023- {
2024- expr.getChild().accept(*this, context);
2025- }
2026-
2027 void LivenessWeightQueryVisitor::visit(const OrExpression& expr, Result& context)
2028 {
2029 IntResult left, right;
2030@@ -52,11 +47,52 @@
2031
2032 void LivenessWeightQueryVisitor::visit(const AtomicProposition& expr, Result& context)
2033 {
2034- int numberOfTokens = marking.numberOfTokensInPlace(expr.getPlace());
2035+ IntResult left;
2036+ expr.getLeft().accept(*this, left);
2037+ IntResult right;
2038+ expr.getLeft().accept(*this, right);
2039 static_cast<IntResult&>(context).value
2040- = compare(numberOfTokens, expr.getOperator(), expr.getNumberOfTokens());
2041+ = compare(left.value, expr.getOperator(), right.value);
2042 }
2043
2044+ void LivenessWeightQueryVisitor::visit(const NumberExpression& expr, Result& context){
2045+ ((IntResult&)context).value = expr.getValue();
2046+ }
2047+
2048+ void LivenessWeightQueryVisitor::visit(const IdentifierExpression& expr, Result& context){
2049+ ((IntResult&)context).value = marking.numberOfTokensInPlace(expr.getPlace());
2050+ }
2051+
2052+ void LivenessWeightQueryVisitor::visit(const MultiplyExpression& expr, Result& context){
2053+ IntResult left;
2054+ expr.getLeft().accept(*this, left);
2055+ IntResult right;
2056+ expr.getLeft().accept(*this, right);
2057+ ((IntResult&)context).value = left.value * right.value;
2058+ }
2059+
2060+ void LivenessWeightQueryVisitor::visit(const MinusExpression& expr, Result& context){
2061+ IntResult value;
2062+ expr.getValue().accept(*this, value);
2063+ ((IntResult&)context).value = -value.value;
2064+ }
2065+
2066+ void LivenessWeightQueryVisitor::visit(const SubtractExpression& expr, Result& context){
2067+ IntResult left;
2068+ expr.getLeft().accept(*this, left);
2069+ IntResult right;
2070+ expr.getLeft().accept(*this, right);
2071+ ((IntResult&)context).value = left.value - right.value;
2072+ }
2073+
2074+ void LivenessWeightQueryVisitor::visit(const PlusExpression& expr, Result& context){
2075+ IntResult left;
2076+ expr.getLeft().accept(*this, left);
2077+ IntResult right;
2078+ expr.getLeft().accept(*this, right);
2079+ ((IntResult&)context).value = left.value + right.value;
2080+ }
2081+
2082 void LivenessWeightQueryVisitor::visit(const BoolExpression& expr, Result& context)
2083 {
2084 static_cast<IntResult&>(context).value
2085
2086=== modified file 'src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.hpp'
2087--- src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.hpp 2013-08-09 21:47:22 +0000
2088+++ src/DiscreteVerification/SearchStrategies/LivenessWeightQueryVisitor.hpp 2014-03-20 14:00:01 +0000
2089@@ -26,13 +26,18 @@
2090
2091 public: // visitor methods
2092 virtual void visit(const NotExpression& expr, Result& context);
2093- virtual void visit(const ParExpression& expr, Result& context);
2094 virtual void visit(const OrExpression& expr, Result& context);
2095 virtual void visit(const AndExpression& expr, Result& context);
2096 virtual void visit(const AtomicProposition& expr, Result& context);
2097 virtual void visit(const BoolExpression& expr, Result& context);
2098 virtual void visit(const Query& query, Result& context);
2099 virtual void visit(const DeadlockExpression& expr, Result& context);
2100+ virtual void visit(const NumberExpression& expr, Result& context);
2101+ virtual void visit(const IdentifierExpression& expr, Result& context);
2102+ virtual void visit(const MultiplyExpression& expr, Result& context);
2103+ virtual void visit(const MinusExpression& expr, Result& context);
2104+ virtual void visit(const SubtractExpression& expr, Result& context);
2105+ virtual void visit(const PlusExpression& expr, Result& context);
2106 private:
2107 int compare(int numberOfTokensInPlace, const std::string& op, int n) const;
2108
2109
2110=== modified file 'src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.cpp'
2111--- src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.cpp 2013-08-09 22:46:32 +0000
2112+++ src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.cpp 2014-03-20 14:00:01 +0000
2113@@ -15,11 +15,6 @@
2114 assert(false);
2115 }
2116
2117- void WeightQueryVisitor::visit(const ParExpression& expr, Result& context)
2118- {
2119- expr.getChild().accept(*this, context);
2120- }
2121-
2122 void WeightQueryVisitor::visit(const OrExpression& expr, Result& context)
2123 {
2124 IntResult left, right;
2125@@ -57,11 +52,52 @@
2126
2127 void WeightQueryVisitor::visit(const AtomicProposition& expr, Result& context)
2128 {
2129- int numberOfTokens = marking.numberOfTokensInPlace(expr.getPlace());
2130+ IntResult left;
2131+ expr.getLeft().accept(*this, left);
2132+ IntResult right;
2133+ expr.getLeft().accept(*this, right);
2134 static_cast<IntResult&>(context).value
2135- = compare(numberOfTokens, expr.getOperator(), expr.getNumberOfTokens());
2136+ = compare(left.value, expr.getOperator(), right.value);
2137 }
2138
2139+ void WeightQueryVisitor::visit(const NumberExpression& expr, Result& context){
2140+ ((IntResult&)context).value = expr.getValue();
2141+ }
2142+
2143+ void WeightQueryVisitor::visit(const IdentifierExpression& expr, Result& context){
2144+ ((IntResult&)context).value = marking.numberOfTokensInPlace(expr.getPlace());
2145+ }
2146+
2147+ void WeightQueryVisitor::visit(const MultiplyExpression& expr, Result& context){
2148+ IntResult left;
2149+ expr.getLeft().accept(*this, left);
2150+ IntResult right;
2151+ expr.getLeft().accept(*this, right);
2152+ ((IntResult&)context).value = left.value * right.value;
2153+ }
2154+
2155+ void WeightQueryVisitor::visit(const MinusExpression& expr, Result& context){
2156+ IntResult value;
2157+ expr.getValue().accept(*this, value);
2158+ ((IntResult&)context).value = -value.value;
2159+ }
2160+
2161+ void WeightQueryVisitor::visit(const SubtractExpression& expr, Result& context){
2162+ IntResult left;
2163+ expr.getLeft().accept(*this, left);
2164+ IntResult right;
2165+ expr.getLeft().accept(*this, right);
2166+ ((IntResult&)context).value = left.value - right.value;
2167+ }
2168+
2169+ void WeightQueryVisitor::visit(const PlusExpression& expr, Result& context){
2170+ IntResult left;
2171+ expr.getLeft().accept(*this, left);
2172+ IntResult right;
2173+ expr.getLeft().accept(*this, right);
2174+ ((IntResult&)context).value = left.value + right.value;
2175+ }
2176+
2177 void WeightQueryVisitor::visit(const BoolExpression& expr, Result& context)
2178 {
2179 static_cast<IntResult&>(context).value
2180
2181=== modified file 'src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.hpp'
2182--- src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.hpp 2013-08-09 21:47:22 +0000
2183+++ src/DiscreteVerification/SearchStrategies/WeightQueryVisitor.hpp 2014-03-20 14:00:01 +0000
2184@@ -26,13 +26,18 @@
2185
2186 public: // visitor methods
2187 virtual void visit(const NotExpression& expr, Result& context);
2188- virtual void visit(const ParExpression& expr, Result& context);
2189 virtual void visit(const OrExpression& expr, Result& context);
2190 virtual void visit(const AndExpression& expr, Result& context);
2191 virtual void visit(const AtomicProposition& expr, Result& context);
2192 virtual void visit(const BoolExpression& expr, Result& context);
2193 virtual void visit(const Query& query, Result& context);
2194 virtual void visit(const DeadlockExpression& expr, Result& context);
2195+ virtual void visit(const NumberExpression& expr, Result& context);
2196+ virtual void visit(const IdentifierExpression& expr, Result& context);
2197+ virtual void visit(const MultiplyExpression& expr, Result& context);
2198+ virtual void visit(const MinusExpression& expr, Result& context);
2199+ virtual void visit(const SubtractExpression& expr, Result& context);
2200+ virtual void visit(const PlusExpression& expr, Result& context);
2201 private:
2202 int compare(int numberOfTokensInPlace, const std::string& op, int n) const;
2203

Subscribers

People subscribed via source and target branches