1 /* Cycript - The Truly Universal Scripting Language
2 * Copyright (C) 2009-2016 Jay Freeman (saurik)
5 /* GNU Affero General Public License, Version 3 {{{ */
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef CYCRIPT_SYNTAX_HPP
23 #define CYCRIPT_SYNTAX_HPP
33 #include "Location.hpp"
34 #include "Options.hpp"
35 #include "Pooling.hpp"
38 double CYCastDouble(const char *value, size_t size);
39 double CYCastDouble(const char *value);
40 double CYCastDouble(CYUTF8String value);
42 void CYNumerify(std::ostringstream &str, double value);
44 enum CYStringifyMode {
45 CYStringifyModeLegacy,
46 CYStringifyModeCycript,
47 CYStringifyModeNative,
50 void CYStringify(std::ostringstream &str, const char *data, size_t size, CYStringifyMode mode);
52 // XXX: this really should not be here ... :/
53 void *CYPoolFile(CYPool &pool, const char *path, size_t *psize);
54 CYUTF8String CYPoolFileUTF8String(CYPool &pool, const char *path);
59 virtual void Output(struct CYOutput &out) const = 0;
80 CYOutput(std::streambuf &out, CYOptions &options) :
91 void Check(char value);
94 _finline void operator ()(char value) {
95 _assert(out_.sputc(value) != EOF);
100 position_.Columns(1);
103 _finline void operator ()(const char *data, std::streamsize size) {
104 _assert(out_.sputn(data, size) == size);
106 position_.Columns(size);
109 _finline void operator ()(const char *data) {
110 return operator ()(data, strlen(data));
113 CYOutput &operator <<(char rhs);
114 CYOutput &operator <<(const char *rhs);
116 _finline CYOutput &operator <<(const CYThing *rhs) {
122 _finline CYOutput &operator <<(const CYThing &rhs) {
133 struct CYPropertyName {
134 virtual bool Computed() const {
138 virtual bool Constructor() const {
142 virtual CYIdentifier *Identifier() {
146 virtual CYNumber *Number(CYContext &context) {
150 virtual CYExpression *PropertyName(CYContext &context) = 0;
151 virtual void PropertyName(CYOutput &out) const = 0;
162 CYNoBrace = (1 << 0),
163 CYNoFunction = (1 << 1),
164 CYNoClass = (1 << 2),
167 CYNoRightHand = (1 << 5),
168 CYNoDangle = (1 << 6),
169 CYNoInteger = (1 << 7),
170 CYNoColon = (1 << 8),
171 CYNoBFC = (CYNoBrace | CYNoFunction | CYNoClass),
174 _finline CYFlags operator ~(CYFlags rhs) {
175 return static_cast<CYFlags>(~static_cast<unsigned>(rhs));
178 _finline CYFlags operator &(CYFlags lhs, CYFlags rhs) {
179 return static_cast<CYFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs));
182 _finline CYFlags operator |(CYFlags lhs, CYFlags rhs) {
183 return static_cast<CYFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs));
186 _finline CYFlags &operator |=(CYFlags &lhs, CYFlags rhs) {
187 return lhs = lhs | rhs;
190 _finline CYFlags CYLeft(CYFlags flags) {
191 return flags & ~(CYNoDangle | CYNoInteger);
194 _finline CYFlags CYRight(CYFlags flags) {
195 return flags & ~CYNoBFC;
198 _finline CYFlags CYCenter(CYFlags flags) {
199 return CYLeft(CYRight(flags));
208 #define CYCompact(type) \
209 virtual CYCompactType Compact() const { \
210 return CYCompact ## type; \
217 void Single(CYOutput &out, CYFlags flags, CYCompactType request) const;
218 void Multiple(CYOutput &out, CYFlags flags = CYNoFlags) const;
219 virtual void Output(CYOutput &out) const;
221 virtual CYStatement *Replace(CYContext &context) = 0;
223 virtual CYCompactType Compact() const = 0;
224 virtual CYStatement *Return();
227 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
230 typedef CYList<CYStatement> CYStatements;
232 struct CYForInitializer :
235 virtual CYForInitializer *Replace(CYContext &context) = 0;
236 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
245 CYWord(const char *word) :
250 virtual bool Constructor() const {
251 return strcmp(word_, "constructor") == 0;
254 virtual const char *Word() const;
255 virtual void Output(CYOutput &out) const;
257 virtual CYExpression *PropertyName(CYContext &context);
258 virtual void PropertyName(CYOutput &out) const;
261 _finline std::ostream &operator <<(std::ostream &lhs, const CYWord &rhs) {
263 return lhs << rhs.Word();
266 enum CYIdentifierKind {
267 CYIdentifierArgument,
273 CYIdentifierVariable,
276 struct CYIdentifier :
277 CYNext<CYIdentifier>,
280 CYLocation location_;
284 CYIdentifier(const char *word) :
291 CYIdentifier *Identifier() override {
295 virtual const char *Word() const;
296 CYIdentifier *Replace(CYContext &context, CYIdentifierKind);
303 CYStatement *statement_;
305 CYLabel(CYIdentifier *name, CYStatement *statement) :
307 statement_(statement)
313 virtual CYStatement *Replace(CYContext &context);
314 virtual void Output(CYOutput &out, CYFlags flags) const;
317 struct CYCStringLess :
318 std::binary_function<const char *, const char *, bool>
320 _finline bool operator ()(const char *lhs, const char *rhs) const {
321 return strcmp(lhs, rhs) < 0;
325 struct CYIdentifierValueLess :
326 std::binary_function<CYIdentifier *, CYIdentifier *, bool>
328 _finline bool operator ()(CYIdentifier *lhs, CYIdentifier *rhs) const {
329 return CYCStringLess()(lhs->Word(), rhs->Word());
333 struct CYIdentifierFlags :
334 CYNext<CYIdentifierFlags>
336 CYIdentifier *identifier_;
337 CYIdentifierKind kind_;
341 CYIdentifierFlags(CYIdentifier *identifier, CYIdentifierKind kind, CYIdentifierFlags *next = NULL) :
342 CYNext<CYIdentifierFlags>(next),
343 identifier_(identifier),
355 CYIdentifierFlags *shadow_;
357 CYIdentifierFlags *internal_;
359 CYScope(bool transparent, CYContext &context);
361 CYIdentifierFlags *Lookup(CYContext &context, const char *word);
362 CYIdentifierFlags *Lookup(CYContext &context, CYIdentifier *identifier);
364 CYIdentifierFlags *Declare(CYContext &context, CYIdentifier *identifier, CYIdentifierKind kind);
365 void Merge(CYContext &context, const CYIdentifierFlags *flags);
367 void Close(CYContext &context, CYStatement *&statements);
368 void Close(CYContext &context);
377 CYScript(CYStatement *code) :
382 virtual void Replace(CYContext &context);
383 virtual void Output(CYOutput &out) const;
394 CYIdentifier *super_;
396 CYNonLocal *nonlocal_;
397 CYNonLocal *nextlocal_;
400 std::vector<CYIdentifier *> replace_;
402 CYContext(CYOptions &options) :
413 void ReplaceAll(CYStatement *&statement) {
414 if (statement == NULL)
416 CYStatement *next(statement->next_);
421 if (statement == NULL)
424 statement->SetNext(next);
427 template <typename Type_>
428 void Replace(Type_ *&value) {
429 for (;;) if (value == NULL)
432 Type_ *replace(value->Replace(*this));
433 if (replace != value)
439 void NonLocal(CYStatement *&statements);
440 CYIdentifier *Unique();
444 CYIdentifier *identifier_;
451 CYIdentifier *Target(CYContext &context) {
452 if (identifier_ == NULL)
453 identifier_ = context.Unique();
461 CYIdentifier *identifier_;
468 CYIdentifier *Identifier(CYContext &context) {
470 return next_->Identifier(context);
471 if (identifier_ == NULL)
472 identifier_ = context.Unique();
482 CYBlock(CYStatement *code) :
489 virtual CYStatement *Replace(CYContext &context);
491 virtual void Output(CYOutput &out, CYFlags flags) const;
493 virtual CYStatement *Return();
499 struct CYForInInitializer {
500 virtual CYStatement *Initialize(CYContext &context, CYExpression *value) = 0;
502 virtual CYTarget *Replace(CYContext &context) = 0;
503 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
506 struct CYFunctionParameter;
511 struct CYExpression :
514 virtual int Precedence() const = 0;
516 virtual bool RightHand() const {
520 virtual bool Eval() const {
524 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
526 virtual void Output(CYOutput &out) const;
527 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
528 void Output(CYOutput &out, int precedence, CYFlags flags) const;
530 virtual CYExpression *Replace(CYContext &context) = 0;
532 virtual CYExpression *Primitive(CYContext &context) {
536 virtual CYFunctionParameter *Parameter() const;
538 virtual CYNumber *Number(CYContext &context) {
542 virtual CYString *String(CYContext &context) {
546 virtual const char *Word() const {
555 virtual bool RightHand() const {
559 virtual bool IsNew() const {
563 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
565 virtual CYTarget *Replace(CYContext &context) = 0;
566 using CYExpression::Output;
569 #define CYAlphabetic(value) \
570 virtual bool Alphabetic() const { \
574 #define CYPrecedence(value) \
575 static const int Precedence_ = value; \
576 virtual int Precedence() const { \
577 return Precedence_; \
583 CYExpression *expression_;
586 CYCompound(CYExpression *expression, CYExpression *next) :
587 expression_(expression),
590 _assert(expression_ != NULL);
591 _assert(next != NULL);
596 virtual CYExpression *Replace(CYContext &context);
597 void Output(CYOutput &out, CYFlags flags) const;
599 virtual CYFunctionParameter *Parameter() const;
602 struct CYParenthetical :
605 CYExpression *expression_;
607 CYParenthetical(CYExpression *expression) :
608 expression_(expression)
614 virtual CYTarget *Replace(CYContext &context);
615 void Output(CYOutput &out, CYFlags flags) const;
620 struct CYFunctionParameter :
621 CYNext<CYFunctionParameter>,
626 CYFunctionParameter(CYBinding *binding, CYFunctionParameter *next = NULL) :
627 CYNext<CYFunctionParameter>(next),
632 void Replace(CYContext &context, CYStatement *&statements);
633 void Output(CYOutput &out) const;
636 struct CYComprehension :
637 CYNext<CYComprehension>,
640 CYComprehension(CYComprehension *next = NULL) :
641 CYNext<CYComprehension>(next)
645 virtual CYFunctionParameter *Parameter(CYContext &context) const = 0;
646 CYFunctionParameter *Parameters(CYContext &context) const;
647 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
648 virtual void Output(CYOutput &out) const = 0;
651 struct CYForInComprehension :
655 CYExpression *iterable_;
657 CYForInComprehension(CYBinding *binding, CYExpression *iterable, CYComprehension *next = NULL) :
658 CYComprehension(next),
664 virtual CYFunctionParameter *Parameter(CYContext &context) const;
665 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
666 virtual void Output(CYOutput &out) const;
669 struct CYForOfComprehension :
673 CYExpression *iterable_;
675 CYForOfComprehension(CYBinding *binding, CYExpression *iterable, CYComprehension *next = NULL) :
676 CYComprehension(next),
682 virtual CYFunctionParameter *Parameter(CYContext &context) const;
683 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
684 virtual void Output(CYOutput &out) const;
687 struct CYIfComprehension :
692 CYIfComprehension(CYExpression *test, CYComprehension *next = NULL) :
693 CYComprehension(next),
698 virtual CYFunctionParameter *Parameter(CYContext &context) const;
699 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
700 virtual void Output(CYOutput &out) const;
703 struct CYArrayComprehension :
706 CYExpression *expression_;
707 CYComprehension *comprehensions_;
709 CYArrayComprehension(CYExpression *expression, CYComprehension *comprehensions) :
710 expression_(expression),
711 comprehensions_(comprehensions)
717 virtual CYTarget *Replace(CYContext &context);
718 virtual void Output(CYOutput &out, CYFlags flags) const;
724 CYLocation location_;
728 virtual CYExpression *Primitive(CYContext &context) {
736 virtual CYTarget *Replace(CYContext &context);
749 CYRange(uint64_t lo, uint64_t hi) :
754 bool operator [](uint8_t value) const {
755 return !(value >> 7) && (value >> 6 ? hi_ : lo_) >> (value & 0x3f) & 0x1;
758 void operator()(uint8_t value) {
761 (value >> 6 ? hi_ : lo_) |= uint64_t(0x1) << (value & 0x3f);
765 extern CYRange DigitRange_;
766 extern CYRange WordStartRange_;
767 extern CYRange WordEndRange_;
782 CYString(const char *value) :
788 CYString(const char *value, size_t size) :
794 CYString(const CYWord *word) :
795 value_(word->Word()),
796 size_(strlen(value_))
800 const char *Value() const {
804 virtual CYIdentifier *Identifier() const;
805 virtual const char *Word() const;
807 virtual CYNumber *Number(CYContext &context);
808 virtual CYString *String(CYContext &context);
810 CYString *Concat(CYContext &out, CYString *rhs) const;
811 virtual void Output(CYOutput &out, CYFlags flags) const;
813 virtual CYExpression *PropertyName(CYContext &context);
814 virtual void PropertyName(CYOutput &out) const;
817 struct CYElementValue;
822 CYExpression *expression_;
825 CYSpan(CYExpression *expression, CYString *string, CYSpan *next) :
826 CYNext<CYSpan>(next),
827 expression_(expression),
832 CYElementValue *Replace(CYContext &context);
841 CYTemplate(CYString *string, CYSpan *spans) :
849 virtual CYString *String(CYContext &context);
851 virtual CYTarget *Replace(CYContext &context);
852 virtual void Output(CYOutput &out, CYFlags flags) const;
861 CYNumber(double value) :
866 double Value() const {
870 virtual CYNumber *Number(CYContext &context);
871 virtual CYString *String(CYContext &context);
873 virtual void Output(CYOutput &out, CYFlags flags) const;
875 virtual CYExpression *PropertyName(CYContext &context);
876 virtual void PropertyName(CYOutput &out) const;
882 CYExpression *expression_;
884 CYComputed(CYExpression *expression) :
885 expression_(expression)
889 virtual bool Computed() const {
893 virtual CYExpression *PropertyName(CYContext &context);
894 virtual void PropertyName(CYOutput &out) const;
903 CYRegEx(const char *value, size_t size) :
909 const char *Value() const {
913 virtual void Output(CYOutput &out, CYFlags flags) const;
919 virtual CYNumber *Number(CYContext &context);
920 virtual CYString *String(CYContext &context);
922 virtual void Output(CYOutput &out, CYFlags flags) const;
928 virtual CYTarget *Replace(CYContext &context);
929 virtual void Output(CYOutput &out, CYFlags flags) const;
937 virtual bool RightHand() const {
941 virtual bool Value() const = 0;
942 virtual void Output(CYOutput &out, CYFlags flags) const;
948 virtual bool Value() const {
952 virtual CYNumber *Number(CYContext &context);
953 virtual CYString *String(CYContext &context);
959 virtual bool Value() const {
963 virtual CYNumber *Number(CYContext &context);
964 virtual CYString *String(CYContext &context);
972 CYVariable(CYIdentifier *name) :
977 CYVariable(const char *name) :
978 name_(new($pool) CYIdentifier(name))
984 virtual bool Eval() const {
985 return strcmp(name_->Word(), "eval") == 0;
988 virtual CYTarget *Replace(CYContext &context);
989 virtual void Output(CYOutput &out, CYFlags flags) const;
991 virtual CYFunctionParameter *Parameter() const;
999 CYSymbol(const char *name) :
1006 virtual CYTarget *Replace(CYContext &context);
1007 virtual void Output(CYOutput &out, CYFlags flags) const;
1015 CYPrefix(CYExpression *rhs) :
1020 virtual bool Alphabetic() const = 0;
1021 virtual const char *Operator() const = 0;
1025 virtual CYExpression *Replace(CYContext &context);
1026 virtual void Output(CYOutput &out, CYFlags flags) const;
1035 CYInfix(CYExpression *lhs, CYExpression *rhs) :
1041 void SetLeft(CYExpression *lhs) {
1045 virtual bool Alphabetic() const = 0;
1046 virtual const char *Operator() const = 0;
1048 virtual CYExpression *Replace(CYContext &context);
1049 virtual void Output(CYOutput &out, CYFlags flags) const;
1057 CYPostfix(CYExpression *lhs) :
1062 virtual const char *Operator() const = 0;
1066 virtual CYExpression *Replace(CYContext &context);
1067 virtual void Output(CYOutput &out, CYFlags flags) const;
1070 struct CYAssignment :
1076 CYAssignment(CYTarget *lhs, CYExpression *rhs) :
1082 void SetRight(CYExpression *rhs) {
1086 virtual const char *Operator() const = 0;
1090 virtual CYExpression *Replace(CYContext &context);
1091 virtual void Output(CYOutput &out, CYFlags flags) const;
1099 CYExpression *value_;
1101 CYArgument(CYExpression *value, CYArgument *next = NULL) :
1102 CYNext<CYArgument>(next),
1108 CYArgument(CYWord *name, CYExpression *value, CYArgument *next = NULL) :
1109 CYNext<CYArgument>(next),
1115 CYArgument *Replace(CYContext &context);
1116 void Output(CYOutput &out) const;
1123 CYExpression *value_;
1126 CYClause(CYExpression *value, CYStatement *code) :
1132 void Replace(CYContext &context);
1133 virtual void Output(CYOutput &out) const;
1140 CYElement(CYElement *next) :
1141 CYNext<CYElement>(next)
1145 virtual bool Elision() const = 0;
1147 virtual void Replace(CYContext &context) = 0;
1150 struct CYElementValue :
1153 CYExpression *value_;
1155 CYElementValue(CYExpression *value, CYElement *next = NULL) :
1161 virtual bool Elision() const {
1162 return value_ == NULL;
1165 virtual void Replace(CYContext &context);
1166 virtual void Output(CYOutput &out) const;
1169 struct CYElementSpread :
1172 CYExpression *value_;
1174 CYElementSpread(CYExpression *value, CYElement *next = NULL) :
1180 virtual bool Elision() const {
1184 virtual void Replace(CYContext &context);
1185 virtual void Output(CYOutput &out) const;
1191 CYElement *elements_;
1193 CYArray(CYElement *elements = NULL) :
1198 virtual CYTarget *Replace(CYContext &context);
1199 virtual void Output(CYOutput &out, CYFlags flags) const;
1203 CYIdentifier *identifier_;
1204 CYExpression *initializer_;
1206 CYBinding(CYIdentifier *identifier, CYExpression *initializer = NULL) :
1207 identifier_(identifier),
1208 initializer_(initializer)
1212 CYTarget *Target(CYContext &context);
1214 virtual CYAssignment *Replace(CYContext &context, CYIdentifierKind kind);
1215 virtual void Output(CYOutput &out, CYFlags flags) const;
1218 struct CYForLexical :
1222 CYBinding *binding_;
1224 CYForLexical(bool constant, CYBinding *binding) :
1225 constant_(constant),
1230 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
1232 virtual CYTarget *Replace(CYContext &context);
1233 virtual void Output(CYOutput &out, CYFlags flags) const;
1236 struct CYForVariable :
1239 CYBinding *binding_;
1241 CYForVariable(CYBinding *binding) :
1246 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
1248 virtual CYTarget *Replace(CYContext &context);
1249 virtual void Output(CYOutput &out, CYFlags flags) const;
1256 CYBinding *binding_;
1258 CYBindings(CYBinding *binding, CYBindings *next = NULL) :
1259 CYNext<CYBindings>(next),
1264 CYExpression *Replace(CYContext &context, CYIdentifierKind kind);
1266 CYArgument *Argument(CYContext &context);
1267 CYFunctionParameter *Parameter(CYContext &context);
1269 virtual void Output(CYOutput &out) const;
1270 virtual void Output(CYOutput &out, CYFlags flags) const;
1276 CYBindings *bindings_;
1278 CYVar(CYBindings *bindings) :
1285 virtual CYForInitializer *Replace(CYContext &context);
1286 virtual void Output(CYOutput &out, CYFlags flags) const;
1293 CYBindings *bindings_;
1295 CYLexical(bool constant, CYBindings *bindings) :
1296 constant_(constant),
1303 virtual CYForInitializer *Replace(CYContext &context);
1304 virtual void Output(CYOutput &out, CYFlags flags) const;
1308 CYList<CYBindings> bindings_;
1309 CYList<CYStatement> statements_;
1311 operator bool() const {
1312 return statements_ != NULL;
1320 CYPropertyName *name_;
1322 CYProperty(CYPropertyName *name, CYProperty *next = NULL) :
1323 CYNext<CYProperty>(next),
1328 virtual bool Update() const;
1330 CYProperty *ReplaceAll(CYContext &context, CYBuilder &builder, CYExpression *self, bool update);
1331 void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, bool protect);
1333 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect) = 0;
1335 virtual void Replace(CYContext &context) = 0;
1336 virtual void Output(CYOutput &out) const;
1339 struct CYPropertyValue :
1342 CYExpression *value_;
1344 CYPropertyValue(CYPropertyName *name, CYExpression *value, CYProperty *next = NULL) :
1345 CYProperty(name, next),
1350 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1351 virtual void Replace(CYContext &context);
1352 virtual void Output(CYOutput &out) const;
1358 CYForInitializer *initializer_;
1359 CYExpression *test_;
1360 CYExpression *increment_;
1363 CYFor(CYForInitializer *initializer, CYExpression *test, CYExpression *increment, CYStatement *code) :
1364 initializer_(initializer),
1366 increment_(increment),
1373 virtual CYStatement *Replace(CYContext &context);
1374 virtual void Output(CYOutput &out, CYFlags flags) const;
1380 CYForInInitializer *initializer_;
1381 CYExpression *iterable_;
1384 CYForIn(CYForInInitializer *initializer, CYExpression *iterable, CYStatement *code) :
1385 initializer_(initializer),
1386 iterable_(iterable),
1393 virtual CYStatement *Replace(CYContext &context);
1394 virtual void Output(CYOutput &out, CYFlags flags) const;
1397 struct CYForInitialized :
1400 CYBinding *binding_;
1401 CYExpression *iterable_;
1404 CYForInitialized(CYBinding *binding, CYExpression *iterable, CYStatement *code) :
1406 iterable_(iterable),
1413 virtual CYStatement *Replace(CYContext &context);
1414 virtual void Output(CYOutput &out, CYFlags flags) const;
1420 CYForInInitializer *initializer_;
1421 CYExpression *iterable_;
1424 CYForOf(CYForInInitializer *initializer, CYExpression *iterable, CYStatement *code) :
1425 initializer_(initializer),
1426 iterable_(iterable),
1433 virtual CYStatement *Replace(CYContext &context);
1434 virtual void Output(CYOutput &out, CYFlags flags) const;
1440 CYProperty *properties_;
1442 CYObject(CYProperty *properties = NULL) :
1443 properties_(properties)
1447 CYTarget *Replace(CYContext &context, CYTarget *seed);
1449 virtual CYTarget *Replace(CYContext &context);
1450 void Output(CYOutput &out, CYFlags flags) const;
1456 CYExpression *object_;
1457 CYExpression *property_;
1459 CYMember(CYExpression *object, CYExpression *property) :
1465 void SetLeft(CYExpression *object) {
1470 struct CYDirectMember :
1473 CYDirectMember(CYExpression *object, CYExpression *property) :
1474 CYMember(object, property)
1480 virtual CYTarget *Replace(CYContext &context);
1481 virtual void Output(CYOutput &out, CYFlags flags) const;
1484 struct CYIndirectMember :
1487 CYIndirectMember(CYExpression *object, CYExpression *property) :
1488 CYMember(object, property)
1494 virtual CYTarget *Replace(CYContext &context);
1495 virtual void Output(CYOutput &out, CYFlags flags) const;
1498 struct CYResolveMember :
1501 CYResolveMember(CYExpression *object, CYExpression *property) :
1502 CYMember(object, property)
1508 virtual CYTarget *Replace(CYContext &context);
1509 virtual void Output(CYOutput &out, CYFlags flags) const;
1512 struct CYSubscriptMember :
1515 CYSubscriptMember(CYExpression *object, CYExpression *property) :
1516 CYMember(object, property)
1522 virtual CYTarget *Replace(CYContext &context);
1523 virtual void Output(CYOutput &out, CYFlags flags) const;
1532 CYExpression *constructor_;
1533 CYArgument *arguments_;
1535 New(CYExpression *constructor, CYArgument *arguments = NULL) :
1536 constructor_(constructor),
1537 arguments_(arguments)
1541 virtual int Precedence() const {
1542 return arguments_ == NULL ? 2 : 1;
1545 virtual bool IsNew() const {
1549 virtual CYTarget *Replace(CYContext &context);
1550 virtual void Output(CYOutput &out, CYFlags flags) const;
1552 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1560 CYArgument *arguments_;
1562 CYApply(CYArgument *arguments = NULL) :
1563 arguments_(arguments)
1569 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1575 CYExpression *function_;
1577 CYCall(CYExpression *function, CYArgument *arguments = NULL) :
1583 virtual void Output(CYOutput &out, CYFlags flags) const;
1584 virtual CYTarget *Replace(CYContext &context);
1590 CYEval(CYArgument *arguments) :
1595 virtual void Output(CYOutput &out, CYFlags flags) const;
1596 virtual CYTarget *Replace(CYContext &context);
1606 CYBraced(CYTarget *lhs = NULL) :
1613 void SetLeft(CYTarget *lhs) {
1618 struct CYRubyBlock :
1623 CYRubyBlock(CYTarget *lhs, CYRubyProc *proc) :
1629 virtual CYTarget *Replace(CYContext &context);
1630 virtual void Output(CYOutput &out, CYFlags flags) const;
1632 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1640 CYExtend(CYTarget *lhs, CYProperty *properties = NULL) :
1646 virtual CYTarget *Replace(CYContext &context);
1647 virtual void Output(CYOutput &out, CYFlags flags) const;
1653 CYExpression *test_;
1655 CYStatement *false_;
1657 CYIf(CYExpression *test, CYStatement *_true, CYStatement *_false = NULL) :
1666 virtual CYStatement *Replace(CYContext &context);
1667 virtual void Output(CYOutput &out, CYFlags flags) const;
1669 virtual CYStatement *Return();
1675 CYExpression *test_;
1678 CYDoWhile(CYExpression *test, CYStatement *code) :
1686 virtual CYStatement *Replace(CYContext &context);
1687 virtual void Output(CYOutput &out, CYFlags flags) const;
1693 CYExpression *test_;
1696 CYWhile(CYExpression *test, CYStatement *code) :
1704 virtual CYStatement *Replace(CYContext &context);
1705 virtual void Output(CYOutput &out, CYFlags flags) const;
1709 CYFunctionParameter *parameters_;
1712 CYNonLocal *nonlocal_;
1715 CYIdentifier *super_;
1717 CYFunction(CYFunctionParameter *parameters, CYStatement *code) :
1718 parameters_(parameters),
1726 void Replace(CYContext &context);
1727 void Output(CYOutput &out) const;
1730 struct CYFunctionExpression :
1734 CYIdentifier *name_;
1736 CYFunctionExpression(CYIdentifier *name, CYFunctionParameter *parameters, CYStatement *code) :
1737 CYFunction(parameters, code),
1744 CYTarget *Replace(CYContext &context) override;
1745 virtual void Output(CYOutput &out, CYFlags flags) const;
1752 CYFatArrow(CYFunctionParameter *parameters, CYStatement *code) :
1753 CYFunction(parameters, code)
1759 CYExpression *Replace(CYContext &context) override;
1760 virtual void Output(CYOutput &out, CYFlags flags) const;
1767 CYRubyProc(CYFunctionParameter *parameters, CYStatement *code) :
1768 CYFunction(parameters, code)
1774 CYTarget *Replace(CYContext &context) override;
1775 virtual void Output(CYOutput &out, CYFlags flags) const;
1778 struct CYFunctionStatement :
1782 CYIdentifier *name_;
1784 CYFunctionStatement(CYIdentifier *name, CYFunctionParameter *parameters, CYStatement *code) :
1785 CYFunction(parameters, code),
1792 CYStatement *Replace(CYContext &context) override;
1793 virtual void Output(CYOutput &out, CYFlags flags) const;
1796 struct CYPropertyMethod;
1802 CYMethod(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1803 CYFunction(parameters, code),
1804 CYProperty(name, next)
1808 virtual CYFunctionExpression *Constructor();
1810 using CYProperty::Replace;
1811 virtual void Replace(CYContext &context);
1814 struct CYPropertyGetter :
1817 CYPropertyGetter(CYPropertyName *name, CYStatement *code, CYProperty *next = NULL) :
1818 CYMethod(name, NULL, code, next)
1822 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1823 virtual void Output(CYOutput &out) const;
1826 struct CYPropertySetter :
1829 CYPropertySetter(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1830 CYMethod(name, parameters, code, next)
1834 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1835 virtual void Output(CYOutput &out) const;
1838 struct CYPropertyMethod :
1841 CYPropertyMethod(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1842 CYMethod(name, parameters, code, next)
1846 bool Update() const override;
1848 virtual CYFunctionExpression *Constructor();
1850 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1851 virtual void Output(CYOutput &out) const;
1854 struct CYClassTail :
1857 CYExpression *extends_;
1859 CYFunctionExpression *constructor_;
1860 CYList<CYProperty> instance_;
1861 CYList<CYProperty> static_;
1863 CYClassTail(CYExpression *extends) :
1869 void Output(CYOutput &out) const;
1872 struct CYClassExpression :
1875 CYIdentifier *name_;
1878 CYClassExpression(CYIdentifier *name, CYClassTail *tail) :
1886 CYTarget *Replace(CYContext &context) override;
1887 virtual void Output(CYOutput &out, CYFlags flags) const;
1890 struct CYClassStatement :
1893 CYIdentifier *name_;
1896 CYClassStatement(CYIdentifier *name, CYClassTail *tail) :
1904 CYStatement *Replace(CYContext &context) override;
1905 virtual void Output(CYOutput &out, CYFlags flags) const;
1908 struct CYSuperCall :
1911 CYArgument *arguments_;
1913 CYSuperCall(CYArgument *arguments) :
1914 arguments_(arguments)
1920 CYTarget *Replace(CYContext &context) override;
1921 virtual void Output(CYOutput &out, CYFlags flags) const;
1924 struct CYSuperAccess :
1927 CYExpression *property_;
1929 CYSuperAccess(CYExpression *property) :
1936 CYTarget *Replace(CYContext &context) override;
1937 virtual void Output(CYOutput &out, CYFlags flags) const;
1943 CYExpression *expression_;
1945 CYExpress(CYExpression *expression) :
1946 expression_(expression)
1948 if (expression_ == NULL)
1954 CYForInitializer *Replace(CYContext &context) override;
1955 virtual void Output(CYOutput &out, CYFlags flags) const;
1957 virtual CYStatement *Return();
1963 CYIdentifier *label_;
1965 CYContinue(CYIdentifier *label) :
1972 CYStatement *Replace(CYContext &context) override;
1973 virtual void Output(CYOutput &out, CYFlags flags) const;
1979 CYIdentifier *label_;
1981 CYBreak(CYIdentifier *label) :
1988 CYStatement *Replace(CYContext &context) override;
1989 virtual void Output(CYOutput &out, CYFlags flags) const;
1995 CYExpression *value_;
1997 CYReturn(CYExpression *value) :
2004 CYStatement *Replace(CYContext &context) override;
2005 virtual void Output(CYOutput &out, CYFlags flags) const;
2008 struct CYYieldGenerator :
2011 CYExpression *value_;
2013 CYYieldGenerator(CYExpression *value) :
2020 CYExpression *Replace(CYContext &context) override;
2021 virtual void Output(CYOutput &out, CYFlags flags) const;
2024 struct CYYieldValue :
2027 CYExpression *value_;
2029 CYYieldValue(CYExpression *value) :
2036 virtual CYExpression *Replace(CYContext &context);
2037 virtual void Output(CYOutput &out, CYFlags flags) const;
2045 virtual CYForInitializer *Replace(CYContext &context);
2046 virtual void Output(CYOutput &out, CYFlags flags) const;
2054 CYFinally(CYStatement *code) :
2059 void Replace(CYContext &context);
2060 virtual void Output(CYOutput &out) const;
2063 struct CYTypeSpecifier :
2066 virtual CYTarget *Replace(CYContext &context) = 0;
2069 struct CYTypeError :
2075 virtual CYTarget *Replace(CYContext &context);
2076 virtual void Output(CYOutput &out) const;
2079 enum CYTypeSigning {
2085 struct CYTypeCharacter :
2088 CYTypeSigning signing_;
2090 CYTypeCharacter(CYTypeSigning signing) :
2095 virtual CYTarget *Replace(CYContext &context);
2096 virtual void Output(CYOutput &out) const;
2099 struct CYTypeInt128 :
2102 CYTypeSigning signing_;
2104 CYTypeInt128(CYTypeSigning signing) :
2109 virtual CYTarget *Replace(CYContext &context);
2110 virtual void Output(CYOutput &out) const;
2113 struct CYTypeIntegral :
2116 CYTypeSigning signing_;
2119 CYTypeIntegral(CYTypeSigning signing, int length = 1) :
2125 CYTypeIntegral *Long() {
2126 if (length_ != 1 && length_ != 2)
2132 CYTypeIntegral *Short() {
2139 CYTypeIntegral *Signed() {
2140 if (signing_ != CYTypeNeutral)
2142 signing_ = CYTypeSigned;
2146 CYTypeIntegral *Unsigned() {
2147 if (signing_ != CYTypeNeutral)
2149 signing_ = CYTypeUnsigned;
2153 virtual CYTarget *Replace(CYContext &context);
2154 virtual void Output(CYOutput &out) const;
2163 virtual CYTarget *Replace(CYContext &context);
2164 virtual void Output(CYOutput &out) const;
2167 enum CYTypeReferenceKind {
2168 CYTypeReferenceStruct,
2169 CYTypeReferenceEnum,
2172 struct CYTypeReference :
2175 CYTypeReferenceKind kind_;
2176 CYIdentifier *name_;
2178 CYTypeReference(CYTypeReferenceKind kind, CYIdentifier *name) :
2184 virtual CYTarget *Replace(CYContext &context);
2185 virtual void Output(CYOutput &out) const;
2188 struct CYTypeVariable :
2191 CYIdentifier *name_;
2193 CYTypeVariable(CYIdentifier *name) :
2198 CYTypeVariable(const char *name) :
2199 name_(new($pool) CYIdentifier(name))
2203 virtual CYTarget *Replace(CYContext &context);
2204 virtual void Output(CYOutput &out) const;
2207 struct CYTypeFunctionWith;
2209 struct CYTypeModifier :
2210 CYNext<CYTypeModifier>
2212 CYTypeModifier(CYTypeModifier *next) :
2213 CYNext<CYTypeModifier>(next)
2217 virtual int Precedence() const = 0;
2219 virtual CYTarget *Replace_(CYContext &context, CYTarget *type) = 0;
2220 CYTarget *Replace(CYContext &context, CYTarget *type);
2222 virtual void Output(CYOutput &out, CYPropertyName *name) const = 0;
2223 void Output(CYOutput &out, int precedence, CYPropertyName *name, bool space) const;
2225 virtual CYTypeFunctionWith *Function() { return NULL; }
2228 struct CYTypeArrayOf :
2231 CYExpression *size_;
2233 CYTypeArrayOf(CYExpression *size, CYTypeModifier *next = NULL) :
2234 CYTypeModifier(next),
2241 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2242 void Output(CYOutput &out, CYPropertyName *name) const override;
2245 struct CYTypeConstant :
2248 CYTypeConstant(CYTypeModifier *next = NULL) :
2249 CYTypeModifier(next)
2255 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2256 void Output(CYOutput &out, CYPropertyName *name) const override;
2259 struct CYTypePointerTo :
2262 CYTypePointerTo(CYTypeModifier *next = NULL) :
2263 CYTypeModifier(next)
2269 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2270 void Output(CYOutput &out, CYPropertyName *name) const override;
2273 struct CYTypeVolatile :
2276 CYTypeVolatile(CYTypeModifier *next = NULL) :
2277 CYTypeModifier(next)
2283 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2284 void Output(CYOutput &out, CYPropertyName *name) const override;
2290 CYTypeSpecifier *specifier_;
2291 CYTypeModifier *modifier_;
2293 CYType(CYTypeSpecifier *specifier = NULL, CYTypeModifier *modifier = NULL) :
2294 specifier_(specifier),
2299 inline CYType *Modify(CYTypeModifier *modifier) {
2300 CYSetLast(modifier_) = modifier;
2304 void Output(CYOutput &out, CYPropertyName *name) const;
2306 virtual CYTarget *Replace(CYContext &context);
2307 virtual void Output(CYOutput &out) const;
2309 CYTypeFunctionWith *Function();
2312 struct CYTypedLocation :
2315 CYLocation location_;
2317 CYTypedLocation(const CYLocation &location) :
2323 struct CYTypedName :
2326 CYPropertyName *name_;
2328 CYTypedName(const CYLocation &location, CYPropertyName *name = NULL) :
2329 CYTypedLocation(location),
2335 struct CYEncodedType :
2340 CYEncodedType(CYType *typed) :
2347 virtual CYTarget *Replace(CYContext &context);
2348 virtual void Output(CYOutput &out, CYFlags flags) const;
2351 struct CYTypedParameter :
2352 CYNext<CYTypedParameter>,
2356 CYIdentifier *name_;
2358 CYTypedParameter(CYType *type, CYIdentifier *name, CYTypedParameter *next = NULL) :
2359 CYNext<CYTypedParameter>(next),
2365 CYArgument *Argument(CYContext &context);
2366 CYFunctionParameter *Parameters(CYContext &context);
2367 CYExpression *TypeSignature(CYContext &context, CYExpression *prefix);
2369 virtual void Output(CYOutput &out) const;
2372 struct CYTypedFormal {
2374 CYTypedParameter *parameters_;
2376 CYTypedFormal(bool variadic) :
2377 variadic_(variadic),
2387 CYTypedParameter *parameters_;
2390 CYLambda(CYType *typed, CYTypedParameter *parameters, CYStatement *code) :
2392 parameters_(parameters),
2399 virtual CYTarget *Replace(CYContext &context);
2400 virtual void Output(CYOutput &out, CYFlags flags) const;
2409 CYModule(CYWord *part, CYModule *next = NULL) :
2410 CYNext<CYModule>(next),
2415 CYString *Replace(CYContext &context, const char *separator) const;
2416 void Output(CYOutput &out) const;
2424 CYImport(CYModule *module) :
2431 virtual CYStatement *Replace(CYContext &context);
2432 virtual void Output(CYOutput &out, CYFlags flags) const;
2435 struct CYImportSpecifier :
2436 CYNext<CYImportSpecifier>
2439 CYIdentifier *binding_;
2441 CYImportSpecifier(CYWord *name, CYIdentifier *binding) :
2447 CYStatement *Replace(CYContext &context, CYIdentifier *module);
2450 struct CYImportDeclaration :
2453 CYImportSpecifier *specifiers_;
2456 CYImportDeclaration(CYImportSpecifier *specifiers, CYString *module) :
2457 specifiers_(specifiers),
2464 virtual CYStatement *Replace(CYContext &context);
2465 virtual void Output(CYOutput &out, CYFlags flags) const;
2468 struct CYExternalExpression :
2473 CYPropertyName *name_;
2475 CYExternalExpression(CYString *abi, CYType *type, CYPropertyName *name) :
2484 virtual CYTarget *Replace(CYContext &context);
2485 virtual void Output(CYOutput &out, CYFlags flags) const;
2488 struct CYExternalDefinition :
2493 CYIdentifier *name_;
2495 CYExternalDefinition(CYString *abi, CYType *type, CYIdentifier *name) :
2504 virtual CYStatement *Replace(CYContext &context);
2505 virtual void Output(CYOutput &out, CYFlags flags) const;
2508 struct CYTypeExpression :
2513 CYTypeExpression(CYType *typed) :
2520 virtual CYTarget *Replace(CYContext &context);
2521 virtual void Output(CYOutput &out, CYFlags flags) const;
2524 struct CYTypeDefinition :
2528 CYIdentifier *name_;
2530 CYTypeDefinition(CYType *type, CYIdentifier *name) :
2538 virtual CYStatement *Replace(CYContext &context);
2539 virtual void Output(CYOutput &out, CYFlags flags) const;
2542 struct CYTypeBlockWith :
2545 CYTypedParameter *parameters_;
2547 CYTypeBlockWith(CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2548 CYTypeModifier(next),
2549 parameters_(parameters)
2555 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2556 void Output(CYOutput &out, CYPropertyName *name) const override;
2559 struct CYTypeFunctionWith :
2563 CYTypedParameter *parameters_;
2565 CYTypeFunctionWith(bool variadic, CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2566 CYTypeModifier(next),
2567 variadic_(variadic),
2568 parameters_(parameters)
2574 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2575 void Output(CYOutput &out, CYPropertyName *name) const override;
2577 virtual CYTypeFunctionWith *Function() { return this; }
2580 struct CYTypeStructField :
2581 CYNext<CYTypeStructField>
2584 CYPropertyName *name_;
2586 CYTypeStructField(CYType *type, CYPropertyName *name, CYTypeStructField *next = NULL) :
2587 CYNext<CYTypeStructField>(next),
2594 struct CYStructTail :
2597 CYTypeStructField *fields_;
2599 CYStructTail(CYTypeStructField *fields) :
2604 CYTarget *Replace(CYContext &context);
2605 virtual void Output(CYOutput &out) const;
2608 struct CYTypeStruct :
2611 CYIdentifier *name_;
2612 CYStructTail *tail_;
2614 CYTypeStruct(CYIdentifier *name, CYStructTail *tail) :
2620 virtual CYTarget *Replace(CYContext &context);
2621 virtual void Output(CYOutput &out) const;
2624 struct CYStructDefinition :
2627 CYIdentifier *name_;
2628 CYStructTail *tail_;
2630 CYStructDefinition(CYIdentifier *name, CYStructTail *tail) :
2638 virtual CYStatement *Replace(CYContext &context);
2639 virtual void Output(CYOutput &out, CYFlags flags) const;
2642 struct CYEnumConstant :
2643 CYNext<CYEnumConstant>
2645 CYIdentifier *name_;
2648 CYEnumConstant(CYIdentifier *name, CYNumber *value, CYEnumConstant *next = NULL) :
2649 CYNext<CYEnumConstant>(next),
2659 CYIdentifier *name_;
2660 CYTypeSpecifier *specifier_;
2661 CYEnumConstant *constants_;
2663 CYTypeEnum(CYIdentifier *name, CYTypeSpecifier *specifier, CYEnumConstant *constants) :
2665 specifier_(specifier),
2666 constants_(constants)
2670 virtual CYTarget *Replace(CYContext &context);
2671 virtual void Output(CYOutput &out) const;
2680 CYIdentifier *name_;
2683 Catch(CYIdentifier *name, CYStatement *code) :
2689 void Replace(CYContext &context);
2690 virtual void Output(CYOutput &out) const;
2698 CYFinally *finally_;
2700 Try(CYStatement *code, Catch *_catch, CYFinally *finally) :
2709 virtual CYStatement *Replace(CYContext &context);
2710 virtual void Output(CYOutput &out, CYFlags flags) const;
2716 CYExpression *value_;
2718 Throw(CYExpression *value = NULL) :
2725 virtual CYStatement *Replace(CYContext &context);
2726 virtual void Output(CYOutput &out, CYFlags flags) const;
2734 CYExpression *scope_;
2737 CYWith(CYExpression *scope, CYStatement *code) :
2745 virtual CYStatement *Replace(CYContext &context);
2746 virtual void Output(CYOutput &out, CYFlags flags) const;
2752 CYExpression *value_;
2755 CYSwitch(CYExpression *value, CYClause *clauses) :
2763 virtual CYStatement *Replace(CYContext &context);
2764 virtual void Output(CYOutput &out, CYFlags flags) const;
2776 virtual CYStatement *Replace(CYContext &context);
2777 virtual void Output(CYOutput &out, CYFlags flags) const;
2780 struct CYCondition :
2783 CYExpression *test_;
2784 CYExpression *true_;
2785 CYExpression *false_;
2787 CYCondition(CYExpression *test, CYExpression *_true, CYExpression *_false) :
2796 virtual CYExpression *Replace(CYContext &context);
2797 virtual void Output(CYOutput &out, CYFlags flags) const;
2800 struct CYAddressOf :
2803 CYAddressOf(CYExpression *rhs) :
2808 virtual const char *Operator() const {
2814 virtual CYExpression *Replace(CYContext &context);
2822 CYIndirect(CYExpression *rhs) :
2827 // XXX: this should be checked
2830 virtual CYTarget *Replace(CYContext &context);
2831 virtual void Output(CYOutput &out, CYFlags flags) const;
2835 virtual CYExpression *Replace(CYContext &context);
2837 #define CYPostfix_(op, name, args...) \
2838 struct CY ## name : \
2841 CY ## name(CYExpression *lhs) : \
2846 virtual const char *Operator() const { \
2851 #define CYPrefix_(alphabetic, op, name, args...) \
2852 struct CY ## name : \
2855 CY ## name(CYExpression *rhs) : \
2860 CYAlphabetic(alphabetic) \
2862 virtual const char *Operator() const { \
2867 #define CYInfix_(alphabetic, precedence, op, name, args...) \
2868 struct CY ## name : \
2871 CY ## name(CYExpression *lhs, CYExpression *rhs) : \
2876 CYAlphabetic(alphabetic) \
2877 CYPrecedence(precedence) \
2879 virtual const char *Operator() const { \
2884 #define CYAssignment_(op, name, args...) \
2885 struct CY ## name ## Assign : \
2888 CY ## name ## Assign(CYTarget *lhs, CYExpression *rhs) : \
2889 CYAssignment(lhs, rhs) \
2893 virtual const char *Operator() const { \
2898 CYPostfix_("++", PostIncrement)
2899 CYPostfix_("--", PostDecrement)
2901 CYPrefix_(true, "delete", Delete)
2902 CYPrefix_(true, "void", Void)
2903 CYPrefix_(true, "typeof", TypeOf)
2904 CYPrefix_(false, "++", PreIncrement)
2905 CYPrefix_(false, "--", PreDecrement)
2906 CYPrefix_(false, "+", Affirm)
2907 CYPrefix_(false, "-", Negate)
2908 CYPrefix_(false, "~", BitwiseNot)
2909 CYPrefix_(false, "!", LogicalNot)
2911 CYInfix_(false, 5, "*", Multiply, CYReplace)
2912 CYInfix_(false, 5, "/", Divide)
2913 CYInfix_(false, 5, "%", Modulus)
2914 CYInfix_(false, 6, "+", Add, CYReplace)
2915 CYInfix_(false, 6, "-", Subtract)
2916 CYInfix_(false, 7, "<<", ShiftLeft)
2917 CYInfix_(false, 7, ">>", ShiftRightSigned)
2918 CYInfix_(false, 7, ">>>", ShiftRightUnsigned)
2919 CYInfix_(false, 8, "<", Less)
2920 CYInfix_(false, 8, ">", Greater)
2921 CYInfix_(false, 8, "<=", LessOrEqual)
2922 CYInfix_(false, 8, ">=", GreaterOrEqual)
2923 CYInfix_(true, 8, "instanceof", InstanceOf)
2924 CYInfix_(true, 8, "in", In)
2925 CYInfix_(false, 9, "==", Equal)
2926 CYInfix_(false, 9, "!=", NotEqual)
2927 CYInfix_(false, 9, "===", Identical)
2928 CYInfix_(false, 9, "!==", NotIdentical)
2929 CYInfix_(false, 10, "&", BitwiseAnd)
2930 CYInfix_(false, 11, "^", BitwiseXOr)
2931 CYInfix_(false, 12, "|", BitwiseOr)
2932 CYInfix_(false, 13, "&&", LogicalAnd)
2933 CYInfix_(false, 14, "||", LogicalOr)
2935 CYAssignment_("=", )
2936 CYAssignment_("*=", Multiply)
2937 CYAssignment_("/=", Divide)
2938 CYAssignment_("%=", Modulus)
2939 CYAssignment_("+=", Add)
2940 CYAssignment_("-=", Subtract)
2941 CYAssignment_("<<=", ShiftLeft)
2942 CYAssignment_(">>=", ShiftRightSigned)
2943 CYAssignment_(">>>=", ShiftRightUnsigned)
2944 CYAssignment_("&=", BitwiseAnd)
2945 CYAssignment_("^=", BitwiseXOr)
2946 CYAssignment_("|=", BitwiseOr)
2948 #endif/*CYCRIPT_PARSER_HPP*/