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);
43 void CYStringify(std::ostringstream &str, const char *data, size_t size, bool c = false);
45 // XXX: this really should not be here ... :/
46 void *CYPoolFile(CYPool &pool, const char *path, size_t *psize);
47 CYUTF8String CYPoolFileUTF8String(CYPool &pool, const char *path);
52 virtual void Output(struct CYOutput &out) const = 0;
73 CYOutput(std::streambuf &out, CYOptions &options) :
84 void Check(char value);
87 _finline void operator ()(char value) {
88 _assert(out_.sputc(value) != EOF);
96 _finline void operator ()(const char *data, std::streamsize size) {
97 _assert(out_.sputn(data, size) == size);
99 position_.Columns(size);
102 _finline void operator ()(const char *data) {
103 return operator ()(data, strlen(data));
106 CYOutput &operator <<(char rhs);
107 CYOutput &operator <<(const char *rhs);
109 _finline CYOutput &operator <<(const CYThing *rhs) {
115 _finline CYOutput &operator <<(const CYThing &rhs) {
125 struct CYPropertyName {
126 virtual bool Computed() const {
130 virtual bool Constructor() const {
134 virtual CYIdentifier *Identifier() {
138 virtual CYExpression *PropertyName(CYContext &context) = 0;
139 virtual void PropertyName(CYOutput &out) const = 0;
150 CYNoBrace = (1 << 0),
151 CYNoFunction = (1 << 1),
152 CYNoClass = (1 << 2),
155 CYNoRightHand = (1 << 5),
156 CYNoDangle = (1 << 6),
157 CYNoInteger = (1 << 7),
158 CYNoColon = (1 << 8),
159 CYNoBFC = (CYNoBrace | CYNoFunction | CYNoClass),
162 _finline CYFlags operator ~(CYFlags rhs) {
163 return static_cast<CYFlags>(~static_cast<unsigned>(rhs));
166 _finline CYFlags operator &(CYFlags lhs, CYFlags rhs) {
167 return static_cast<CYFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs));
170 _finline CYFlags operator |(CYFlags lhs, CYFlags rhs) {
171 return static_cast<CYFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs));
174 _finline CYFlags &operator |=(CYFlags &lhs, CYFlags rhs) {
175 return lhs = lhs | rhs;
178 _finline CYFlags CYLeft(CYFlags flags) {
179 return flags & ~(CYNoDangle | CYNoInteger);
182 _finline CYFlags CYRight(CYFlags flags) {
183 return flags & ~CYNoBFC;
186 _finline CYFlags CYCenter(CYFlags flags) {
187 return CYLeft(CYRight(flags));
196 #define CYCompact(type) \
197 virtual CYCompactType Compact() const { \
198 return CYCompact ## type; \
205 void Single(CYOutput &out, CYFlags flags, CYCompactType request) const;
206 void Multiple(CYOutput &out, CYFlags flags = CYNoFlags) const;
207 virtual void Output(CYOutput &out) const;
209 virtual CYStatement *Replace(CYContext &context) = 0;
211 virtual CYCompactType Compact() const = 0;
212 virtual CYStatement *Return();
215 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
218 typedef CYList<CYStatement> CYStatements;
220 struct CYForInitializer :
223 virtual CYForInitializer *Replace(CYContext &context) = 0;
224 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
233 CYWord(const char *word) :
238 virtual bool Constructor() const {
239 return strcmp(word_, "constructor") == 0;
242 virtual const char *Word() const;
243 virtual void Output(CYOutput &out) const;
245 virtual CYExpression *PropertyName(CYContext &context);
246 virtual void PropertyName(CYOutput &out) const;
249 _finline std::ostream &operator <<(std::ostream &lhs, const CYWord &rhs) {
251 return lhs << rhs.Word();
254 enum CYIdentifierKind {
255 CYIdentifierArgument,
261 CYIdentifierVariable,
264 struct CYIdentifier :
265 CYNext<CYIdentifier>,
268 CYLocation location_;
272 CYIdentifier(const char *word) :
279 CYIdentifier *Identifier() override {
283 virtual const char *Word() const;
284 CYIdentifier *Replace(CYContext &context, CYIdentifierKind);
291 CYStatement *statement_;
293 CYLabel(CYIdentifier *name, CYStatement *statement) :
295 statement_(statement)
301 virtual CYStatement *Replace(CYContext &context);
302 virtual void Output(CYOutput &out, CYFlags flags) const;
305 struct CYCStringLess :
306 std::binary_function<const char *, const char *, bool>
308 _finline bool operator ()(const char *lhs, const char *rhs) const {
309 return strcmp(lhs, rhs) < 0;
313 struct CYIdentifierValueLess :
314 std::binary_function<CYIdentifier *, CYIdentifier *, bool>
316 _finline bool operator ()(CYIdentifier *lhs, CYIdentifier *rhs) const {
317 return CYCStringLess()(lhs->Word(), rhs->Word());
321 struct CYIdentifierFlags :
322 CYNext<CYIdentifierFlags>
324 CYIdentifier *identifier_;
325 CYIdentifierKind kind_;
329 CYIdentifierFlags(CYIdentifier *identifier, CYIdentifierKind kind, CYIdentifierFlags *next = NULL) :
330 CYNext<CYIdentifierFlags>(next),
331 identifier_(identifier),
343 CYIdentifierFlags *shadow_;
345 CYIdentifierFlags *internal_;
347 CYScope(bool transparent, CYContext &context);
349 CYIdentifierFlags *Lookup(CYContext &context, const char *word);
350 CYIdentifierFlags *Lookup(CYContext &context, CYIdentifier *identifier);
352 CYIdentifierFlags *Declare(CYContext &context, CYIdentifier *identifier, CYIdentifierKind kind);
353 void Merge(CYContext &context, const CYIdentifierFlags *flags);
355 void Close(CYContext &context, CYStatement *&statements);
356 void Close(CYContext &context);
365 CYScript(CYStatement *code) :
370 virtual void Replace(CYContext &context);
371 virtual void Output(CYOutput &out) const;
382 CYIdentifier *super_;
384 CYNonLocal *nonlocal_;
385 CYNonLocal *nextlocal_;
388 std::vector<CYIdentifier *> replace_;
390 CYContext(CYOptions &options) :
401 void ReplaceAll(CYStatement *&statement) {
402 if (statement == NULL)
404 CYStatement *next(statement->next_);
409 if (statement == NULL)
412 statement->SetNext(next);
415 template <typename Type_>
416 void Replace(Type_ *&value) {
417 for (;;) if (value == NULL)
420 Type_ *replace(value->Replace(*this));
421 if (replace != value)
427 void NonLocal(CYStatement *&statements);
428 CYIdentifier *Unique();
432 CYIdentifier *identifier_;
439 CYIdentifier *Target(CYContext &context) {
440 if (identifier_ == NULL)
441 identifier_ = context.Unique();
449 CYIdentifier *identifier_;
456 CYIdentifier *Identifier(CYContext &context) {
458 return next_->Identifier(context);
459 if (identifier_ == NULL)
460 identifier_ = context.Unique();
470 CYBlock(CYStatement *code) :
477 virtual CYStatement *Replace(CYContext &context);
479 virtual void Output(CYOutput &out, CYFlags flags) const;
481 virtual CYStatement *Return();
487 struct CYForInInitializer {
488 virtual CYStatement *Initialize(CYContext &context, CYExpression *value) = 0;
490 virtual CYTarget *Replace(CYContext &context) = 0;
491 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
494 struct CYFunctionParameter;
499 struct CYExpression :
502 virtual int Precedence() const = 0;
504 virtual bool RightHand() const {
508 virtual bool Eval() const {
512 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
514 virtual void Output(CYOutput &out) const;
515 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
516 void Output(CYOutput &out, int precedence, CYFlags flags) const;
518 virtual CYExpression *Replace(CYContext &context) = 0;
520 virtual CYExpression *Primitive(CYContext &context) {
524 virtual CYFunctionParameter *Parameter() const;
526 virtual CYNumber *Number(CYContext &context) {
530 virtual CYString *String(CYContext &context) {
534 virtual const char *Word() const {
543 virtual bool RightHand() const {
547 virtual bool IsNew() const {
551 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
553 virtual CYTarget *Replace(CYContext &context) = 0;
554 using CYExpression::Output;
557 #define CYAlphabetic(value) \
558 virtual bool Alphabetic() const { \
562 #define CYPrecedence(value) \
563 static const int Precedence_ = value; \
564 virtual int Precedence() const { \
565 return Precedence_; \
571 CYExpression *expression_;
574 CYCompound(CYExpression *expression, CYExpression *next) :
575 expression_(expression),
578 _assert(expression_ != NULL);
579 _assert(next != NULL);
584 virtual CYExpression *Replace(CYContext &context);
585 void Output(CYOutput &out, CYFlags flags) const;
587 virtual CYFunctionParameter *Parameter() const;
590 struct CYParenthetical :
593 CYExpression *expression_;
595 CYParenthetical(CYExpression *expression) :
596 expression_(expression)
602 virtual CYTarget *Replace(CYContext &context);
603 void Output(CYOutput &out, CYFlags flags) const;
608 struct CYFunctionParameter :
609 CYNext<CYFunctionParameter>,
614 CYFunctionParameter(CYBinding *binding, CYFunctionParameter *next = NULL) :
615 CYNext<CYFunctionParameter>(next),
620 void Replace(CYContext &context, CYStatement *&statements);
621 void Output(CYOutput &out) const;
624 struct CYComprehension :
625 CYNext<CYComprehension>,
628 CYComprehension(CYComprehension *next = NULL) :
629 CYNext<CYComprehension>(next)
633 virtual CYFunctionParameter *Parameter(CYContext &context) const = 0;
634 CYFunctionParameter *Parameters(CYContext &context) const;
635 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
636 virtual void Output(CYOutput &out) const = 0;
639 struct CYForInComprehension :
643 CYExpression *iterable_;
645 CYForInComprehension(CYBinding *binding, CYExpression *iterable, CYComprehension *next = NULL) :
646 CYComprehension(next),
652 virtual CYFunctionParameter *Parameter(CYContext &context) const;
653 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
654 virtual void Output(CYOutput &out) const;
657 struct CYForOfComprehension :
661 CYExpression *iterable_;
663 CYForOfComprehension(CYBinding *binding, CYExpression *iterable, CYComprehension *next = NULL) :
664 CYComprehension(next),
670 virtual CYFunctionParameter *Parameter(CYContext &context) const;
671 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
672 virtual void Output(CYOutput &out) const;
675 struct CYIfComprehension :
680 CYIfComprehension(CYExpression *test, CYComprehension *next = NULL) :
681 CYComprehension(next),
686 virtual CYFunctionParameter *Parameter(CYContext &context) const;
687 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
688 virtual void Output(CYOutput &out) const;
691 struct CYArrayComprehension :
694 CYExpression *expression_;
695 CYComprehension *comprehensions_;
697 CYArrayComprehension(CYExpression *expression, CYComprehension *comprehensions) :
698 expression_(expression),
699 comprehensions_(comprehensions)
705 virtual CYTarget *Replace(CYContext &context);
706 virtual void Output(CYOutput &out, CYFlags flags) const;
712 CYLocation location_;
716 virtual CYExpression *Primitive(CYContext &context) {
724 virtual CYTarget *Replace(CYContext &context);
737 CYRange(uint64_t lo, uint64_t hi) :
742 bool operator [](uint8_t value) const {
743 return !(value >> 7) && (value >> 6 ? hi_ : lo_) >> (value & 0x3f) & 0x1;
746 void operator()(uint8_t value) {
749 (value >> 6 ? hi_ : lo_) |= uint64_t(0x1) << (value & 0x3f);
753 extern CYRange DigitRange_;
754 extern CYRange WordStartRange_;
755 extern CYRange WordEndRange_;
770 CYString(const char *value) :
776 CYString(const char *value, size_t size) :
782 CYString(const CYWord *word) :
783 value_(word->Word()),
784 size_(strlen(value_))
788 const char *Value() const {
792 virtual CYIdentifier *Identifier() const;
793 virtual const char *Word() const;
795 virtual CYNumber *Number(CYContext &context);
796 virtual CYString *String(CYContext &context);
798 CYString *Concat(CYContext &out, CYString *rhs) const;
799 virtual void Output(CYOutput &out, CYFlags flags) const;
801 virtual CYExpression *PropertyName(CYContext &context);
802 virtual void PropertyName(CYOutput &out) const;
805 struct CYElementValue;
810 CYExpression *expression_;
813 CYSpan(CYExpression *expression, CYString *string, CYSpan *next) :
814 CYNext<CYSpan>(next),
815 expression_(expression),
820 CYElementValue *Replace(CYContext &context);
829 CYTemplate(CYString *string, CYSpan *spans) :
837 virtual CYTarget *Replace(CYContext &context);
838 virtual void Output(CYOutput &out, CYFlags flags) const;
847 CYNumber(double value) :
852 double Value() const {
856 virtual CYNumber *Number(CYContext &context);
857 virtual CYString *String(CYContext &context);
859 virtual void Output(CYOutput &out, CYFlags flags) const;
861 virtual CYExpression *PropertyName(CYContext &context);
862 virtual void PropertyName(CYOutput &out) const;
868 CYExpression *expression_;
870 CYComputed(CYExpression *expression) :
871 expression_(expression)
875 virtual bool Computed() const {
879 virtual CYExpression *PropertyName(CYContext &context);
880 virtual void PropertyName(CYOutput &out) const;
889 CYRegEx(const char *value, size_t size) :
895 const char *Value() const {
899 virtual void Output(CYOutput &out, CYFlags flags) const;
905 virtual CYNumber *Number(CYContext &context);
906 virtual CYString *String(CYContext &context);
908 virtual void Output(CYOutput &out, CYFlags flags) const;
914 virtual CYTarget *Replace(CYContext &context);
915 virtual void Output(CYOutput &out, CYFlags flags) const;
923 virtual bool RightHand() const {
927 virtual bool Value() const = 0;
928 virtual void Output(CYOutput &out, CYFlags flags) const;
934 virtual bool Value() const {
938 virtual CYNumber *Number(CYContext &context);
939 virtual CYString *String(CYContext &context);
945 virtual bool Value() const {
949 virtual CYNumber *Number(CYContext &context);
950 virtual CYString *String(CYContext &context);
958 CYVariable(CYIdentifier *name) :
963 CYVariable(const char *name) :
964 name_(new($pool) CYIdentifier(name))
970 virtual bool Eval() const {
971 return strcmp(name_->Word(), "eval") == 0;
974 virtual CYTarget *Replace(CYContext &context);
975 virtual void Output(CYOutput &out, CYFlags flags) const;
977 virtual CYFunctionParameter *Parameter() const;
985 CYSymbol(const char *name) :
992 virtual CYTarget *Replace(CYContext &context);
993 virtual void Output(CYOutput &out, CYFlags flags) const;
1001 CYPrefix(CYExpression *rhs) :
1006 virtual bool Alphabetic() const = 0;
1007 virtual const char *Operator() const = 0;
1011 virtual CYExpression *Replace(CYContext &context);
1012 virtual void Output(CYOutput &out, CYFlags flags) const;
1021 CYInfix(CYExpression *lhs, CYExpression *rhs) :
1027 void SetLeft(CYExpression *lhs) {
1031 virtual bool Alphabetic() const = 0;
1032 virtual const char *Operator() const = 0;
1034 virtual CYExpression *Replace(CYContext &context);
1035 virtual void Output(CYOutput &out, CYFlags flags) const;
1043 CYPostfix(CYExpression *lhs) :
1048 virtual const char *Operator() const = 0;
1052 virtual CYExpression *Replace(CYContext &context);
1053 virtual void Output(CYOutput &out, CYFlags flags) const;
1056 struct CYAssignment :
1062 CYAssignment(CYTarget *lhs, CYExpression *rhs) :
1068 void SetRight(CYExpression *rhs) {
1072 virtual const char *Operator() const = 0;
1076 virtual CYExpression *Replace(CYContext &context);
1077 virtual void Output(CYOutput &out, CYFlags flags) const;
1085 CYExpression *value_;
1087 CYArgument(CYExpression *value, CYArgument *next = NULL) :
1088 CYNext<CYArgument>(next),
1094 CYArgument(CYWord *name, CYExpression *value, CYArgument *next = NULL) :
1095 CYNext<CYArgument>(next),
1101 CYArgument *Replace(CYContext &context);
1102 void Output(CYOutput &out) const;
1109 CYExpression *value_;
1112 CYClause(CYExpression *value, CYStatement *code) :
1118 void Replace(CYContext &context);
1119 virtual void Output(CYOutput &out) const;
1126 CYElement(CYElement *next) :
1127 CYNext<CYElement>(next)
1131 virtual bool Elision() const = 0;
1133 virtual void Replace(CYContext &context) = 0;
1136 struct CYElementValue :
1139 CYExpression *value_;
1141 CYElementValue(CYExpression *value, CYElement *next = NULL) :
1147 virtual bool Elision() const {
1148 return value_ == NULL;
1151 virtual void Replace(CYContext &context);
1152 virtual void Output(CYOutput &out) const;
1155 struct CYElementSpread :
1158 CYExpression *value_;
1160 CYElementSpread(CYExpression *value, CYElement *next = NULL) :
1166 virtual bool Elision() const {
1170 virtual void Replace(CYContext &context);
1171 virtual void Output(CYOutput &out) const;
1177 CYElement *elements_;
1179 CYArray(CYElement *elements = NULL) :
1184 virtual CYTarget *Replace(CYContext &context);
1185 virtual void Output(CYOutput &out, CYFlags flags) const;
1189 CYIdentifier *identifier_;
1190 CYExpression *initializer_;
1192 CYBinding(CYIdentifier *identifier, CYExpression *initializer = NULL) :
1193 identifier_(identifier),
1194 initializer_(initializer)
1198 CYTarget *Target(CYContext &context);
1200 virtual CYAssignment *Replace(CYContext &context, CYIdentifierKind kind);
1201 virtual void Output(CYOutput &out, CYFlags flags) const;
1204 struct CYForLexical :
1208 CYBinding *binding_;
1210 CYForLexical(bool constant, CYBinding *binding) :
1211 constant_(constant),
1216 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
1218 virtual CYTarget *Replace(CYContext &context);
1219 virtual void Output(CYOutput &out, CYFlags flags) const;
1222 struct CYForVariable :
1225 CYBinding *binding_;
1227 CYForVariable(CYBinding *binding) :
1232 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
1234 virtual CYTarget *Replace(CYContext &context);
1235 virtual void Output(CYOutput &out, CYFlags flags) const;
1242 CYBinding *binding_;
1244 CYBindings(CYBinding *binding, CYBindings *next = NULL) :
1245 CYNext<CYBindings>(next),
1250 CYExpression *Replace(CYContext &context, CYIdentifierKind kind);
1252 CYArgument *Argument(CYContext &context);
1253 CYFunctionParameter *Parameter(CYContext &context);
1255 virtual void Output(CYOutput &out) const;
1256 virtual void Output(CYOutput &out, CYFlags flags) const;
1262 CYBindings *bindings_;
1264 CYVar(CYBindings *bindings) :
1271 virtual CYForInitializer *Replace(CYContext &context);
1272 virtual void Output(CYOutput &out, CYFlags flags) const;
1279 CYBindings *bindings_;
1281 CYLexical(bool constant, CYBindings *bindings) :
1282 constant_(constant),
1289 virtual CYForInitializer *Replace(CYContext &context);
1290 virtual void Output(CYOutput &out, CYFlags flags) const;
1294 CYList<CYBindings> bindings_;
1295 CYList<CYStatement> statements_;
1297 operator bool() const {
1298 return statements_ != NULL;
1306 CYPropertyName *name_;
1308 CYProperty(CYPropertyName *name, CYProperty *next = NULL) :
1309 CYNext<CYProperty>(next),
1314 virtual bool Update() const;
1316 CYProperty *ReplaceAll(CYContext &context, CYBuilder &builder, CYExpression *self, bool update);
1317 void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, bool protect);
1319 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect) = 0;
1321 virtual void Replace(CYContext &context) = 0;
1322 virtual void Output(CYOutput &out) const;
1325 struct CYPropertyValue :
1328 CYExpression *value_;
1330 CYPropertyValue(CYPropertyName *name, CYExpression *value, CYProperty *next = NULL) :
1331 CYProperty(name, next),
1336 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1337 virtual void Replace(CYContext &context);
1338 virtual void Output(CYOutput &out) const;
1344 CYForInitializer *initializer_;
1345 CYExpression *test_;
1346 CYExpression *increment_;
1349 CYFor(CYForInitializer *initializer, CYExpression *test, CYExpression *increment, CYStatement *code) :
1350 initializer_(initializer),
1352 increment_(increment),
1359 virtual CYStatement *Replace(CYContext &context);
1360 virtual void Output(CYOutput &out, CYFlags flags) const;
1366 CYForInInitializer *initializer_;
1367 CYExpression *iterable_;
1370 CYForIn(CYForInInitializer *initializer, CYExpression *iterable, CYStatement *code) :
1371 initializer_(initializer),
1372 iterable_(iterable),
1379 virtual CYStatement *Replace(CYContext &context);
1380 virtual void Output(CYOutput &out, CYFlags flags) const;
1383 struct CYForInitialized :
1386 CYBinding *binding_;
1387 CYExpression *iterable_;
1390 CYForInitialized(CYBinding *binding, CYExpression *iterable, CYStatement *code) :
1392 iterable_(iterable),
1399 virtual CYStatement *Replace(CYContext &context);
1400 virtual void Output(CYOutput &out, CYFlags flags) const;
1406 CYForInInitializer *initializer_;
1407 CYExpression *iterable_;
1410 CYForOf(CYForInInitializer *initializer, CYExpression *iterable, CYStatement *code) :
1411 initializer_(initializer),
1412 iterable_(iterable),
1419 virtual CYStatement *Replace(CYContext &context);
1420 virtual void Output(CYOutput &out, CYFlags flags) const;
1426 CYProperty *properties_;
1428 CYObject(CYProperty *properties = NULL) :
1429 properties_(properties)
1433 CYTarget *Replace(CYContext &context, CYTarget *seed);
1435 virtual CYTarget *Replace(CYContext &context);
1436 void Output(CYOutput &out, CYFlags flags) const;
1442 CYExpression *object_;
1443 CYExpression *property_;
1445 CYMember(CYExpression *object, CYExpression *property) :
1451 void SetLeft(CYExpression *object) {
1456 struct CYDirectMember :
1459 CYDirectMember(CYExpression *object, CYExpression *property) :
1460 CYMember(object, property)
1466 virtual CYTarget *Replace(CYContext &context);
1467 virtual void Output(CYOutput &out, CYFlags flags) const;
1470 struct CYIndirectMember :
1473 CYIndirectMember(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 CYResolveMember :
1487 CYResolveMember(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 CYSubscriptMember :
1501 CYSubscriptMember(CYExpression *object, CYExpression *property) :
1502 CYMember(object, property)
1508 virtual CYTarget *Replace(CYContext &context);
1509 virtual void Output(CYOutput &out, CYFlags flags) const;
1518 CYExpression *constructor_;
1519 CYArgument *arguments_;
1521 New(CYExpression *constructor, CYArgument *arguments = NULL) :
1522 constructor_(constructor),
1523 arguments_(arguments)
1527 virtual int Precedence() const {
1528 return arguments_ == NULL ? 2 : 1;
1531 virtual bool IsNew() const {
1535 virtual CYTarget *Replace(CYContext &context);
1536 virtual void Output(CYOutput &out, CYFlags flags) const;
1538 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1546 CYArgument *arguments_;
1548 CYApply(CYArgument *arguments = NULL) :
1549 arguments_(arguments)
1555 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1561 CYExpression *function_;
1563 CYCall(CYExpression *function, CYArgument *arguments = NULL) :
1569 virtual void Output(CYOutput &out, CYFlags flags) const;
1570 virtual CYTarget *Replace(CYContext &context);
1576 CYEval(CYArgument *arguments) :
1581 virtual void Output(CYOutput &out, CYFlags flags) const;
1582 virtual CYTarget *Replace(CYContext &context);
1592 CYBraced(CYTarget *lhs = NULL) :
1599 void SetLeft(CYTarget *lhs) {
1604 struct CYRubyBlock :
1609 CYRubyBlock(CYTarget *lhs, CYRubyProc *proc) :
1615 virtual CYTarget *Replace(CYContext &context);
1616 virtual void Output(CYOutput &out, CYFlags flags) const;
1618 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1626 CYExtend(CYTarget *lhs, CYProperty *properties = NULL) :
1632 virtual CYTarget *Replace(CYContext &context);
1633 virtual void Output(CYOutput &out, CYFlags flags) const;
1639 CYExpression *test_;
1641 CYStatement *false_;
1643 CYIf(CYExpression *test, CYStatement *_true, CYStatement *_false = NULL) :
1652 virtual CYStatement *Replace(CYContext &context);
1653 virtual void Output(CYOutput &out, CYFlags flags) const;
1655 virtual CYStatement *Return();
1661 CYExpression *test_;
1664 CYDoWhile(CYExpression *test, CYStatement *code) :
1672 virtual CYStatement *Replace(CYContext &context);
1673 virtual void Output(CYOutput &out, CYFlags flags) const;
1679 CYExpression *test_;
1682 CYWhile(CYExpression *test, CYStatement *code) :
1690 virtual CYStatement *Replace(CYContext &context);
1691 virtual void Output(CYOutput &out, CYFlags flags) const;
1695 CYFunctionParameter *parameters_;
1698 CYNonLocal *nonlocal_;
1701 CYIdentifier *super_;
1703 CYFunction(CYFunctionParameter *parameters, CYStatement *code) :
1704 parameters_(parameters),
1712 void Replace(CYContext &context);
1713 void Output(CYOutput &out) const;
1716 struct CYFunctionExpression :
1720 CYIdentifier *name_;
1722 CYFunctionExpression(CYIdentifier *name, CYFunctionParameter *parameters, CYStatement *code) :
1723 CYFunction(parameters, code),
1730 CYTarget *Replace(CYContext &context) override;
1731 virtual void Output(CYOutput &out, CYFlags flags) const;
1738 CYFatArrow(CYFunctionParameter *parameters, CYStatement *code) :
1739 CYFunction(parameters, code)
1745 CYExpression *Replace(CYContext &context) override;
1746 virtual void Output(CYOutput &out, CYFlags flags) const;
1753 CYRubyProc(CYFunctionParameter *parameters, CYStatement *code) :
1754 CYFunction(parameters, code)
1760 CYTarget *Replace(CYContext &context) override;
1761 virtual void Output(CYOutput &out, CYFlags flags) const;
1764 struct CYFunctionStatement :
1768 CYIdentifier *name_;
1770 CYFunctionStatement(CYIdentifier *name, CYFunctionParameter *parameters, CYStatement *code) :
1771 CYFunction(parameters, code),
1778 CYStatement *Replace(CYContext &context) override;
1779 virtual void Output(CYOutput &out, CYFlags flags) const;
1782 struct CYPropertyMethod;
1788 CYMethod(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1789 CYFunction(parameters, code),
1790 CYProperty(name, next)
1794 virtual CYFunctionExpression *Constructor();
1796 using CYProperty::Replace;
1797 virtual void Replace(CYContext &context);
1800 struct CYPropertyGetter :
1803 CYPropertyGetter(CYPropertyName *name, CYStatement *code, CYProperty *next = NULL) :
1804 CYMethod(name, NULL, code, next)
1808 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1809 virtual void Output(CYOutput &out) const;
1812 struct CYPropertySetter :
1815 CYPropertySetter(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1816 CYMethod(name, parameters, code, next)
1820 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1821 virtual void Output(CYOutput &out) const;
1824 struct CYPropertyMethod :
1827 CYPropertyMethod(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1828 CYMethod(name, parameters, code, next)
1832 bool Update() const override;
1834 virtual CYFunctionExpression *Constructor();
1836 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1837 virtual void Output(CYOutput &out) const;
1840 struct CYClassTail :
1843 CYExpression *extends_;
1845 CYFunctionExpression *constructor_;
1846 CYList<CYProperty> instance_;
1847 CYList<CYProperty> static_;
1849 CYClassTail(CYExpression *extends) :
1855 void Output(CYOutput &out) const;
1858 struct CYClassExpression :
1861 CYIdentifier *name_;
1864 CYClassExpression(CYIdentifier *name, CYClassTail *tail) :
1872 CYTarget *Replace(CYContext &context) override;
1873 virtual void Output(CYOutput &out, CYFlags flags) const;
1876 struct CYClassStatement :
1879 CYIdentifier *name_;
1882 CYClassStatement(CYIdentifier *name, CYClassTail *tail) :
1890 CYStatement *Replace(CYContext &context) override;
1891 virtual void Output(CYOutput &out, CYFlags flags) const;
1894 struct CYSuperCall :
1897 CYArgument *arguments_;
1899 CYSuperCall(CYArgument *arguments) :
1900 arguments_(arguments)
1906 CYTarget *Replace(CYContext &context) override;
1907 virtual void Output(CYOutput &out, CYFlags flags) const;
1910 struct CYSuperAccess :
1913 CYExpression *property_;
1915 CYSuperAccess(CYExpression *property) :
1922 CYTarget *Replace(CYContext &context) override;
1923 virtual void Output(CYOutput &out, CYFlags flags) const;
1929 CYExpression *expression_;
1931 CYExpress(CYExpression *expression) :
1932 expression_(expression)
1934 if (expression_ == NULL)
1940 CYForInitializer *Replace(CYContext &context) override;
1941 virtual void Output(CYOutput &out, CYFlags flags) const;
1943 virtual CYStatement *Return();
1949 CYIdentifier *label_;
1951 CYContinue(CYIdentifier *label) :
1958 CYStatement *Replace(CYContext &context) override;
1959 virtual void Output(CYOutput &out, CYFlags flags) const;
1965 CYIdentifier *label_;
1967 CYBreak(CYIdentifier *label) :
1974 CYStatement *Replace(CYContext &context) override;
1975 virtual void Output(CYOutput &out, CYFlags flags) const;
1981 CYExpression *value_;
1983 CYReturn(CYExpression *value) :
1990 CYStatement *Replace(CYContext &context) override;
1991 virtual void Output(CYOutput &out, CYFlags flags) const;
1994 struct CYYieldGenerator :
1997 CYExpression *value_;
1999 CYYieldGenerator(CYExpression *value) :
2006 CYExpression *Replace(CYContext &context) override;
2007 virtual void Output(CYOutput &out, CYFlags flags) const;
2010 struct CYYieldValue :
2013 CYExpression *value_;
2015 CYYieldValue(CYExpression *value) :
2022 virtual CYExpression *Replace(CYContext &context);
2023 virtual void Output(CYOutput &out, CYFlags flags) const;
2031 virtual CYForInitializer *Replace(CYContext &context);
2032 virtual void Output(CYOutput &out, CYFlags flags) const;
2040 CYFinally(CYStatement *code) :
2045 void Replace(CYContext &context);
2046 virtual void Output(CYOutput &out) const;
2049 struct CYTypeSpecifier :
2052 virtual CYTarget *Replace(CYContext &context) = 0;
2055 struct CYTypeError :
2061 virtual CYTarget *Replace(CYContext &context);
2062 virtual void Output(CYOutput &out) const;
2065 enum CYTypeSigning {
2071 struct CYTypeCharacter :
2074 CYTypeSigning signing_;
2076 CYTypeCharacter(CYTypeSigning signing) :
2081 virtual CYTarget *Replace(CYContext &context);
2082 virtual void Output(CYOutput &out) const;
2085 struct CYTypeInt128 :
2088 CYTypeSigning signing_;
2090 CYTypeInt128(CYTypeSigning signing) :
2095 virtual CYTarget *Replace(CYContext &context);
2096 virtual void Output(CYOutput &out) const;
2099 struct CYTypeIntegral :
2102 CYTypeSigning signing_;
2105 CYTypeIntegral(CYTypeSigning signing, int length = 1) :
2111 CYTypeIntegral *Long() {
2112 if (length_ != 1 && length_ != 2)
2118 CYTypeIntegral *Short() {
2125 CYTypeIntegral *Signed() {
2126 if (signing_ != CYTypeNeutral)
2128 signing_ = CYTypeSigned;
2132 CYTypeIntegral *Unsigned() {
2133 if (signing_ != CYTypeNeutral)
2135 signing_ = CYTypeUnsigned;
2139 virtual CYTarget *Replace(CYContext &context);
2140 virtual void Output(CYOutput &out) const;
2149 virtual CYTarget *Replace(CYContext &context);
2150 virtual void Output(CYOutput &out) const;
2153 enum CYTypeReferenceKind {
2154 CYTypeReferenceStruct,
2155 CYTypeReferenceEnum,
2158 struct CYTypeReference :
2161 CYTypeReferenceKind kind_;
2162 CYIdentifier *name_;
2164 CYTypeReference(CYTypeReferenceKind kind, CYIdentifier *name) :
2170 virtual CYTarget *Replace(CYContext &context);
2171 virtual void Output(CYOutput &out) const;
2174 struct CYTypeVariable :
2177 CYIdentifier *name_;
2179 CYTypeVariable(CYIdentifier *name) :
2184 CYTypeVariable(const char *name) :
2185 name_(new($pool) CYIdentifier(name))
2189 virtual CYTarget *Replace(CYContext &context);
2190 virtual void Output(CYOutput &out) const;
2193 struct CYTypeFunctionWith;
2195 struct CYTypeModifier :
2196 CYNext<CYTypeModifier>
2198 CYTypeModifier(CYTypeModifier *next) :
2199 CYNext<CYTypeModifier>(next)
2203 virtual int Precedence() const = 0;
2205 virtual CYTarget *Replace_(CYContext &context, CYTarget *type) = 0;
2206 CYTarget *Replace(CYContext &context, CYTarget *type);
2208 virtual void Output(CYOutput &out, CYPropertyName *name) const = 0;
2209 void Output(CYOutput &out, int precedence, CYPropertyName *name, bool space) const;
2211 virtual CYTypeFunctionWith *Function() { return NULL; }
2214 struct CYTypeArrayOf :
2217 CYExpression *size_;
2219 CYTypeArrayOf(CYExpression *size, CYTypeModifier *next = NULL) :
2220 CYTypeModifier(next),
2227 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2228 void Output(CYOutput &out, CYPropertyName *name) const override;
2231 struct CYTypeConstant :
2234 CYTypeConstant(CYTypeModifier *next = NULL) :
2235 CYTypeModifier(next)
2241 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2242 void Output(CYOutput &out, CYPropertyName *name) const override;
2245 struct CYTypePointerTo :
2248 CYTypePointerTo(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 CYTypeVolatile :
2262 CYTypeVolatile(CYTypeModifier *next = NULL) :
2263 CYTypeModifier(next)
2269 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2270 void Output(CYOutput &out, CYPropertyName *name) const override;
2276 CYTypeSpecifier *specifier_;
2277 CYTypeModifier *modifier_;
2279 CYType(CYTypeSpecifier *specifier = NULL, CYTypeModifier *modifier = NULL) :
2280 specifier_(specifier),
2285 inline CYType *Modify(CYTypeModifier *modifier) {
2286 CYSetLast(modifier_) = modifier;
2290 void Output(CYOutput &out, CYPropertyName *name) const;
2292 virtual CYTarget *Replace(CYContext &context);
2293 virtual void Output(CYOutput &out) const;
2295 CYTypeFunctionWith *Function();
2298 struct CYTypedLocation :
2301 CYLocation location_;
2303 CYTypedLocation(const CYLocation &location) :
2309 struct CYTypedName :
2312 CYPropertyName *name_;
2314 CYTypedName(const CYLocation &location, CYPropertyName *name = NULL) :
2315 CYTypedLocation(location),
2321 struct CYEncodedType :
2326 CYEncodedType(CYType *typed) :
2333 virtual CYTarget *Replace(CYContext &context);
2334 virtual void Output(CYOutput &out, CYFlags flags) const;
2337 struct CYTypedParameter :
2338 CYNext<CYTypedParameter>,
2342 CYIdentifier *name_;
2344 CYTypedParameter(CYType *type, CYIdentifier *name, CYTypedParameter *next = NULL) :
2345 CYNext<CYTypedParameter>(next),
2351 CYArgument *Argument(CYContext &context);
2352 CYFunctionParameter *Parameters(CYContext &context);
2353 CYExpression *TypeSignature(CYContext &context, CYExpression *prefix);
2355 virtual void Output(CYOutput &out) const;
2358 struct CYTypedFormal {
2360 CYTypedParameter *parameters_;
2362 CYTypedFormal(bool variadic) :
2363 variadic_(variadic),
2373 CYTypedParameter *parameters_;
2376 CYLambda(CYType *typed, CYTypedParameter *parameters, CYStatement *code) :
2378 parameters_(parameters),
2385 virtual CYTarget *Replace(CYContext &context);
2386 virtual void Output(CYOutput &out, CYFlags flags) const;
2395 CYModule(CYWord *part, CYModule *next = NULL) :
2396 CYNext<CYModule>(next),
2401 CYString *Replace(CYContext &context, const char *separator) const;
2402 void Output(CYOutput &out) const;
2410 CYImport(CYModule *module) :
2417 virtual CYStatement *Replace(CYContext &context);
2418 virtual void Output(CYOutput &out, CYFlags flags) const;
2421 struct CYImportSpecifier :
2422 CYNext<CYImportSpecifier>
2425 CYIdentifier *binding_;
2427 CYImportSpecifier(CYWord *name, CYIdentifier *binding) :
2433 CYStatement *Replace(CYContext &context, CYIdentifier *module);
2436 struct CYImportDeclaration :
2439 CYImportSpecifier *specifiers_;
2442 CYImportDeclaration(CYImportSpecifier *specifiers, CYString *module) :
2443 specifiers_(specifiers),
2450 virtual CYStatement *Replace(CYContext &context);
2451 virtual void Output(CYOutput &out, CYFlags flags) const;
2454 struct CYExternalExpression :
2459 CYPropertyName *name_;
2461 CYExternalExpression(CYString *abi, CYType *type, CYPropertyName *name) :
2470 virtual CYTarget *Replace(CYContext &context);
2471 virtual void Output(CYOutput &out, CYFlags flags) const;
2474 struct CYExternalDefinition :
2479 CYIdentifier *name_;
2481 CYExternalDefinition(CYString *abi, CYType *type, CYIdentifier *name) :
2490 virtual CYStatement *Replace(CYContext &context);
2491 virtual void Output(CYOutput &out, CYFlags flags) const;
2494 struct CYTypeExpression :
2499 CYTypeExpression(CYType *typed) :
2506 virtual CYTarget *Replace(CYContext &context);
2507 virtual void Output(CYOutput &out, CYFlags flags) const;
2510 struct CYTypeDefinition :
2514 CYIdentifier *name_;
2516 CYTypeDefinition(CYType *type, CYIdentifier *name) :
2524 virtual CYStatement *Replace(CYContext &context);
2525 virtual void Output(CYOutput &out, CYFlags flags) const;
2528 struct CYTypeBlockWith :
2531 CYTypedParameter *parameters_;
2533 CYTypeBlockWith(CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2534 CYTypeModifier(next),
2535 parameters_(parameters)
2541 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2542 void Output(CYOutput &out, CYPropertyName *name) const override;
2545 struct CYTypeFunctionWith :
2549 CYTypedParameter *parameters_;
2551 CYTypeFunctionWith(bool variadic, CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2552 CYTypeModifier(next),
2553 variadic_(variadic),
2554 parameters_(parameters)
2560 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2561 void Output(CYOutput &out, CYPropertyName *name) const override;
2563 virtual CYTypeFunctionWith *Function() { return this; }
2566 struct CYTypeStructField :
2567 CYNext<CYTypeStructField>
2570 CYPropertyName *name_;
2572 CYTypeStructField(CYType *type, CYPropertyName *name, CYTypeStructField *next = NULL) :
2573 CYNext<CYTypeStructField>(next),
2580 struct CYStructTail :
2583 CYTypeStructField *fields_;
2585 CYStructTail(CYTypeStructField *fields) :
2590 CYTarget *Replace(CYContext &context);
2591 virtual void Output(CYOutput &out) const;
2594 struct CYTypeStruct :
2597 CYIdentifier *name_;
2598 CYStructTail *tail_;
2600 CYTypeStruct(CYIdentifier *name, CYStructTail *tail) :
2606 virtual CYTarget *Replace(CYContext &context);
2607 virtual void Output(CYOutput &out) const;
2610 struct CYStructDefinition :
2613 CYIdentifier *name_;
2614 CYStructTail *tail_;
2616 CYStructDefinition(CYIdentifier *name, CYStructTail *tail) :
2624 virtual CYStatement *Replace(CYContext &context);
2625 virtual void Output(CYOutput &out, CYFlags flags) const;
2628 struct CYEnumConstant :
2629 CYNext<CYEnumConstant>
2631 CYIdentifier *name_;
2634 CYEnumConstant(CYIdentifier *name, CYNumber *value, CYEnumConstant *next = NULL) :
2635 CYNext<CYEnumConstant>(next),
2645 CYIdentifier *name_;
2646 CYTypeSpecifier *specifier_;
2647 CYEnumConstant *constants_;
2649 CYTypeEnum(CYIdentifier *name, CYTypeSpecifier *specifier, CYEnumConstant *constants) :
2651 specifier_(specifier),
2652 constants_(constants)
2656 virtual CYTarget *Replace(CYContext &context);
2657 virtual void Output(CYOutput &out) const;
2666 CYIdentifier *name_;
2669 Catch(CYIdentifier *name, CYStatement *code) :
2675 void Replace(CYContext &context);
2676 virtual void Output(CYOutput &out) const;
2684 CYFinally *finally_;
2686 Try(CYStatement *code, Catch *_catch, CYFinally *finally) :
2695 virtual CYStatement *Replace(CYContext &context);
2696 virtual void Output(CYOutput &out, CYFlags flags) const;
2702 CYExpression *value_;
2704 Throw(CYExpression *value = NULL) :
2711 virtual CYStatement *Replace(CYContext &context);
2712 virtual void Output(CYOutput &out, CYFlags flags) const;
2720 CYExpression *scope_;
2723 CYWith(CYExpression *scope, CYStatement *code) :
2731 virtual CYStatement *Replace(CYContext &context);
2732 virtual void Output(CYOutput &out, CYFlags flags) const;
2738 CYExpression *value_;
2741 CYSwitch(CYExpression *value, CYClause *clauses) :
2749 virtual CYStatement *Replace(CYContext &context);
2750 virtual void Output(CYOutput &out, CYFlags flags) const;
2762 virtual CYStatement *Replace(CYContext &context);
2763 virtual void Output(CYOutput &out, CYFlags flags) const;
2766 struct CYCondition :
2769 CYExpression *test_;
2770 CYExpression *true_;
2771 CYExpression *false_;
2773 CYCondition(CYExpression *test, CYExpression *_true, CYExpression *_false) :
2782 virtual CYExpression *Replace(CYContext &context);
2783 virtual void Output(CYOutput &out, CYFlags flags) const;
2786 struct CYAddressOf :
2789 CYAddressOf(CYExpression *rhs) :
2794 virtual const char *Operator() const {
2800 virtual CYExpression *Replace(CYContext &context);
2808 CYIndirect(CYExpression *rhs) :
2813 // XXX: this should be checked
2816 virtual CYTarget *Replace(CYContext &context);
2817 virtual void Output(CYOutput &out, CYFlags flags) const;
2821 virtual CYExpression *Replace(CYContext &context);
2823 #define CYPostfix_(op, name, args...) \
2824 struct CY ## name : \
2827 CY ## name(CYExpression *lhs) : \
2832 virtual const char *Operator() const { \
2837 #define CYPrefix_(alphabetic, op, name, args...) \
2838 struct CY ## name : \
2841 CY ## name(CYExpression *rhs) : \
2846 CYAlphabetic(alphabetic) \
2848 virtual const char *Operator() const { \
2853 #define CYInfix_(alphabetic, precedence, op, name, args...) \
2854 struct CY ## name : \
2857 CY ## name(CYExpression *lhs, CYExpression *rhs) : \
2862 CYAlphabetic(alphabetic) \
2863 CYPrecedence(precedence) \
2865 virtual const char *Operator() const { \
2870 #define CYAssignment_(op, name, args...) \
2871 struct CY ## name ## Assign : \
2874 CY ## name ## Assign(CYTarget *lhs, CYExpression *rhs) : \
2875 CYAssignment(lhs, rhs) \
2879 virtual const char *Operator() const { \
2884 CYPostfix_("++", PostIncrement)
2885 CYPostfix_("--", PostDecrement)
2887 CYPrefix_(true, "delete", Delete)
2888 CYPrefix_(true, "void", Void)
2889 CYPrefix_(true, "typeof", TypeOf)
2890 CYPrefix_(false, "++", PreIncrement)
2891 CYPrefix_(false, "--", PreDecrement)
2892 CYPrefix_(false, "+", Affirm)
2893 CYPrefix_(false, "-", Negate)
2894 CYPrefix_(false, "~", BitwiseNot)
2895 CYPrefix_(false, "!", LogicalNot)
2897 CYInfix_(false, 5, "*", Multiply, CYReplace)
2898 CYInfix_(false, 5, "/", Divide)
2899 CYInfix_(false, 5, "%", Modulus)
2900 CYInfix_(false, 6, "+", Add, CYReplace)
2901 CYInfix_(false, 6, "-", Subtract)
2902 CYInfix_(false, 7, "<<", ShiftLeft)
2903 CYInfix_(false, 7, ">>", ShiftRightSigned)
2904 CYInfix_(false, 7, ">>>", ShiftRightUnsigned)
2905 CYInfix_(false, 8, "<", Less)
2906 CYInfix_(false, 8, ">", Greater)
2907 CYInfix_(false, 8, "<=", LessOrEqual)
2908 CYInfix_(false, 8, ">=", GreaterOrEqual)
2909 CYInfix_(true, 8, "instanceof", InstanceOf)
2910 CYInfix_(true, 8, "in", In)
2911 CYInfix_(false, 9, "==", Equal)
2912 CYInfix_(false, 9, "!=", NotEqual)
2913 CYInfix_(false, 9, "===", Identical)
2914 CYInfix_(false, 9, "!==", NotIdentical)
2915 CYInfix_(false, 10, "&", BitwiseAnd)
2916 CYInfix_(false, 11, "^", BitwiseXOr)
2917 CYInfix_(false, 12, "|", BitwiseOr)
2918 CYInfix_(false, 13, "&&", LogicalAnd)
2919 CYInfix_(false, 14, "||", LogicalOr)
2921 CYAssignment_("=", )
2922 CYAssignment_("*=", Multiply)
2923 CYAssignment_("/=", Divide)
2924 CYAssignment_("%=", Modulus)
2925 CYAssignment_("+=", Add)
2926 CYAssignment_("-=", Subtract)
2927 CYAssignment_("<<=", ShiftLeft)
2928 CYAssignment_(">>=", ShiftRightSigned)
2929 CYAssignment_(">>>=", ShiftRightUnsigned)
2930 CYAssignment_("&=", BitwiseAnd)
2931 CYAssignment_("^=", BitwiseXOr)
2932 CYAssignment_("|=", BitwiseOr)
2934 #endif/*CYCRIPT_PARSER_HPP*/