]>
Commit | Line | Data |
---|---|---|
b4aa79af JF |
1 | /* Cycript - Remove Execution Server and Disassembler |
2 | * Copyright (C) 2009 Jay Freeman (saurik) | |
3 | */ | |
4 | ||
5 | /* Modified BSD License {{{ */ | |
6 | /* | |
7 | * Redistribution and use in source and binary | |
8 | * forms, with or without modification, are permitted | |
9 | * provided that the following conditions are met: | |
10 | * | |
11 | * 1. Redistributions of source code must retain the | |
12 | * above copyright notice, this list of conditions | |
13 | * and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the | |
15 | * above copyright notice, this list of conditions | |
16 | * and the following disclaimer in the documentation | |
17 | * and/or other materials provided with the | |
18 | * distribution. | |
19 | * 3. The name of the author may not be used to endorse | |
20 | * or promote products derived from this software | |
21 | * without specific prior written permission. | |
22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' | |
24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | |
25 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE | |
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
30 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
33 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | |
34 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
36 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | |
38 | /* }}} */ | |
39 | ||
63b4c5a8 JF |
40 | #ifndef CYPARSER_HPP |
41 | #define CYPARSER_HPP | |
42 | ||
cf7d4c69 | 43 | #include <cstdlib> |
5999c315 | 44 | #include <string> |
c3c20102 | 45 | #include <vector> |
cf7d4c69 | 46 | |
5befe15e | 47 | #include "location.hh" |
5999c315 | 48 | #include "Pooling.hpp" |
924f67b2 | 49 | |
5999c315 JF |
50 | template <typename Type_> |
51 | struct CYNext { | |
52 | Type_ *next_; | |
63b4c5a8 | 53 | |
5999c315 JF |
54 | CYNext() : |
55 | next_(NULL) | |
56 | { | |
57 | } | |
cf7d4c69 | 58 | |
62014ea9 JF |
59 | CYNext(Type_ *next) : |
60 | next_(next) | |
61 | { | |
62 | } | |
63 | ||
5999c315 | 64 | void SetNext(Type_ *next) { |
cf7d4c69 JF |
65 | next_ = next; |
66 | } | |
67 | }; | |
68 | ||
5999c315 JF |
69 | struct CYThing { |
70 | virtual void Output(std::ostream &out) const = 0; | |
71 | }; | |
72 | ||
73 | _finline std::ostream &operator <<(std::ostream &out, const CYThing &rhs) { | |
74 | rhs.Output(out); | |
75 | return out; | |
76 | } | |
77 | ||
5999c315 | 78 | struct CYSource : |
b1ff2d78 | 79 | CYNext<CYSource> |
5999c315 | 80 | { |
9e562cfc JF |
81 | virtual bool IsBlock() const { |
82 | return next_ != NULL; | |
83 | } | |
84 | ||
b1ff2d78 | 85 | virtual void Show(std::ostream &out) const; |
5999c315 JF |
86 | virtual void Output(std::ostream &out) const = 0; |
87 | virtual void Output(std::ostream &out, bool block) const; | |
9e562cfc | 88 | virtual void Output_(std::ostream &out) const; |
5999c315 JF |
89 | }; |
90 | ||
e5bc40db JF |
91 | struct CYPropertyName { |
92 | virtual void PropertyName(std::ostream &out) const = 0; | |
93 | }; | |
94 | ||
95 | struct CYClassName { | |
367eebb1 | 96 | virtual void ClassName(std::ostream &out, bool object) const = 0; |
63b4c5a8 JF |
97 | }; |
98 | ||
cf7d4c69 | 99 | struct CYWord : |
e5bc40db JF |
100 | CYThing, |
101 | CYPropertyName, | |
102 | CYClassName | |
63b4c5a8 | 103 | { |
cf7d4c69 JF |
104 | const char *word_; |
105 | ||
106 | CYWord(const char *word) : | |
107 | word_(word) | |
108 | { | |
109 | } | |
110 | ||
5999c315 | 111 | const char *Value() const { |
cf7d4c69 JF |
112 | return word_; |
113 | } | |
114 | ||
5999c315 | 115 | virtual void Output(std::ostream &out) const; |
e5bc40db | 116 | |
367eebb1 | 117 | virtual void ClassName(std::ostream &out, bool object) const; |
e5bc40db | 118 | virtual void PropertyName(std::ostream &out) const; |
63b4c5a8 JF |
119 | }; |
120 | ||
cf7d4c69 JF |
121 | struct CYIdentifier : |
122 | CYWord | |
63b4c5a8 | 123 | { |
5999c315 JF |
124 | CYIdentifier(const char *word) : |
125 | CYWord(word) | |
126 | { | |
cf7d4c69 | 127 | } |
63b4c5a8 JF |
128 | }; |
129 | ||
62014ea9 JF |
130 | struct CYLabel : |
131 | CYNext<CYLabel> | |
132 | { | |
9e562cfc | 133 | CYIdentifier *name_; |
cf7d4c69 | 134 | |
9e562cfc | 135 | CYLabel(CYIdentifier *name, CYLabel *next) : |
62014ea9 | 136 | CYNext<CYLabel>(next), |
9e562cfc | 137 | name_(name) |
cf7d4c69 JF |
138 | { |
139 | } | |
140 | }; | |
141 | ||
142 | struct CYStatement : | |
143 | CYSource | |
63b4c5a8 | 144 | { |
9e562cfc JF |
145 | CYLabel *labels_; |
146 | ||
147 | CYStatement() : | |
148 | labels_(NULL) | |
149 | { | |
150 | } | |
cf7d4c69 JF |
151 | |
152 | void AddLabel(CYIdentifier *identifier) { | |
9e562cfc JF |
153 | labels_ = new CYLabel(identifier, labels_); |
154 | } | |
155 | ||
156 | virtual void Output_(std::ostream &out) const; | |
157 | }; | |
158 | ||
159 | struct CYBlock : | |
160 | CYStatement | |
161 | { | |
162 | CYStatement *statements_; | |
163 | ||
164 | CYBlock(CYStatement *statements) : | |
165 | statements_(statements) | |
166 | { | |
cf7d4c69 | 167 | } |
9e562cfc JF |
168 | |
169 | virtual bool IsBlock() const { | |
170 | return true; | |
171 | } | |
172 | ||
173 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
174 | }; |
175 | ||
db5e2840 JF |
176 | enum CYState { |
177 | CYClear, | |
178 | CYRestricted, | |
179 | CYNewLine | |
180 | }; | |
181 | ||
5999c315 JF |
182 | class CYDriver { |
183 | public: | |
184 | CYPool pool_; | |
e7ed5354 | 185 | |
db5e2840 | 186 | CYState state_; |
e7ed5354 JF |
187 | void *scanner_; |
188 | ||
189 | const char *data_; | |
190 | size_t size_; | |
48e3be8a | 191 | FILE *file_; |
e7ed5354 | 192 | |
5999c315 | 193 | std::string filename_; |
e7ed5354 | 194 | |
5befe15e JF |
195 | struct Error { |
196 | cy::location location_; | |
197 | std::string message_; | |
198 | }; | |
199 | ||
200 | typedef std::vector<Error> Errors; | |
201 | ||
202 | CYSource *source_; | |
203 | Errors errors_; | |
5999c315 JF |
204 | |
205 | private: | |
206 | void ScannerInit(); | |
207 | void ScannerDestroy(); | |
208 | ||
209 | public: | |
210 | CYDriver(const std::string &filename); | |
211 | ~CYDriver(); | |
212 | }; | |
213 | ||
dea834b0 JF |
214 | struct CYPart { |
215 | virtual void Part(std::ostream &out) const = 0; | |
216 | }; | |
217 | ||
5999c315 JF |
218 | struct CYForInitialiser : |
219 | CYPart | |
220 | { | |
cf7d4c69 JF |
221 | }; |
222 | ||
5999c315 JF |
223 | struct CYForInInitialiser : |
224 | CYPart | |
225 | { | |
63b4c5a8 JF |
226 | }; |
227 | ||
b09da87b | 228 | enum CYFlags { |
478d4ed0 JF |
229 | CYNoFlags = 0, |
230 | CYNoBrace = (1 << 0), | |
231 | CYNoFunction = (1 << 1), | |
232 | CYNoLeader = (1 << 2), | |
233 | CYNoTrailer = (1 << 3), | |
234 | CYNoIn = (1 << 4), | |
1ef7d061 | 235 | CYNoHyphen = (1 << 5), |
b09da87b JF |
236 | }; |
237 | ||
cf7d4c69 | 238 | struct CYExpression : |
5999c315 | 239 | CYNext<CYExpression>, |
cf7d4c69 | 240 | CYForInitialiser, |
e5bc40db JF |
241 | CYForInInitialiser, |
242 | CYClassName | |
63b4c5a8 | 243 | { |
d35a3b07 | 244 | virtual unsigned Precedence() const = 0; |
5999c315 | 245 | virtual void Part(std::ostream &out) const; |
b09da87b JF |
246 | virtual void Output(std::ostream &out, CYFlags flags) const = 0; |
247 | void Output(std::ostream &out, unsigned precedence, CYFlags flags) const; | |
dea834b0 | 248 | |
367eebb1 | 249 | virtual void ClassName(std::ostream &out, bool object) const; |
e5bc40db | 250 | |
dea834b0 JF |
251 | virtual const char *Word() const { |
252 | return NULL; | |
253 | } | |
63b4c5a8 JF |
254 | }; |
255 | ||
b09da87b JF |
256 | #define CYAlphabetic(value) \ |
257 | virtual bool Alphabetic() const { \ | |
258 | return value; \ | |
259 | } | |
260 | ||
d35a3b07 JF |
261 | #define CYPrecedence(value) \ |
262 | virtual unsigned Precedence() const { \ | |
263 | return value; \ | |
264 | } | |
265 | ||
266 | struct CYCompound : | |
267 | CYExpression | |
268 | { | |
269 | CYExpression *expressions_; | |
270 | ||
271 | CYCompound(CYExpression *expressions) : | |
272 | expressions_(expressions) | |
273 | { | |
274 | } | |
275 | ||
276 | void AddPrev(CYExpression *expression) { | |
277 | CYExpression *last(expression); | |
278 | while (last->next_ != NULL) | |
279 | last = last->next_; | |
280 | last->SetNext(expressions_); | |
281 | expressions_ = expression; | |
282 | } | |
283 | ||
284 | CYPrecedence(17) | |
285 | ||
b09da87b | 286 | void Output(std::ostream &out, CYFlags flags) const; |
d35a3b07 | 287 | }; |
5999c315 | 288 | |
cf7d4c69 JF |
289 | struct CYLiteral : |
290 | CYExpression | |
63b4c5a8 | 291 | { |
d35a3b07 | 292 | CYPrecedence(0) |
cf7d4c69 | 293 | }; |
63b4c5a8 | 294 | |
478d4ed0 JF |
295 | struct CYMagic : |
296 | CYExpression | |
297 | { | |
298 | CYPrecedence(0) | |
299 | }; | |
300 | ||
62014ea9 JF |
301 | struct CYSelectorPart : |
302 | CYNext<CYSelectorPart> | |
e7ed5354 JF |
303 | { |
304 | CYWord *name_; | |
305 | bool value_; | |
e7ed5354 | 306 | |
62014ea9 JF |
307 | CYSelectorPart(CYWord *name, bool value, CYSelectorPart *next) : |
308 | CYNext<CYSelectorPart>(next), | |
e7ed5354 | 309 | name_(name), |
62014ea9 JF |
310 | value_(value) |
311 | { | |
312 | } | |
313 | ||
314 | virtual void Output(std::ostream &out) const; | |
315 | }; | |
316 | ||
317 | struct CYSelector : | |
318 | CYLiteral | |
319 | { | |
320 | CYSelectorPart *name_; | |
321 | ||
322 | CYSelector(CYSelectorPart *name) : | |
323 | name_(name) | |
e7ed5354 JF |
324 | { |
325 | } | |
326 | ||
dea834b0 JF |
327 | CYPrecedence(1) |
328 | ||
b09da87b | 329 | virtual void Output(std::ostream &out, CYFlags flags) const; |
e7ed5354 JF |
330 | }; |
331 | ||
dea834b0 JF |
332 | struct CYRange { |
333 | uint64_t lo_; | |
334 | uint64_t hi_; | |
335 | ||
336 | CYRange(uint64_t lo, uint64_t hi) : | |
337 | lo_(lo), hi_(hi) | |
338 | { | |
339 | } | |
340 | ||
341 | bool operator [](uint8_t value) const { | |
342 | return !(value >> 7) && (value >> 6 ? hi_ : lo_) >> (value & 0x3f) & 0x1; | |
343 | } | |
344 | ||
345 | void operator()(uint8_t value) { | |
346 | if (value >> 7) | |
347 | return; | |
348 | (value >> 6 ? hi_ : lo_) |= uint64_t(0x1) << (value & 0x3f); | |
349 | } | |
350 | }; | |
351 | ||
283e7e33 | 352 | extern CYRange DigitRange_; |
dea834b0 JF |
353 | extern CYRange WordStartRange_; |
354 | extern CYRange WordEndRange_; | |
355 | ||
cf7d4c69 JF |
356 | struct CYString : |
357 | CYLiteral, | |
e5bc40db | 358 | CYPropertyName |
cf7d4c69 JF |
359 | { |
360 | const char *value_; | |
5999c315 | 361 | size_t size_; |
cf7d4c69 | 362 | |
5999c315 JF |
363 | CYString(const char *value, size_t size) : |
364 | value_(value), | |
365 | size_(size) | |
cf7d4c69 JF |
366 | { |
367 | } | |
368 | ||
369 | CYString(const CYIdentifier *identifier) : | |
5999c315 JF |
370 | value_(identifier->Value()), |
371 | size_(strlen(value_)) | |
cf7d4c69 JF |
372 | { |
373 | } | |
374 | ||
5999c315 | 375 | const char *Value() const { |
cf7d4c69 JF |
376 | return value_; |
377 | } | |
378 | ||
dea834b0 JF |
379 | virtual const char *Word() const { |
380 | if (size_ == 0 || !WordStartRange_[value_[0]]) | |
381 | return NULL; | |
382 | for (size_t i(1); i != size_; ++i) | |
383 | if (!WordEndRange_[value_[i]]) | |
384 | return NULL; | |
385 | return Value(); | |
386 | } | |
387 | ||
b09da87b JF |
388 | virtual void Output(std::ostream &out) const { |
389 | return Output(out, CYNoFlags); | |
390 | } | |
391 | ||
392 | virtual void Output(std::ostream &out, CYFlags flags) const; | |
e5bc40db | 393 | virtual void PropertyName(std::ostream &out) const; |
63b4c5a8 JF |
394 | }; |
395 | ||
cf7d4c69 | 396 | struct CYNumber : |
cf7d4c69 | 397 | CYLiteral, |
e5bc40db | 398 | CYPropertyName |
cf7d4c69 | 399 | { |
5999c315 JF |
400 | double value_; |
401 | ||
402 | CYNumber(double value) : | |
403 | value_(value) | |
404 | { | |
405 | } | |
406 | ||
407 | double Value() const { | |
408 | return value_; | |
cf7d4c69 JF |
409 | } |
410 | ||
b09da87b JF |
411 | virtual void Output(std::ostream &out) const { |
412 | return Output(out, CYNoFlags); | |
413 | } | |
414 | ||
415 | virtual void Output(std::ostream &out, CYFlags flags) const; | |
e5bc40db | 416 | virtual void PropertyName(std::ostream &out) const; |
cf7d4c69 JF |
417 | }; |
418 | ||
419 | struct CYNull : | |
420 | CYWord, | |
421 | CYLiteral | |
422 | { | |
423 | CYNull() : | |
424 | CYWord("null") | |
425 | { | |
426 | } | |
5999c315 | 427 | |
b09da87b | 428 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
429 | }; |
430 | ||
431 | struct CYThis : | |
432 | CYWord, | |
478d4ed0 | 433 | CYMagic |
cf7d4c69 JF |
434 | { |
435 | CYThis() : | |
436 | CYWord("this") | |
437 | { | |
438 | } | |
5999c315 | 439 | |
b09da87b | 440 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
441 | }; |
442 | ||
443 | struct CYBoolean : | |
444 | CYLiteral | |
445 | { | |
5999c315 | 446 | virtual bool Value() const = 0; |
b09da87b | 447 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
448 | }; |
449 | ||
450 | struct CYFalse : | |
451 | CYWord, | |
452 | CYBoolean | |
453 | { | |
454 | CYFalse() : | |
455 | CYWord("false") | |
456 | { | |
457 | } | |
5999c315 | 458 | |
b09da87b | 459 | virtual bool Value() const; |
cf7d4c69 JF |
460 | }; |
461 | ||
462 | struct CYTrue : | |
463 | CYWord, | |
464 | CYBoolean | |
465 | { | |
466 | CYTrue() : | |
467 | CYWord("true") | |
468 | { | |
469 | } | |
5999c315 | 470 | |
b09da87b | 471 | virtual bool Value() const; |
cf7d4c69 JF |
472 | }; |
473 | ||
474 | struct CYVariable : | |
475 | CYExpression | |
476 | { | |
477 | CYIdentifier *name_; | |
478 | ||
479 | CYVariable(CYIdentifier *name) : | |
480 | name_(name) | |
481 | { | |
482 | } | |
5999c315 | 483 | |
d35a3b07 JF |
484 | CYPrecedence(0) |
485 | ||
b09da87b | 486 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
487 | }; |
488 | ||
489 | struct CYPrefix : | |
63b4c5a8 JF |
490 | CYExpression |
491 | { | |
492 | CYExpression *rhs_; | |
493 | ||
cf7d4c69 | 494 | CYPrefix(CYExpression *rhs) : |
63b4c5a8 JF |
495 | rhs_(rhs) |
496 | { | |
497 | } | |
5999c315 | 498 | |
b09da87b | 499 | virtual bool Alphabetic() const = 0; |
5999c315 JF |
500 | virtual const char *Operator() const = 0; |
501 | ||
b09da87b | 502 | virtual void Output(std::ostream &out, CYFlags flags) const; |
63b4c5a8 JF |
503 | }; |
504 | ||
cf7d4c69 | 505 | struct CYInfix : |
63b4c5a8 JF |
506 | CYExpression |
507 | { | |
508 | CYExpression *lhs_; | |
509 | CYExpression *rhs_; | |
510 | ||
cf7d4c69 | 511 | CYInfix(CYExpression *lhs, CYExpression *rhs) : |
63b4c5a8 JF |
512 | lhs_(lhs), |
513 | rhs_(rhs) | |
514 | { | |
515 | } | |
5999c315 | 516 | |
0ff9f149 JF |
517 | void SetLeft(CYExpression *lhs) { |
518 | lhs_ = lhs; | |
519 | } | |
520 | ||
b09da87b | 521 | virtual bool Alphabetic() const = 0; |
5999c315 JF |
522 | virtual const char *Operator() const = 0; |
523 | ||
b09da87b | 524 | virtual void Output(std::ostream &out, CYFlags flags) const; |
63b4c5a8 JF |
525 | }; |
526 | ||
cf7d4c69 | 527 | struct CYPostfix : |
63b4c5a8 JF |
528 | CYExpression |
529 | { | |
530 | CYExpression *lhs_; | |
531 | ||
cf7d4c69 | 532 | CYPostfix(CYExpression *lhs) : |
63b4c5a8 JF |
533 | lhs_(lhs) |
534 | { | |
535 | } | |
5999c315 JF |
536 | |
537 | virtual const char *Operator() const = 0; | |
538 | ||
b09da87b | 539 | virtual void Output(std::ostream &out, CYFlags flags) const; |
63b4c5a8 JF |
540 | }; |
541 | ||
cf7d4c69 | 542 | struct CYAssignment : |
d35a3b07 | 543 | CYExpression |
cf7d4c69 | 544 | { |
d35a3b07 JF |
545 | CYExpression *lhs_; |
546 | CYExpression *rhs_; | |
547 | ||
cf7d4c69 | 548 | CYAssignment(CYExpression *lhs, CYExpression *rhs) : |
d35a3b07 JF |
549 | lhs_(lhs), |
550 | rhs_(rhs) | |
cf7d4c69 JF |
551 | { |
552 | } | |
5999c315 | 553 | |
0ff9f149 JF |
554 | void SetLeft(CYExpression *lhs) { |
555 | lhs_ = lhs; | |
556 | } | |
557 | ||
5999c315 | 558 | virtual const char *Operator() const = 0; |
d35a3b07 | 559 | |
b09da87b | 560 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
561 | }; |
562 | ||
62014ea9 JF |
563 | struct CYArgument : |
564 | CYNext<CYArgument> | |
565 | { | |
cf7d4c69 JF |
566 | CYWord *name_; |
567 | CYExpression *value_; | |
cf7d4c69 JF |
568 | |
569 | CYArgument(CYWord *name, CYExpression *value, CYArgument *next = NULL) : | |
62014ea9 | 570 | CYNext<CYArgument>(next), |
cf7d4c69 | 571 | name_(name), |
62014ea9 | 572 | value_(value) |
cf7d4c69 JF |
573 | { |
574 | } | |
5999c315 | 575 | |
d35a3b07 | 576 | void Output(std::ostream &out) const; |
cf7d4c69 JF |
577 | }; |
578 | ||
579 | struct CYBlank : | |
580 | public CYWord | |
581 | { | |
582 | CYBlank() : | |
583 | CYWord("") | |
584 | { | |
585 | } | |
586 | }; | |
587 | ||
5999c315 JF |
588 | struct CYClause : |
589 | CYThing, | |
590 | CYNext<CYClause> | |
591 | { | |
cf7d4c69 JF |
592 | CYExpression *case_; |
593 | CYStatement *code_; | |
cf7d4c69 JF |
594 | |
595 | CYClause(CYExpression *_case, CYStatement *code) : | |
596 | case_(_case), | |
597 | code_(code) | |
598 | { | |
599 | } | |
600 | ||
5999c315 | 601 | virtual void Output(std::ostream &out) const; |
cf7d4c69 JF |
602 | }; |
603 | ||
62014ea9 JF |
604 | struct CYElement : |
605 | CYNext<CYElement> | |
606 | { | |
cf7d4c69 | 607 | CYExpression *value_; |
cf7d4c69 JF |
608 | |
609 | CYElement(CYExpression *value, CYElement *next) : | |
62014ea9 JF |
610 | CYNext<CYElement>(next), |
611 | value_(value) | |
cf7d4c69 JF |
612 | { |
613 | } | |
5999c315 | 614 | |
5befe15e JF |
615 | void Output(std::ostream &out) const; |
616 | }; | |
617 | ||
618 | struct CYArray : | |
619 | CYLiteral | |
620 | { | |
621 | CYElement *elements_; | |
622 | ||
623 | CYArray(CYElement *elements) : | |
624 | elements_(elements) | |
625 | { | |
626 | } | |
627 | ||
b09da87b | 628 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
629 | }; |
630 | ||
631 | struct CYDeclaration : | |
5999c315 | 632 | CYThing, |
cf7d4c69 JF |
633 | CYForInInitialiser |
634 | { | |
635 | CYIdentifier *identifier_; | |
636 | CYExpression *initialiser_; | |
637 | ||
638 | CYDeclaration(CYIdentifier *identifier, CYExpression *initialiser) : | |
639 | identifier_(identifier), | |
640 | initialiser_(initialiser) | |
641 | { | |
642 | } | |
5999c315 JF |
643 | |
644 | virtual void Part(std::ostream &out) const; | |
645 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
646 | }; |
647 | ||
648 | struct CYDeclarations : | |
649 | CYStatement, | |
650 | CYForInitialiser | |
651 | { | |
652 | CYDeclaration *declaration_; | |
653 | CYDeclarations *next_; | |
654 | ||
655 | CYDeclarations(CYDeclaration *declaration, CYDeclarations *next) : | |
656 | declaration_(declaration), | |
657 | next_(next) | |
658 | { | |
659 | } | |
5999c315 JF |
660 | |
661 | virtual void Part(std::ostream &out) const; | |
662 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
663 | }; |
664 | ||
b09da87b JF |
665 | struct CYField : |
666 | CYNext<CYField> | |
667 | { | |
668 | virtual void Output(std::ostream &out) const; | |
669 | }; | |
670 | ||
671 | struct CYMessageParameter : | |
672 | CYNext<CYMessageParameter> | |
673 | { | |
674 | CYWord *tag_; | |
675 | CYExpression *type_; | |
676 | CYIdentifier *name_; | |
677 | ||
678 | CYMessageParameter(CYWord *tag, CYExpression *type, CYIdentifier *name) : | |
679 | tag_(tag), | |
680 | type_(type), | |
681 | name_(name) | |
682 | { | |
683 | } | |
684 | }; | |
685 | ||
686 | struct CYMessage : | |
e5bc40db | 687 | CYNext<CYMessage> |
b09da87b JF |
688 | { |
689 | bool instance_; | |
690 | CYExpression *type_; | |
691 | CYMessageParameter *parameter_; | |
692 | CYSource *body_; | |
693 | ||
694 | CYMessage(bool instance, CYExpression *type, CYMessageParameter *parameter, CYSource *body) : | |
695 | instance_(instance), | |
696 | type_(type), | |
697 | parameter_(parameter), | |
698 | body_(body) | |
699 | { | |
700 | } | |
701 | ||
e5bc40db | 702 | virtual void Output(std::ostream &out, bool replace) const; |
b09da87b JF |
703 | }; |
704 | ||
705 | struct CYClass : | |
367eebb1 | 706 | CYExpression |
b09da87b | 707 | { |
367eebb1 | 708 | CYClassName *name_; |
b09da87b JF |
709 | CYExpression *super_; |
710 | CYField *fields_; | |
711 | CYMessage *messages_; | |
712 | ||
367eebb1 | 713 | CYClass(CYClassName *name, CYExpression *super, CYField *fields, CYMessage *messages) : |
b09da87b JF |
714 | name_(name), |
715 | super_(super), | |
716 | fields_(fields), | |
717 | messages_(messages) | |
718 | { | |
719 | } | |
720 | ||
367eebb1 JF |
721 | CYPrecedence(0) |
722 | ||
723 | virtual void Output(std::ostream &out, CYFlags flags) const; | |
b09da87b JF |
724 | }; |
725 | ||
e5bc40db | 726 | struct CYCategory : |
367eebb1 | 727 | CYStatement |
e5bc40db JF |
728 | { |
729 | CYClassName *name_; | |
730 | CYMessage *messages_; | |
731 | ||
732 | CYCategory(CYClassName *name, CYMessage *messages) : | |
733 | name_(name), | |
734 | messages_(messages) | |
735 | { | |
736 | } | |
737 | ||
738 | virtual void Output(std::ostream &out) const; | |
739 | }; | |
740 | ||
b09da87b JF |
741 | struct CYFunctionParameter : |
742 | CYNext<CYFunctionParameter>, | |
5999c315 JF |
743 | CYThing |
744 | { | |
cf7d4c69 | 745 | CYIdentifier *name_; |
cf7d4c69 | 746 | |
b09da87b JF |
747 | CYFunctionParameter(CYIdentifier *name, CYFunctionParameter *next) : |
748 | CYNext<CYFunctionParameter>(next), | |
62014ea9 | 749 | name_(name) |
cf7d4c69 JF |
750 | { |
751 | } | |
5999c315 JF |
752 | |
753 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
754 | }; |
755 | ||
756 | struct CYFor : | |
757 | CYStatement | |
758 | { | |
759 | CYForInitialiser *initialiser_; | |
760 | CYExpression *test_; | |
761 | CYExpression *increment_; | |
762 | CYStatement *code_; | |
763 | ||
764 | CYFor(CYForInitialiser *initialiser, CYExpression *test, CYExpression *increment, CYStatement *code) : | |
765 | initialiser_(initialiser), | |
766 | test_(test), | |
767 | increment_(increment), | |
768 | code_(code) | |
769 | { | |
770 | } | |
5999c315 JF |
771 | |
772 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
773 | }; |
774 | ||
775 | struct CYForIn : | |
776 | CYStatement | |
777 | { | |
778 | CYForInInitialiser *initialiser_; | |
779 | CYExpression *set_; | |
780 | CYStatement *code_; | |
781 | ||
782 | CYForIn(CYForInInitialiser *initialiser, CYExpression *set, CYStatement *code) : | |
783 | initialiser_(initialiser), | |
784 | set_(set), | |
785 | code_(code) | |
786 | { | |
787 | } | |
5999c315 JF |
788 | |
789 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
790 | }; |
791 | ||
62014ea9 JF |
792 | struct CYProperty : |
793 | CYNext<CYProperty> | |
794 | { | |
e5bc40db | 795 | CYPropertyName *name_; |
cf7d4c69 | 796 | CYExpression *value_; |
cf7d4c69 | 797 | |
e5bc40db | 798 | CYProperty(CYPropertyName *name, CYExpression *value, CYProperty *next) : |
62014ea9 | 799 | CYNext<CYProperty>(next), |
cf7d4c69 | 800 | name_(name), |
62014ea9 | 801 | value_(value) |
cf7d4c69 JF |
802 | { |
803 | } | |
5999c315 | 804 | |
5999c315 | 805 | virtual void Output(std::ostream &out) const; |
cf7d4c69 JF |
806 | }; |
807 | ||
693d501b JF |
808 | struct CYObject : |
809 | CYLiteral | |
810 | { | |
811 | CYProperty *property_; | |
812 | ||
813 | CYObject(CYProperty *property) : | |
814 | property_(property) | |
815 | { | |
816 | } | |
817 | ||
b09da87b | 818 | void Output(std::ostream &out, CYFlags flags) const; |
693d501b JF |
819 | }; |
820 | ||
5999c315 JF |
821 | struct CYCatch : |
822 | CYThing | |
823 | { | |
cf7d4c69 JF |
824 | CYIdentifier *name_; |
825 | CYStatement *code_; | |
826 | ||
827 | CYCatch(CYIdentifier *name, CYStatement *code) : | |
828 | name_(name), | |
829 | code_(code) | |
830 | { | |
831 | } | |
5999c315 JF |
832 | |
833 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
834 | }; |
835 | ||
b09da87b | 836 | struct CYSend : |
63b4c5a8 JF |
837 | CYExpression |
838 | { | |
cf7d4c69 JF |
839 | CYExpression *self_; |
840 | CYArgument *arguments_; | |
63b4c5a8 | 841 | |
b09da87b | 842 | CYSend(CYExpression *self, CYArgument *arguments) : |
cf7d4c69 JF |
843 | self_(self), |
844 | arguments_(arguments) | |
63b4c5a8 JF |
845 | { |
846 | } | |
5999c315 | 847 | |
d35a3b07 JF |
848 | CYPrecedence(0) |
849 | ||
b09da87b | 850 | virtual void Output(std::ostream &out, CYFlags flags) const; |
63b4c5a8 JF |
851 | }; |
852 | ||
cf7d4c69 JF |
853 | struct CYMember : |
854 | CYExpression | |
855 | { | |
856 | CYExpression *object_; | |
857 | CYExpression *property_; | |
858 | ||
859 | CYMember(CYExpression *object, CYExpression *property) : | |
860 | object_(object), | |
861 | property_(property) | |
862 | { | |
863 | } | |
5999c315 | 864 | |
9b5527f0 JF |
865 | void SetLeft(CYExpression *object) { |
866 | object_ = object; | |
867 | } | |
868 | }; | |
869 | ||
870 | struct CYDirectMember : | |
871 | CYMember | |
872 | { | |
873 | CYDirectMember(CYExpression *object, CYExpression *property) : | |
874 | CYMember(object, property) | |
875 | { | |
876 | } | |
877 | ||
878 | CYPrecedence(1) | |
879 | ||
880 | virtual void Output(std::ostream &out, CYFlags flags) const; | |
881 | }; | |
882 | ||
883 | struct CYIndirectMember : | |
884 | CYMember | |
885 | { | |
886 | CYIndirectMember(CYExpression *object, CYExpression *property) : | |
887 | CYMember(object, property) | |
888 | { | |
889 | } | |
890 | ||
d35a3b07 JF |
891 | CYPrecedence(1) |
892 | ||
b09da87b | 893 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
894 | }; |
895 | ||
896 | struct CYNew : | |
897 | CYExpression | |
898 | { | |
899 | CYExpression *constructor_; | |
900 | CYArgument *arguments_; | |
901 | ||
902 | CYNew(CYExpression *constructor, CYArgument *arguments) : | |
903 | constructor_(constructor), | |
904 | arguments_(arguments) | |
905 | { | |
906 | } | |
5999c315 | 907 | |
d35a3b07 JF |
908 | CYPrecedence(1) |
909 | ||
b09da87b | 910 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
911 | }; |
912 | ||
913 | struct CYCall : | |
914 | CYExpression | |
915 | { | |
916 | CYExpression *function_; | |
917 | CYArgument *arguments_; | |
918 | ||
919 | CYCall(CYExpression *function, CYArgument *arguments) : | |
920 | function_(function), | |
921 | arguments_(arguments) | |
922 | { | |
923 | } | |
5999c315 | 924 | |
d35a3b07 JF |
925 | CYPrecedence(2) |
926 | ||
b09da87b | 927 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
928 | }; |
929 | ||
930 | struct CYIf : | |
931 | CYStatement | |
932 | { | |
933 | CYExpression *test_; | |
934 | CYStatement *true_; | |
935 | CYStatement *false_; | |
936 | ||
937 | CYIf(CYExpression *test, CYStatement *_true, CYStatement *_false) : | |
938 | test_(test), | |
939 | true_(_true), | |
940 | false_(_false) | |
941 | { | |
942 | } | |
5999c315 JF |
943 | |
944 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
945 | }; |
946 | ||
947 | struct CYDoWhile : | |
948 | CYStatement | |
949 | { | |
950 | CYExpression *test_; | |
951 | CYStatement *code_; | |
952 | ||
953 | CYDoWhile(CYExpression *test, CYStatement *code) : | |
954 | test_(test), | |
955 | code_(code) | |
956 | { | |
957 | } | |
5999c315 JF |
958 | |
959 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
960 | }; |
961 | ||
962 | struct CYWhile : | |
963 | CYStatement | |
964 | { | |
965 | CYExpression *test_; | |
966 | CYStatement *code_; | |
967 | ||
968 | CYWhile(CYExpression *test, CYStatement *code) : | |
969 | test_(test), | |
970 | code_(code) | |
971 | { | |
972 | } | |
5999c315 JF |
973 | |
974 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
975 | }; |
976 | ||
977 | struct CYLambda : | |
978 | CYExpression | |
979 | { | |
980 | CYIdentifier *name_; | |
b09da87b | 981 | CYFunctionParameter *parameters_; |
cf7d4c69 JF |
982 | CYSource *body_; |
983 | ||
b09da87b | 984 | CYLambda(CYIdentifier *name, CYFunctionParameter *parameters, CYSource *body) : |
cf7d4c69 JF |
985 | name_(name), |
986 | parameters_(parameters), | |
987 | body_(body) | |
988 | { | |
989 | } | |
5999c315 | 990 | |
d35a3b07 JF |
991 | CYPrecedence(0) |
992 | ||
b09da87b | 993 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
994 | }; |
995 | ||
996 | struct CYFunction : | |
5999c315 JF |
997 | CYLambda, |
998 | CYSource | |
cf7d4c69 | 999 | { |
b09da87b | 1000 | CYFunction(CYIdentifier *name, CYFunctionParameter *parameters, CYSource *body) : |
cf7d4c69 JF |
1001 | CYLambda(name, parameters, body) |
1002 | { | |
1003 | } | |
5999c315 JF |
1004 | |
1005 | virtual void Output(std::ostream &out) const; | |
1006 | }; | |
1007 | ||
1008 | struct CYExpress : | |
1009 | CYStatement | |
1010 | { | |
1011 | CYExpression *expression_; | |
1012 | ||
1013 | CYExpress(CYExpression *expression) : | |
1014 | expression_(expression) | |
1015 | { | |
1016 | } | |
1017 | ||
1018 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1019 | }; |
1020 | ||
1021 | struct CYContinue : | |
1022 | CYStatement | |
1023 | { | |
1024 | CYIdentifier *label_; | |
1025 | ||
1026 | CYContinue(CYIdentifier *label) : | |
1027 | label_(label) | |
1028 | { | |
1029 | } | |
5999c315 JF |
1030 | |
1031 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1032 | }; |
1033 | ||
1034 | struct CYBreak : | |
1035 | CYStatement | |
1036 | { | |
1037 | CYIdentifier *label_; | |
1038 | ||
1039 | CYBreak(CYIdentifier *label) : | |
1040 | label_(label) | |
1041 | { | |
1042 | } | |
5999c315 JF |
1043 | |
1044 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1045 | }; |
1046 | ||
1047 | struct CYReturn : | |
1048 | CYStatement | |
1049 | { | |
1050 | CYExpression *value_; | |
1051 | ||
1052 | CYReturn(CYExpression *value) : | |
1053 | value_(value) | |
1054 | { | |
1055 | } | |
5999c315 JF |
1056 | |
1057 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1058 | }; |
1059 | ||
1060 | struct CYEmpty : | |
1061 | CYStatement | |
1062 | { | |
5999c315 JF |
1063 | virtual void Output(std::ostream &out) const; |
1064 | virtual void Output(std::ostream &out, bool block) const; | |
cf7d4c69 JF |
1065 | }; |
1066 | ||
1067 | struct CYTry : | |
1068 | CYStatement | |
1069 | { | |
1070 | CYStatement *try_; | |
1071 | CYCatch *catch_; | |
1072 | CYStatement *finally_; | |
1073 | ||
1074 | CYTry(CYStatement *_try, CYCatch *_catch, CYStatement *finally) : | |
1075 | try_(_try), | |
1076 | catch_(_catch), | |
1077 | finally_(finally) | |
1078 | { | |
1079 | } | |
5999c315 JF |
1080 | |
1081 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1082 | }; |
1083 | ||
1084 | struct CYThrow : | |
1085 | CYStatement | |
1086 | { | |
1087 | CYExpression *value_; | |
1088 | ||
1089 | CYThrow(CYExpression *value) : | |
1090 | value_(value) | |
1091 | { | |
1092 | } | |
5999c315 JF |
1093 | |
1094 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1095 | }; |
1096 | ||
1097 | struct CYWith : | |
1098 | CYStatement | |
1099 | { | |
1100 | CYExpression *scope_; | |
1101 | CYStatement *code_; | |
1102 | ||
1103 | CYWith(CYExpression *scope, CYStatement *code) : | |
1104 | scope_(scope), | |
1105 | code_(code) | |
1106 | { | |
1107 | } | |
5999c315 JF |
1108 | |
1109 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1110 | }; |
1111 | ||
1112 | struct CYSwitch : | |
1113 | CYStatement | |
1114 | { | |
1115 | CYExpression *value_; | |
1116 | CYClause *clauses_; | |
1117 | ||
1118 | CYSwitch(CYExpression *value, CYClause *clauses) : | |
1119 | value_(value), | |
1120 | clauses_(clauses) | |
1121 | { | |
1122 | } | |
5999c315 JF |
1123 | |
1124 | virtual void Output(std::ostream &out) const; | |
cf7d4c69 JF |
1125 | }; |
1126 | ||
1127 | struct CYCondition : | |
1128 | CYExpression | |
1129 | { | |
1130 | CYExpression *test_; | |
1131 | CYExpression *true_; | |
1132 | CYExpression *false_; | |
1133 | ||
1134 | CYCondition(CYExpression *test, CYExpression *_true, CYExpression *_false) : | |
91a416e4 | 1135 | test_(test), |
cf7d4c69 JF |
1136 | true_(_true), |
1137 | false_(_false) | |
1138 | { | |
1139 | } | |
5999c315 | 1140 | |
d35a3b07 JF |
1141 | CYPrecedence(15) |
1142 | ||
b09da87b | 1143 | virtual void Output(std::ostream &out, CYFlags flags) const; |
5999c315 JF |
1144 | }; |
1145 | ||
1146 | struct CYAddressOf : | |
1147 | CYPrefix | |
1148 | { | |
1149 | CYAddressOf(CYExpression *rhs) : | |
1150 | CYPrefix(rhs) | |
1151 | { | |
1152 | } | |
1153 | ||
1154 | virtual const char *Operator() const { | |
1155 | return "&"; | |
1156 | } | |
1157 | ||
b09da87b | 1158 | CYAlphabetic(false) |
d35a3b07 JF |
1159 | CYPrecedence(2) |
1160 | ||
b09da87b | 1161 | virtual void Output(std::ostream &out, CYFlags flags) const; |
5999c315 JF |
1162 | }; |
1163 | ||
1164 | struct CYIndirect : | |
1165 | CYPrefix | |
1166 | { | |
1167 | CYIndirect(CYExpression *rhs) : | |
1168 | CYPrefix(rhs) | |
1169 | { | |
1170 | } | |
1171 | ||
1172 | virtual const char *Operator() const { | |
1173 | return "*"; | |
1174 | } | |
1175 | ||
b09da87b | 1176 | CYAlphabetic(false) |
d35a3b07 JF |
1177 | CYPrecedence(1) |
1178 | ||
b09da87b | 1179 | virtual void Output(std::ostream &out, CYFlags flags) const; |
cf7d4c69 JF |
1180 | }; |
1181 | ||
1182 | #define CYPostfix_(op, name) \ | |
1183 | struct CY ## name : \ | |
1184 | CYPostfix \ | |
1185 | { \ | |
1186 | CY ## name(CYExpression *lhs) : \ | |
1187 | CYPostfix(lhs) \ | |
1188 | { \ | |
1189 | } \ | |
d35a3b07 JF |
1190 | \ |
1191 | CYPrecedence(3) \ | |
5999c315 JF |
1192 | \ |
1193 | virtual const char *Operator() const { \ | |
1194 | return op; \ | |
1195 | } \ | |
cf7d4c69 JF |
1196 | }; |
1197 | ||
b09da87b | 1198 | #define CYPrefix_(alphabetic, op, name) \ |
cf7d4c69 JF |
1199 | struct CY ## name : \ |
1200 | CYPrefix \ | |
1201 | { \ | |
1202 | CY ## name(CYExpression *rhs) : \ | |
1203 | CYPrefix(rhs) \ | |
1204 | { \ | |
1205 | } \ | |
d35a3b07 | 1206 | \ |
b09da87b | 1207 | CYAlphabetic(alphabetic) \ |
d35a3b07 | 1208 | CYPrecedence(4) \ |
5999c315 JF |
1209 | \ |
1210 | virtual const char *Operator() const { \ | |
1211 | return op; \ | |
1212 | } \ | |
cf7d4c69 JF |
1213 | }; |
1214 | ||
b09da87b | 1215 | #define CYInfix_(alphabetic, precedence, op, name) \ |
cf7d4c69 JF |
1216 | struct CY ## name : \ |
1217 | CYInfix \ | |
1218 | { \ | |
1219 | CY ## name(CYExpression *lhs, CYExpression *rhs) : \ | |
1220 | CYInfix(lhs, rhs) \ | |
1221 | { \ | |
1222 | } \ | |
d35a3b07 | 1223 | \ |
b09da87b | 1224 | CYAlphabetic(alphabetic) \ |
d35a3b07 | 1225 | CYPrecedence(precedence) \ |
5999c315 JF |
1226 | \ |
1227 | virtual const char *Operator() const { \ | |
1228 | return op; \ | |
1229 | } \ | |
cf7d4c69 JF |
1230 | }; |
1231 | ||
1232 | #define CYAssignment_(op, name) \ | |
1233 | struct CY ## name ## Assign : \ | |
1234 | CYAssignment \ | |
1235 | { \ | |
1236 | CY ## name ## Assign(CYExpression *lhs, CYExpression *rhs) : \ | |
1237 | CYAssignment(lhs, rhs) \ | |
1238 | { \ | |
1239 | } \ | |
d35a3b07 JF |
1240 | \ |
1241 | CYPrecedence(16) \ | |
5999c315 JF |
1242 | \ |
1243 | virtual const char *Operator() const { \ | |
1244 | return op; \ | |
1245 | } \ | |
cf7d4c69 JF |
1246 | }; |
1247 | ||
1248 | CYPostfix_("++", PostIncrement) | |
1249 | CYPostfix_("--", PostDecrement) | |
1250 | ||
b09da87b JF |
1251 | CYPrefix_(true, "delete", Delete) |
1252 | CYPrefix_(true, "void", Void) | |
1253 | CYPrefix_(true, "typeof", TypeOf) | |
1254 | CYPrefix_(false, "++", PreIncrement) | |
1255 | CYPrefix_(false, "--", PreDecrement) | |
1256 | CYPrefix_(false, "-", Negate) | |
1257 | CYPrefix_(false, "~", BitwiseNot) | |
1258 | CYPrefix_(false, "!", LogicalNot) | |
1259 | ||
1260 | CYInfix_(false, 5, "*", Multiply) | |
1261 | CYInfix_(false, 5, "/", Divide) | |
1262 | CYInfix_(false, 5, "%", Modulus) | |
1263 | CYInfix_(false, 6, "+", Add) | |
1264 | CYInfix_(false, 6, "-", Subtract) | |
1265 | CYInfix_(false, 7, "<<", ShiftLeft) | |
1266 | CYInfix_(false, 7, ">>", ShiftRightSigned) | |
1267 | CYInfix_(false, 7, ">>>", ShiftRightUnsigned) | |
1268 | CYInfix_(false, 8, "<", Less) | |
1269 | CYInfix_(false, 8, ">", Greater) | |
1270 | CYInfix_(false, 8, "<=", LessOrEqual) | |
1271 | CYInfix_(false, 8, ">=", GreaterOrEqual) | |
1272 | CYInfix_(true, 8, "instanceof", InstanceOf) | |
1273 | CYInfix_(true, 8, "in", In) | |
1274 | CYInfix_(false, 9, "==", Equal) | |
1275 | CYInfix_(false, 9, "!=", NotEqual) | |
1276 | CYInfix_(false, 9, "===", Identical) | |
1277 | CYInfix_(false, 9, "!==", NotIdentical) | |
1278 | CYInfix_(false, 10, "&", BitwiseAnd) | |
1279 | CYInfix_(false, 11, "^", BitwiseXOr) | |
1280 | CYInfix_(false, 12, "|", BitwiseOr) | |
1281 | CYInfix_(false, 13, "&&", LogicalAnd) | |
1282 | CYInfix_(false, 14, "||", LogicalOr) | |
cf7d4c69 JF |
1283 | |
1284 | CYAssignment_("=", ) | |
1285 | CYAssignment_("*=", Multiply) | |
1286 | CYAssignment_("/=", Divide) | |
1287 | CYAssignment_("%=", Modulus) | |
1288 | CYAssignment_("+=", Add) | |
1289 | CYAssignment_("-=", Subtract) | |
1290 | CYAssignment_("<<=", ShiftLeft) | |
1291 | CYAssignment_(">>=", ShiftRightSigned) | |
1292 | CYAssignment_(">>>=", ShiftRightUnsigned) | |
1293 | CYAssignment_("&=", BitwiseAnd) | |
1294 | CYAssignment_("^=", BitwiseXOr) | |
1295 | CYAssignment_("|=", BitwiseOr) | |
1296 | ||
63b4c5a8 | 1297 | #endif/*CYPARSER_HPP*/ |