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) {
124 struct CYPropertyName {
125 virtual bool Computed() const {
129 virtual bool Constructor() const {
133 virtual CYExpression *PropertyName(CYContext &context) = 0;
134 virtual void PropertyName(CYOutput &out) const = 0;
145 CYNoBrace = (1 << 0),
146 CYNoFunction = (1 << 1),
147 CYNoClass = (1 << 2),
150 CYNoRightHand = (1 << 5),
151 CYNoDangle = (1 << 6),
152 CYNoInteger = (1 << 7),
153 CYNoColon = (1 << 8),
154 CYNoBFC = (CYNoBrace | CYNoFunction | CYNoClass),
157 _finline CYFlags operator ~(CYFlags rhs) {
158 return static_cast<CYFlags>(~static_cast<unsigned>(rhs));
161 _finline CYFlags operator &(CYFlags lhs, CYFlags rhs) {
162 return static_cast<CYFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs));
165 _finline CYFlags operator |(CYFlags lhs, CYFlags rhs) {
166 return static_cast<CYFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs));
169 _finline CYFlags &operator |=(CYFlags &lhs, CYFlags rhs) {
170 return lhs = lhs | rhs;
173 _finline CYFlags CYLeft(CYFlags flags) {
174 return flags & ~(CYNoDangle | CYNoInteger);
177 _finline CYFlags CYRight(CYFlags flags) {
178 return flags & ~CYNoBFC;
181 _finline CYFlags CYCenter(CYFlags flags) {
182 return CYLeft(CYRight(flags));
191 #define CYCompact(type) \
192 virtual CYCompactType Compact() const { \
193 return CYCompact ## type; \
200 void Single(CYOutput &out, CYFlags flags, CYCompactType request) const;
201 void Multiple(CYOutput &out, CYFlags flags = CYNoFlags) const;
202 virtual void Output(CYOutput &out) const;
204 virtual CYStatement *Replace(CYContext &context) = 0;
206 virtual CYCompactType Compact() const = 0;
207 virtual CYStatement *Return();
210 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
213 typedef CYList<CYStatement> CYStatements;
215 struct CYForInitializer :
218 virtual CYForInitializer *Replace(CYContext &context) = 0;
219 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
228 CYWord(const char *word) :
233 virtual bool Constructor() const {
234 return strcmp(word_, "constructor") == 0;
237 virtual const char *Word() const;
238 virtual void Output(CYOutput &out) const;
240 virtual CYExpression *PropertyName(CYContext &context);
241 virtual void PropertyName(CYOutput &out) const;
244 _finline std::ostream &operator <<(std::ostream &lhs, const CYWord &rhs) {
246 return lhs << rhs.Word();
249 enum CYIdentifierKind {
250 CYIdentifierArgument,
256 CYIdentifierVariable,
259 struct CYIdentifier :
260 CYNext<CYIdentifier>,
263 CYLocation location_;
267 CYIdentifier(const char *word) :
274 virtual const char *Word() const;
275 CYIdentifier *Replace(CYContext &context, CYIdentifierKind);
282 CYStatement *statement_;
284 CYLabel(CYIdentifier *name, CYStatement *statement) :
286 statement_(statement)
292 virtual CYStatement *Replace(CYContext &context);
293 virtual void Output(CYOutput &out, CYFlags flags) const;
296 struct CYCStringLess :
297 std::binary_function<const char *, const char *, bool>
299 _finline bool operator ()(const char *lhs, const char *rhs) const {
300 return strcmp(lhs, rhs) < 0;
304 struct CYIdentifierValueLess :
305 std::binary_function<CYIdentifier *, CYIdentifier *, bool>
307 _finline bool operator ()(CYIdentifier *lhs, CYIdentifier *rhs) const {
308 return CYCStringLess()(lhs->Word(), rhs->Word());
312 struct CYIdentifierFlags :
313 CYNext<CYIdentifierFlags>
315 CYIdentifier *identifier_;
316 CYIdentifierKind kind_;
320 CYIdentifierFlags(CYIdentifier *identifier, CYIdentifierKind kind, CYIdentifierFlags *next = NULL) :
321 CYNext<CYIdentifierFlags>(next),
322 identifier_(identifier),
334 CYIdentifierFlags *shadow_;
336 CYIdentifierFlags *internal_;
338 CYScope(bool transparent, CYContext &context);
340 CYIdentifierFlags *Lookup(CYContext &context, const char *word);
341 CYIdentifierFlags *Lookup(CYContext &context, CYIdentifier *identifier);
343 CYIdentifierFlags *Declare(CYContext &context, CYIdentifier *identifier, CYIdentifierKind kind);
344 void Merge(CYContext &context, const CYIdentifierFlags *flags);
346 void Close(CYContext &context, CYStatement *&statements);
347 void Close(CYContext &context);
356 CYScript(CYStatement *code) :
361 virtual void Replace(CYContext &context);
362 virtual void Output(CYOutput &out) const;
373 CYIdentifier *super_;
375 CYNonLocal *nonlocal_;
376 CYNonLocal *nextlocal_;
379 std::vector<CYIdentifier *> replace_;
381 CYContext(CYOptions &options) :
392 void ReplaceAll(CYStatement *&statement) {
393 if (statement == NULL)
395 CYStatement *next(statement->next_);
400 if (statement == NULL)
403 statement->SetNext(next);
406 template <typename Type_>
407 void Replace(Type_ *&value) {
408 for (;;) if (value == NULL)
411 Type_ *replace(value->Replace(*this));
412 if (replace != value)
418 void NonLocal(CYStatement *&statements);
419 CYIdentifier *Unique();
423 CYIdentifier *identifier_;
430 CYIdentifier *Target(CYContext &context) {
431 if (identifier_ == NULL)
432 identifier_ = context.Unique();
440 CYIdentifier *identifier_;
447 CYIdentifier *Identifier(CYContext &context) {
449 return next_->Identifier(context);
450 if (identifier_ == NULL)
451 identifier_ = context.Unique();
461 CYBlock(CYStatement *code) :
468 virtual CYStatement *Replace(CYContext &context);
470 virtual void Output(CYOutput &out, CYFlags flags) const;
472 virtual CYStatement *Return();
478 struct CYForInInitializer {
479 virtual CYStatement *Initialize(CYContext &context, CYExpression *value) = 0;
481 virtual CYTarget *Replace(CYContext &context) = 0;
482 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
485 struct CYFunctionParameter;
490 struct CYExpression :
493 virtual int Precedence() const = 0;
495 virtual bool RightHand() const {
499 virtual bool Eval() const {
503 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
505 virtual void Output(CYOutput &out) const;
506 virtual void Output(CYOutput &out, CYFlags flags) const = 0;
507 void Output(CYOutput &out, int precedence, CYFlags flags) const;
509 virtual CYExpression *Replace(CYContext &context) = 0;
511 virtual CYExpression *Primitive(CYContext &context) {
515 virtual CYFunctionParameter *Parameter() const;
517 virtual CYNumber *Number(CYContext &context) {
521 virtual CYString *String(CYContext &context) {
525 virtual const char *Word() const {
534 virtual bool RightHand() const {
538 virtual bool IsNew() const {
542 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
544 virtual CYTarget *Replace(CYContext &context) = 0;
545 using CYExpression::Output;
548 #define CYAlphabetic(value) \
549 virtual bool Alphabetic() const { \
553 #define CYPrecedence(value) \
554 static const int Precedence_ = value; \
555 virtual int Precedence() const { \
556 return Precedence_; \
562 CYExpression *expression_;
565 CYCompound(CYExpression *expression, CYExpression *next) :
566 expression_(expression),
569 _assert(expression_ != NULL);
570 _assert(next != NULL);
575 virtual CYExpression *Replace(CYContext &context);
576 void Output(CYOutput &out, CYFlags flags) const;
578 virtual CYFunctionParameter *Parameter() const;
581 struct CYParenthetical :
584 CYExpression *expression_;
586 CYParenthetical(CYExpression *expression) :
587 expression_(expression)
593 virtual CYTarget *Replace(CYContext &context);
594 void Output(CYOutput &out, CYFlags flags) const;
599 struct CYFunctionParameter :
600 CYNext<CYFunctionParameter>,
605 CYFunctionParameter(CYBinding *binding, CYFunctionParameter *next = NULL) :
606 CYNext<CYFunctionParameter>(next),
611 void Replace(CYContext &context, CYStatement *&statements);
612 void Output(CYOutput &out) const;
615 struct CYComprehension :
616 CYNext<CYComprehension>,
619 CYComprehension(CYComprehension *next = NULL) :
620 CYNext<CYComprehension>(next)
624 virtual CYFunctionParameter *Parameter(CYContext &context) const = 0;
625 CYFunctionParameter *Parameters(CYContext &context) const;
626 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
627 virtual void Output(CYOutput &out) const = 0;
630 struct CYForInComprehension :
634 CYExpression *iterable_;
636 CYForInComprehension(CYBinding *binding, CYExpression *iterable, CYComprehension *next = NULL) :
637 CYComprehension(next),
643 virtual CYFunctionParameter *Parameter(CYContext &context) const;
644 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
645 virtual void Output(CYOutput &out) const;
648 struct CYForOfComprehension :
652 CYExpression *iterable_;
654 CYForOfComprehension(CYBinding *binding, CYExpression *iterable, CYComprehension *next = NULL) :
655 CYComprehension(next),
661 virtual CYFunctionParameter *Parameter(CYContext &context) const;
662 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
663 virtual void Output(CYOutput &out) const;
666 struct CYIfComprehension :
671 CYIfComprehension(CYExpression *test, CYComprehension *next = NULL) :
672 CYComprehension(next),
677 virtual CYFunctionParameter *Parameter(CYContext &context) const;
678 virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const;
679 virtual void Output(CYOutput &out) const;
682 struct CYArrayComprehension :
685 CYExpression *expression_;
686 CYComprehension *comprehensions_;
688 CYArrayComprehension(CYExpression *expression, CYComprehension *comprehensions) :
689 expression_(expression),
690 comprehensions_(comprehensions)
696 virtual CYTarget *Replace(CYContext &context);
697 virtual void Output(CYOutput &out, CYFlags flags) const;
703 CYLocation location_;
707 virtual CYExpression *Primitive(CYContext &context) {
715 virtual CYTarget *Replace(CYContext &context);
728 CYRange(uint64_t lo, uint64_t hi) :
733 bool operator [](uint8_t value) const {
734 return !(value >> 7) && (value >> 6 ? hi_ : lo_) >> (value & 0x3f) & 0x1;
737 void operator()(uint8_t value) {
740 (value >> 6 ? hi_ : lo_) |= uint64_t(0x1) << (value & 0x3f);
744 extern CYRange DigitRange_;
745 extern CYRange WordStartRange_;
746 extern CYRange WordEndRange_;
761 CYString(const char *value) :
767 CYString(const char *value, size_t size) :
773 CYString(const CYWord *word) :
774 value_(word->Word()),
775 size_(strlen(value_))
779 const char *Value() const {
783 virtual const char *Word() const;
785 virtual CYNumber *Number(CYContext &context);
786 virtual CYString *String(CYContext &context);
788 CYString *Concat(CYContext &out, CYString *rhs) const;
789 virtual void Output(CYOutput &out, CYFlags flags) const;
791 virtual CYExpression *PropertyName(CYContext &context);
792 virtual void PropertyName(CYOutput &out) const;
795 struct CYElementValue;
800 CYExpression *expression_;
803 CYSpan(CYExpression *expression, CYString *string, CYSpan *next) :
804 CYNext<CYSpan>(next),
805 expression_(expression),
810 CYElementValue *Replace(CYContext &context);
819 CYTemplate(CYString *string, CYSpan *spans) :
827 virtual CYTarget *Replace(CYContext &context);
828 virtual void Output(CYOutput &out, CYFlags flags) const;
837 CYNumber(double value) :
842 double Value() const {
846 virtual CYNumber *Number(CYContext &context);
847 virtual CYString *String(CYContext &context);
849 virtual void Output(CYOutput &out, CYFlags flags) const;
851 virtual CYExpression *PropertyName(CYContext &context);
852 virtual void PropertyName(CYOutput &out) const;
858 CYExpression *expression_;
860 CYComputed(CYExpression *expression) :
861 expression_(expression)
865 virtual bool Computed() const {
869 virtual CYExpression *PropertyName(CYContext &context);
870 virtual void PropertyName(CYOutput &out) const;
879 CYRegEx(const char *value, size_t size) :
885 const char *Value() const {
889 virtual void Output(CYOutput &out, CYFlags flags) const;
895 virtual CYNumber *Number(CYContext &context);
896 virtual CYString *String(CYContext &context);
898 virtual void Output(CYOutput &out, CYFlags flags) const;
904 virtual CYTarget *Replace(CYContext &context);
905 virtual void Output(CYOutput &out, CYFlags flags) const;
913 virtual bool RightHand() const {
917 virtual bool Value() const = 0;
918 virtual void Output(CYOutput &out, CYFlags flags) const;
924 virtual bool Value() const {
928 virtual CYNumber *Number(CYContext &context);
929 virtual CYString *String(CYContext &context);
935 virtual bool Value() const {
939 virtual CYNumber *Number(CYContext &context);
940 virtual CYString *String(CYContext &context);
948 CYVariable(CYIdentifier *name) :
953 CYVariable(const char *name) :
954 name_(new($pool) CYIdentifier(name))
960 virtual bool Eval() const {
961 return strcmp(name_->Word(), "eval") == 0;
964 virtual CYTarget *Replace(CYContext &context);
965 virtual void Output(CYOutput &out, CYFlags flags) const;
967 virtual CYFunctionParameter *Parameter() const;
975 CYSymbol(const char *name) :
982 virtual CYTarget *Replace(CYContext &context);
983 virtual void Output(CYOutput &out, CYFlags flags) const;
991 CYPrefix(CYExpression *rhs) :
996 virtual bool Alphabetic() const = 0;
997 virtual const char *Operator() const = 0;
1001 virtual CYExpression *Replace(CYContext &context);
1002 virtual void Output(CYOutput &out, CYFlags flags) const;
1011 CYInfix(CYExpression *lhs, CYExpression *rhs) :
1017 void SetLeft(CYExpression *lhs) {
1021 virtual bool Alphabetic() const = 0;
1022 virtual const char *Operator() const = 0;
1024 virtual CYExpression *Replace(CYContext &context);
1025 virtual void Output(CYOutput &out, CYFlags flags) const;
1033 CYPostfix(CYExpression *lhs) :
1038 virtual const char *Operator() const = 0;
1042 virtual CYExpression *Replace(CYContext &context);
1043 virtual void Output(CYOutput &out, CYFlags flags) const;
1046 struct CYAssignment :
1052 CYAssignment(CYTarget *lhs, CYExpression *rhs) :
1058 void SetRight(CYExpression *rhs) {
1062 virtual const char *Operator() const = 0;
1066 virtual CYExpression *Replace(CYContext &context);
1067 virtual void Output(CYOutput &out, CYFlags flags) const;
1075 CYExpression *value_;
1077 CYArgument(CYExpression *value, CYArgument *next = NULL) :
1078 CYNext<CYArgument>(next),
1084 CYArgument(CYWord *name, CYExpression *value, CYArgument *next = NULL) :
1085 CYNext<CYArgument>(next),
1091 CYArgument *Replace(CYContext &context);
1092 void Output(CYOutput &out) const;
1099 CYExpression *value_;
1102 CYClause(CYExpression *value, CYStatement *code) :
1108 void Replace(CYContext &context);
1109 virtual void Output(CYOutput &out) const;
1116 CYElement(CYElement *next) :
1117 CYNext<CYElement>(next)
1121 virtual bool Elision() const = 0;
1123 virtual void Replace(CYContext &context) = 0;
1126 struct CYElementValue :
1129 CYExpression *value_;
1131 CYElementValue(CYExpression *value, CYElement *next = NULL) :
1137 virtual bool Elision() const {
1138 return value_ == NULL;
1141 virtual void Replace(CYContext &context);
1142 virtual void Output(CYOutput &out) const;
1145 struct CYElementSpread :
1148 CYExpression *value_;
1150 CYElementSpread(CYExpression *value, CYElement *next = NULL) :
1156 virtual bool Elision() const {
1160 virtual void Replace(CYContext &context);
1161 virtual void Output(CYOutput &out) const;
1167 CYElement *elements_;
1169 CYArray(CYElement *elements = NULL) :
1174 virtual CYTarget *Replace(CYContext &context);
1175 virtual void Output(CYOutput &out, CYFlags flags) const;
1179 CYIdentifier *identifier_;
1180 CYExpression *initializer_;
1182 CYBinding(CYIdentifier *identifier, CYExpression *initializer = NULL) :
1183 identifier_(identifier),
1184 initializer_(initializer)
1188 CYTarget *Target(CYContext &context);
1190 virtual CYAssignment *Replace(CYContext &context, CYIdentifierKind kind);
1191 virtual void Output(CYOutput &out, CYFlags flags) const;
1194 struct CYForLexical :
1198 CYBinding *binding_;
1200 CYForLexical(bool constant, CYBinding *binding) :
1201 constant_(constant),
1206 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
1208 virtual CYTarget *Replace(CYContext &context);
1209 virtual void Output(CYOutput &out, CYFlags flags) const;
1212 struct CYForVariable :
1215 CYBinding *binding_;
1217 CYForVariable(CYBinding *binding) :
1222 virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
1224 virtual CYTarget *Replace(CYContext &context);
1225 virtual void Output(CYOutput &out, CYFlags flags) const;
1232 CYBinding *binding_;
1234 CYBindings(CYBinding *binding, CYBindings *next = NULL) :
1235 CYNext<CYBindings>(next),
1240 CYExpression *Replace(CYContext &context, CYIdentifierKind kind);
1242 CYArgument *Argument(CYContext &context);
1243 CYFunctionParameter *Parameter(CYContext &context);
1245 virtual void Output(CYOutput &out) const;
1246 virtual void Output(CYOutput &out, CYFlags flags) const;
1252 CYBindings *bindings_;
1254 CYVar(CYBindings *bindings) :
1261 virtual CYForInitializer *Replace(CYContext &context);
1262 virtual void Output(CYOutput &out, CYFlags flags) const;
1269 CYBindings *bindings_;
1271 CYLexical(bool constant, CYBindings *bindings) :
1272 constant_(constant),
1279 virtual CYForInitializer *Replace(CYContext &context);
1280 virtual void Output(CYOutput &out, CYFlags flags) const;
1284 CYList<CYBindings> bindings_;
1285 CYList<CYStatement> statements_;
1287 operator bool() const {
1288 return statements_ != NULL;
1296 CYPropertyName *name_;
1298 CYProperty(CYPropertyName *name, CYProperty *next = NULL) :
1299 CYNext<CYProperty>(next),
1304 virtual bool Update() const;
1306 CYProperty *ReplaceAll(CYContext &context, CYBuilder &builder, CYExpression *self, bool update);
1307 void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, bool protect);
1309 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect) = 0;
1311 virtual void Replace(CYContext &context) = 0;
1312 virtual void Output(CYOutput &out) const;
1315 struct CYPropertyValue :
1318 CYExpression *value_;
1320 CYPropertyValue(CYPropertyName *name, CYExpression *value, CYProperty *next = NULL) :
1321 CYProperty(name, next),
1326 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1327 virtual void Replace(CYContext &context);
1328 virtual void Output(CYOutput &out) const;
1334 CYForInitializer *initializer_;
1335 CYExpression *test_;
1336 CYExpression *increment_;
1339 CYFor(CYForInitializer *initializer, CYExpression *test, CYExpression *increment, CYStatement *code) :
1340 initializer_(initializer),
1342 increment_(increment),
1349 virtual CYStatement *Replace(CYContext &context);
1350 virtual void Output(CYOutput &out, CYFlags flags) const;
1356 CYForInInitializer *initializer_;
1357 CYExpression *iterable_;
1360 CYForIn(CYForInInitializer *initializer, CYExpression *iterable, CYStatement *code) :
1361 initializer_(initializer),
1362 iterable_(iterable),
1369 virtual CYStatement *Replace(CYContext &context);
1370 virtual void Output(CYOutput &out, CYFlags flags) const;
1373 struct CYForInitialized :
1376 CYBinding *binding_;
1377 CYExpression *iterable_;
1380 CYForInitialized(CYBinding *binding, CYExpression *iterable, CYStatement *code) :
1382 iterable_(iterable),
1389 virtual CYStatement *Replace(CYContext &context);
1390 virtual void Output(CYOutput &out, CYFlags flags) const;
1396 CYForInInitializer *initializer_;
1397 CYExpression *iterable_;
1400 CYForOf(CYForInInitializer *initializer, CYExpression *iterable, CYStatement *code) :
1401 initializer_(initializer),
1402 iterable_(iterable),
1409 virtual CYStatement *Replace(CYContext &context);
1410 virtual void Output(CYOutput &out, CYFlags flags) const;
1416 CYProperty *properties_;
1418 CYObject(CYProperty *properties = NULL) :
1419 properties_(properties)
1423 CYTarget *Replace(CYContext &context, CYTarget *seed);
1425 virtual CYTarget *Replace(CYContext &context);
1426 void Output(CYOutput &out, CYFlags flags) const;
1432 CYExpression *object_;
1433 CYExpression *property_;
1435 CYMember(CYExpression *object, CYExpression *property) :
1441 void SetLeft(CYExpression *object) {
1446 struct CYDirectMember :
1449 CYDirectMember(CYExpression *object, CYExpression *property) :
1450 CYMember(object, property)
1456 virtual CYTarget *Replace(CYContext &context);
1457 virtual void Output(CYOutput &out, CYFlags flags) const;
1460 struct CYIndirectMember :
1463 CYIndirectMember(CYExpression *object, CYExpression *property) :
1464 CYMember(object, property)
1470 virtual CYTarget *Replace(CYContext &context);
1471 virtual void Output(CYOutput &out, CYFlags flags) const;
1474 struct CYResolveMember :
1477 CYResolveMember(CYExpression *object, CYExpression *property) :
1478 CYMember(object, property)
1484 virtual CYTarget *Replace(CYContext &context);
1485 virtual void Output(CYOutput &out, CYFlags flags) const;
1488 struct CYSubscriptMember :
1491 CYSubscriptMember(CYExpression *object, CYExpression *property) :
1492 CYMember(object, property)
1498 virtual CYTarget *Replace(CYContext &context);
1499 virtual void Output(CYOutput &out, CYFlags flags) const;
1508 CYExpression *constructor_;
1509 CYArgument *arguments_;
1511 New(CYExpression *constructor, CYArgument *arguments = NULL) :
1512 constructor_(constructor),
1513 arguments_(arguments)
1517 virtual int Precedence() const {
1518 return arguments_ == NULL ? 2 : 1;
1521 virtual bool IsNew() const {
1525 virtual CYTarget *Replace(CYContext &context);
1526 virtual void Output(CYOutput &out, CYFlags flags) const;
1528 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1536 CYArgument *arguments_;
1538 CYApply(CYArgument *arguments = NULL) :
1539 arguments_(arguments)
1545 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1551 CYExpression *function_;
1553 CYCall(CYExpression *function, CYArgument *arguments = NULL) :
1559 virtual void Output(CYOutput &out, CYFlags flags) const;
1560 virtual CYTarget *Replace(CYContext &context);
1566 CYEval(CYArgument *arguments) :
1571 virtual void Output(CYOutput &out, CYFlags flags) const;
1572 virtual CYTarget *Replace(CYContext &context);
1582 CYBraced(CYTarget *lhs = NULL) :
1589 void SetLeft(CYTarget *lhs) {
1594 struct CYRubyBlock :
1599 CYRubyBlock(CYTarget *lhs, CYRubyProc *proc) :
1605 virtual CYTarget *Replace(CYContext &context);
1606 virtual void Output(CYOutput &out, CYFlags flags) const;
1608 virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
1616 CYExtend(CYTarget *lhs, CYProperty *properties = NULL) :
1622 virtual CYTarget *Replace(CYContext &context);
1623 virtual void Output(CYOutput &out, CYFlags flags) const;
1629 CYExpression *test_;
1631 CYStatement *false_;
1633 CYIf(CYExpression *test, CYStatement *_true, CYStatement *_false = NULL) :
1642 virtual CYStatement *Replace(CYContext &context);
1643 virtual void Output(CYOutput &out, CYFlags flags) const;
1645 virtual CYStatement *Return();
1651 CYExpression *test_;
1654 CYDoWhile(CYExpression *test, CYStatement *code) :
1662 virtual CYStatement *Replace(CYContext &context);
1663 virtual void Output(CYOutput &out, CYFlags flags) const;
1669 CYExpression *test_;
1672 CYWhile(CYExpression *test, CYStatement *code) :
1680 virtual CYStatement *Replace(CYContext &context);
1681 virtual void Output(CYOutput &out, CYFlags flags) const;
1685 CYFunctionParameter *parameters_;
1688 CYNonLocal *nonlocal_;
1691 CYIdentifier *super_;
1693 CYFunction(CYFunctionParameter *parameters, CYStatement *code) :
1694 parameters_(parameters),
1702 void Replace(CYContext &context);
1703 void Output(CYOutput &out) const;
1706 struct CYFunctionExpression :
1710 CYIdentifier *name_;
1712 CYFunctionExpression(CYIdentifier *name, CYFunctionParameter *parameters, CYStatement *code) :
1713 CYFunction(parameters, code),
1720 CYTarget *Replace(CYContext &context) override;
1721 virtual void Output(CYOutput &out, CYFlags flags) const;
1728 CYFatArrow(CYFunctionParameter *parameters, CYStatement *code) :
1729 CYFunction(parameters, code)
1735 CYExpression *Replace(CYContext &context) override;
1736 virtual void Output(CYOutput &out, CYFlags flags) const;
1743 CYRubyProc(CYFunctionParameter *parameters, CYStatement *code) :
1744 CYFunction(parameters, code)
1750 CYTarget *Replace(CYContext &context) override;
1751 virtual void Output(CYOutput &out, CYFlags flags) const;
1754 struct CYFunctionStatement :
1758 CYIdentifier *name_;
1760 CYFunctionStatement(CYIdentifier *name, CYFunctionParameter *parameters, CYStatement *code) :
1761 CYFunction(parameters, code),
1768 CYStatement *Replace(CYContext &context) override;
1769 virtual void Output(CYOutput &out, CYFlags flags) const;
1772 struct CYPropertyMethod;
1778 CYMethod(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1779 CYFunction(parameters, code),
1780 CYProperty(name, next)
1784 virtual CYFunctionExpression *Constructor();
1786 using CYProperty::Replace;
1787 virtual void Replace(CYContext &context);
1790 struct CYPropertyGetter :
1793 CYPropertyGetter(CYPropertyName *name, CYStatement *code, CYProperty *next = NULL) :
1794 CYMethod(name, NULL, code, next)
1798 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1799 virtual void Output(CYOutput &out) const;
1802 struct CYPropertySetter :
1805 CYPropertySetter(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1806 CYMethod(name, parameters, code, next)
1810 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1811 virtual void Output(CYOutput &out) const;
1814 struct CYPropertyMethod :
1817 CYPropertyMethod(CYPropertyName *name, CYFunctionParameter *parameters, CYStatement *code, CYProperty *next = NULL) :
1818 CYMethod(name, parameters, code, next)
1822 bool Update() const override;
1824 virtual CYFunctionExpression *Constructor();
1826 virtual void Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect);
1827 virtual void Output(CYOutput &out) const;
1830 struct CYClassTail :
1833 CYExpression *extends_;
1835 CYFunctionExpression *constructor_;
1836 CYList<CYProperty> instance_;
1837 CYList<CYProperty> static_;
1839 CYClassTail(CYExpression *extends) :
1845 void Output(CYOutput &out) const;
1848 struct CYClassExpression :
1851 CYIdentifier *name_;
1854 CYClassExpression(CYIdentifier *name, CYClassTail *tail) :
1862 CYTarget *Replace(CYContext &context) override;
1863 virtual void Output(CYOutput &out, CYFlags flags) const;
1866 struct CYClassStatement :
1869 CYIdentifier *name_;
1872 CYClassStatement(CYIdentifier *name, CYClassTail *tail) :
1880 CYStatement *Replace(CYContext &context) override;
1881 virtual void Output(CYOutput &out, CYFlags flags) const;
1884 struct CYSuperCall :
1887 CYArgument *arguments_;
1889 CYSuperCall(CYArgument *arguments) :
1890 arguments_(arguments)
1896 CYTarget *Replace(CYContext &context) override;
1897 virtual void Output(CYOutput &out, CYFlags flags) const;
1900 struct CYSuperAccess :
1903 CYExpression *property_;
1905 CYSuperAccess(CYExpression *property) :
1912 CYTarget *Replace(CYContext &context) override;
1913 virtual void Output(CYOutput &out, CYFlags flags) const;
1919 CYExpression *expression_;
1921 CYExpress(CYExpression *expression) :
1922 expression_(expression)
1924 if (expression_ == NULL)
1930 CYForInitializer *Replace(CYContext &context) override;
1931 virtual void Output(CYOutput &out, CYFlags flags) const;
1933 virtual CYStatement *Return();
1939 CYIdentifier *label_;
1941 CYContinue(CYIdentifier *label) :
1948 CYStatement *Replace(CYContext &context) override;
1949 virtual void Output(CYOutput &out, CYFlags flags) const;
1955 CYIdentifier *label_;
1957 CYBreak(CYIdentifier *label) :
1964 CYStatement *Replace(CYContext &context) override;
1965 virtual void Output(CYOutput &out, CYFlags flags) const;
1971 CYExpression *value_;
1973 CYReturn(CYExpression *value) :
1980 CYStatement *Replace(CYContext &context) override;
1981 virtual void Output(CYOutput &out, CYFlags flags) const;
1984 struct CYYieldGenerator :
1987 CYExpression *value_;
1989 CYYieldGenerator(CYExpression *value) :
1996 CYExpression *Replace(CYContext &context) override;
1997 virtual void Output(CYOutput &out, CYFlags flags) const;
2000 struct CYYieldValue :
2003 CYExpression *value_;
2005 CYYieldValue(CYExpression *value) :
2012 virtual CYExpression *Replace(CYContext &context);
2013 virtual void Output(CYOutput &out, CYFlags flags) const;
2021 virtual CYForInitializer *Replace(CYContext &context);
2022 virtual void Output(CYOutput &out, CYFlags flags) const;
2030 CYFinally(CYStatement *code) :
2035 void Replace(CYContext &context);
2036 virtual void Output(CYOutput &out) const;
2039 struct CYTypeSpecifier :
2042 virtual CYTarget *Replace(CYContext &context) = 0;
2045 struct CYTypeError :
2051 virtual CYTarget *Replace(CYContext &context);
2052 virtual void Output(CYOutput &out) const;
2055 enum CYTypeSigning {
2061 struct CYTypeCharacter :
2064 CYTypeSigning signing_;
2066 CYTypeCharacter(CYTypeSigning signing) :
2071 virtual CYTarget *Replace(CYContext &context);
2072 virtual void Output(CYOutput &out) const;
2075 struct CYTypeInt128 :
2078 CYTypeSigning signing_;
2080 CYTypeInt128(CYTypeSigning signing) :
2085 virtual CYTarget *Replace(CYContext &context);
2086 virtual void Output(CYOutput &out) const;
2089 struct CYTypeIntegral :
2092 CYTypeSigning signing_;
2095 CYTypeIntegral(CYTypeSigning signing, int length = 1) :
2101 CYTypeIntegral *Long() {
2102 if (length_ != 1 && length_ != 2)
2108 CYTypeIntegral *Short() {
2115 CYTypeIntegral *Signed() {
2116 if (signing_ != CYTypeNeutral)
2118 signing_ = CYTypeSigned;
2122 CYTypeIntegral *Unsigned() {
2123 if (signing_ != CYTypeNeutral)
2125 signing_ = CYTypeUnsigned;
2129 virtual CYTarget *Replace(CYContext &context);
2130 virtual void Output(CYOutput &out) const;
2139 virtual CYTarget *Replace(CYContext &context);
2140 virtual void Output(CYOutput &out) const;
2143 enum CYTypeReferenceKind {
2144 CYTypeReferenceStruct,
2145 CYTypeReferenceEnum,
2148 struct CYTypeReference :
2151 CYTypeReferenceKind kind_;
2152 CYIdentifier *name_;
2154 CYTypeReference(CYTypeReferenceKind kind, CYIdentifier *name) :
2160 virtual CYTarget *Replace(CYContext &context);
2161 virtual void Output(CYOutput &out) const;
2164 struct CYTypeVariable :
2167 CYIdentifier *name_;
2169 CYTypeVariable(CYIdentifier *name) :
2174 CYTypeVariable(const char *name) :
2175 name_(new($pool) CYIdentifier(name))
2179 virtual CYTarget *Replace(CYContext &context);
2180 virtual void Output(CYOutput &out) const;
2183 struct CYTypeFunctionWith;
2185 struct CYTypeModifier :
2186 CYNext<CYTypeModifier>
2188 CYTypeModifier(CYTypeModifier *next) :
2189 CYNext<CYTypeModifier>(next)
2193 virtual int Precedence() const = 0;
2195 virtual CYTarget *Replace_(CYContext &context, CYTarget *type) = 0;
2196 CYTarget *Replace(CYContext &context, CYTarget *type);
2198 virtual void Output(CYOutput &out, CYIdentifier *identifier) const = 0;
2199 void Output(CYOutput &out, int precedence, CYIdentifier *identifier, bool space) const;
2201 virtual CYTypeFunctionWith *Function() { return NULL; }
2204 struct CYTypeArrayOf :
2207 CYExpression *size_;
2209 CYTypeArrayOf(CYExpression *size, CYTypeModifier *next = NULL) :
2210 CYTypeModifier(next),
2217 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2218 virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
2221 struct CYTypeConstant :
2224 CYTypeConstant(CYTypeModifier *next = NULL) :
2225 CYTypeModifier(next)
2231 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2232 virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
2235 struct CYTypePointerTo :
2238 CYTypePointerTo(CYTypeModifier *next = NULL) :
2239 CYTypeModifier(next)
2245 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2246 virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
2249 struct CYTypeVolatile :
2252 CYTypeVolatile(CYTypeModifier *next = NULL) :
2253 CYTypeModifier(next)
2259 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2260 virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
2263 struct CYTypedIdentifier :
2264 CYNext<CYTypedIdentifier>,
2267 CYLocation location_;
2268 CYIdentifier *identifier_;
2269 CYTypeSpecifier *specifier_;
2270 CYTypeModifier *modifier_;
2272 CYTypedIdentifier(const CYLocation &location, CYIdentifier *identifier = NULL) :
2273 location_(location),
2274 identifier_(identifier),
2280 CYTypedIdentifier(CYTypeSpecifier *specifier, CYTypeModifier *modifier = NULL) :
2282 specifier_(specifier),
2287 inline CYTypedIdentifier *Modify(CYTypeModifier *modifier) {
2288 CYSetLast(modifier_) = modifier;
2292 virtual CYTarget *Replace(CYContext &context);
2293 virtual void Output(CYOutput &out) const;
2295 CYTypeFunctionWith *Function();
2298 struct CYEncodedType :
2301 CYTypedIdentifier *typed_;
2303 CYEncodedType(CYTypedIdentifier *typed) :
2310 virtual CYTarget *Replace(CYContext &context);
2311 virtual void Output(CYOutput &out, CYFlags flags) const;
2314 struct CYTypedParameter :
2315 CYNext<CYTypedParameter>,
2318 CYTypedIdentifier *typed_;
2320 CYTypedParameter(CYTypedIdentifier *typed, CYTypedParameter *next = NULL) :
2321 CYNext<CYTypedParameter>(next),
2326 CYArgument *Argument(CYContext &context);
2327 CYFunctionParameter *Parameters(CYContext &context);
2328 CYExpression *TypeSignature(CYContext &context, CYExpression *prefix);
2330 virtual void Output(CYOutput &out) const;
2333 struct CYTypedFormal {
2335 CYTypedParameter *parameters_;
2337 CYTypedFormal(bool variadic) :
2338 variadic_(variadic),
2347 CYTypedIdentifier *typed_;
2348 CYTypedParameter *parameters_;
2351 CYLambda(CYTypedIdentifier *typed, CYTypedParameter *parameters, CYStatement *code) :
2353 parameters_(parameters),
2360 virtual CYTarget *Replace(CYContext &context);
2361 virtual void Output(CYOutput &out, CYFlags flags) const;
2370 CYModule(CYWord *part, CYModule *next = NULL) :
2371 CYNext<CYModule>(next),
2376 CYString *Replace(CYContext &context, const char *separator) const;
2377 void Output(CYOutput &out) const;
2385 CYImport(CYModule *module) :
2392 virtual CYStatement *Replace(CYContext &context);
2393 virtual void Output(CYOutput &out, CYFlags flags) const;
2396 struct CYImportSpecifier :
2397 CYNext<CYImportSpecifier>
2400 CYIdentifier *binding_;
2402 CYImportSpecifier(CYWord *name, CYIdentifier *binding) :
2408 CYStatement *Replace(CYContext &context, CYIdentifier *module);
2411 struct CYImportDeclaration :
2414 CYImportSpecifier *specifiers_;
2417 CYImportDeclaration(CYImportSpecifier *specifiers, CYString *module) :
2418 specifiers_(specifiers),
2425 virtual CYStatement *Replace(CYContext &context);
2426 virtual void Output(CYOutput &out, CYFlags flags) const;
2429 struct CYExternalExpression :
2433 CYTypedIdentifier *typed_;
2435 CYExternalExpression(CYString *abi, CYTypedIdentifier *typed) :
2443 virtual CYTarget *Replace(CYContext &context);
2444 virtual void Output(CYOutput &out, CYFlags flags) const;
2447 struct CYExternalDefinition :
2451 CYTypedIdentifier *typed_;
2453 CYExternalDefinition(CYString *abi, CYTypedIdentifier *typed) :
2461 virtual CYStatement *Replace(CYContext &context);
2462 virtual void Output(CYOutput &out, CYFlags flags) const;
2465 struct CYTypeExpression :
2468 CYTypedIdentifier *typed_;
2470 CYTypeExpression(CYTypedIdentifier *typed) :
2477 virtual CYTarget *Replace(CYContext &context);
2478 virtual void Output(CYOutput &out, CYFlags flags) const;
2481 struct CYTypeDefinition :
2484 CYTypedIdentifier *typed_;
2486 CYTypeDefinition(CYTypedIdentifier *typed) :
2493 virtual CYStatement *Replace(CYContext &context);
2494 virtual void Output(CYOutput &out, CYFlags flags) const;
2497 struct CYTypeBlockWith :
2500 CYTypedParameter *parameters_;
2502 CYTypeBlockWith(CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2503 CYTypeModifier(next),
2504 parameters_(parameters)
2510 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2511 virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
2514 struct CYTypeFunctionWith :
2518 CYTypedParameter *parameters_;
2520 CYTypeFunctionWith(bool variadic, CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2521 CYTypeModifier(next),
2522 variadic_(variadic),
2523 parameters_(parameters)
2529 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2530 virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
2532 virtual CYTypeFunctionWith *Function() { return this; }
2535 struct CYTypeStructField :
2536 CYNext<CYTypeStructField>
2538 CYTypedIdentifier *typed_;
2540 CYTypeStructField(CYTypedIdentifier *typed, CYTypeStructField *next = NULL) :
2541 CYNext<CYTypeStructField>(next),
2547 struct CYStructTail :
2550 CYTypeStructField *fields_;
2552 CYStructTail(CYTypeStructField *fields) :
2557 CYTarget *Replace(CYContext &context);
2558 virtual void Output(CYOutput &out) const;
2561 struct CYTypeStruct :
2564 CYIdentifier *name_;
2565 CYStructTail *tail_;
2567 CYTypeStruct(CYIdentifier *name, CYStructTail *tail) :
2573 virtual CYTarget *Replace(CYContext &context);
2574 virtual void Output(CYOutput &out) const;
2577 struct CYStructDefinition :
2580 CYIdentifier *name_;
2581 CYStructTail *tail_;
2583 CYStructDefinition(CYIdentifier *name, CYStructTail *tail) :
2591 virtual CYStatement *Replace(CYContext &context);
2592 virtual void Output(CYOutput &out, CYFlags flags) const;
2595 struct CYEnumConstant :
2596 CYNext<CYEnumConstant>
2598 CYIdentifier *name_;
2601 CYEnumConstant(CYIdentifier *name, CYNumber *value, CYEnumConstant *next = NULL) :
2602 CYNext<CYEnumConstant>(next),
2612 CYIdentifier *name_;
2613 CYTypeSpecifier *specifier_;
2614 CYEnumConstant *constants_;
2616 CYTypeEnum(CYIdentifier *name, CYTypeSpecifier *specifier, CYEnumConstant *constants) :
2618 specifier_(specifier),
2619 constants_(constants)
2623 virtual CYTarget *Replace(CYContext &context);
2624 virtual void Output(CYOutput &out) const;
2633 CYIdentifier *name_;
2636 Catch(CYIdentifier *name, CYStatement *code) :
2642 void Replace(CYContext &context);
2643 virtual void Output(CYOutput &out) const;
2651 CYFinally *finally_;
2653 Try(CYStatement *code, Catch *_catch, CYFinally *finally) :
2662 virtual CYStatement *Replace(CYContext &context);
2663 virtual void Output(CYOutput &out, CYFlags flags) const;
2669 CYExpression *value_;
2671 Throw(CYExpression *value = NULL) :
2678 virtual CYStatement *Replace(CYContext &context);
2679 virtual void Output(CYOutput &out, CYFlags flags) const;
2687 CYExpression *scope_;
2690 CYWith(CYExpression *scope, CYStatement *code) :
2698 virtual CYStatement *Replace(CYContext &context);
2699 virtual void Output(CYOutput &out, CYFlags flags) const;
2705 CYExpression *value_;
2708 CYSwitch(CYExpression *value, CYClause *clauses) :
2716 virtual CYStatement *Replace(CYContext &context);
2717 virtual void Output(CYOutput &out, CYFlags flags) const;
2729 virtual CYStatement *Replace(CYContext &context);
2730 virtual void Output(CYOutput &out, CYFlags flags) const;
2733 struct CYCondition :
2736 CYExpression *test_;
2737 CYExpression *true_;
2738 CYExpression *false_;
2740 CYCondition(CYExpression *test, CYExpression *_true, CYExpression *_false) :
2749 virtual CYExpression *Replace(CYContext &context);
2750 virtual void Output(CYOutput &out, CYFlags flags) const;
2753 struct CYAddressOf :
2756 CYAddressOf(CYExpression *rhs) :
2761 virtual const char *Operator() const {
2767 virtual CYExpression *Replace(CYContext &context);
2775 CYIndirect(CYExpression *rhs) :
2780 // XXX: this should be checked
2783 virtual CYTarget *Replace(CYContext &context);
2784 virtual void Output(CYOutput &out, CYFlags flags) const;
2788 virtual CYExpression *Replace(CYContext &context);
2790 #define CYPostfix_(op, name, args...) \
2791 struct CY ## name : \
2794 CY ## name(CYExpression *lhs) : \
2799 virtual const char *Operator() const { \
2804 #define CYPrefix_(alphabetic, op, name, args...) \
2805 struct CY ## name : \
2808 CY ## name(CYExpression *rhs) : \
2813 CYAlphabetic(alphabetic) \
2815 virtual const char *Operator() const { \
2820 #define CYInfix_(alphabetic, precedence, op, name, args...) \
2821 struct CY ## name : \
2824 CY ## name(CYExpression *lhs, CYExpression *rhs) : \
2829 CYAlphabetic(alphabetic) \
2830 CYPrecedence(precedence) \
2832 virtual const char *Operator() const { \
2837 #define CYAssignment_(op, name, args...) \
2838 struct CY ## name ## Assign : \
2841 CY ## name ## Assign(CYTarget *lhs, CYExpression *rhs) : \
2842 CYAssignment(lhs, rhs) \
2846 virtual const char *Operator() const { \
2851 CYPostfix_("++", PostIncrement)
2852 CYPostfix_("--", PostDecrement)
2854 CYPrefix_(true, "delete", Delete)
2855 CYPrefix_(true, "void", Void)
2856 CYPrefix_(true, "typeof", TypeOf)
2857 CYPrefix_(false, "++", PreIncrement)
2858 CYPrefix_(false, "--", PreDecrement)
2859 CYPrefix_(false, "+", Affirm)
2860 CYPrefix_(false, "-", Negate)
2861 CYPrefix_(false, "~", BitwiseNot)
2862 CYPrefix_(false, "!", LogicalNot)
2864 CYInfix_(false, 5, "*", Multiply, CYReplace)
2865 CYInfix_(false, 5, "/", Divide)
2866 CYInfix_(false, 5, "%", Modulus)
2867 CYInfix_(false, 6, "+", Add, CYReplace)
2868 CYInfix_(false, 6, "-", Subtract)
2869 CYInfix_(false, 7, "<<", ShiftLeft)
2870 CYInfix_(false, 7, ">>", ShiftRightSigned)
2871 CYInfix_(false, 7, ">>>", ShiftRightUnsigned)
2872 CYInfix_(false, 8, "<", Less)
2873 CYInfix_(false, 8, ">", Greater)
2874 CYInfix_(false, 8, "<=", LessOrEqual)
2875 CYInfix_(false, 8, ">=", GreaterOrEqual)
2876 CYInfix_(true, 8, "instanceof", InstanceOf)
2877 CYInfix_(true, 8, "in", In)
2878 CYInfix_(false, 9, "==", Equal)
2879 CYInfix_(false, 9, "!=", NotEqual)
2880 CYInfix_(false, 9, "===", Identical)
2881 CYInfix_(false, 9, "!==", NotIdentical)
2882 CYInfix_(false, 10, "&", BitwiseAnd)
2883 CYInfix_(false, 11, "^", BitwiseXOr)
2884 CYInfix_(false, 12, "|", BitwiseOr)
2885 CYInfix_(false, 13, "&&", LogicalAnd)
2886 CYInfix_(false, 14, "||", LogicalOr)
2888 CYAssignment_("=", )
2889 CYAssignment_("*=", Multiply)
2890 CYAssignment_("/=", Divide)
2891 CYAssignment_("%=", Modulus)
2892 CYAssignment_("+=", Add)
2893 CYAssignment_("-=", Subtract)
2894 CYAssignment_("<<=", ShiftLeft)
2895 CYAssignment_(">>=", ShiftRightSigned)
2896 CYAssignment_(">>>=", ShiftRightUnsigned)
2897 CYAssignment_("&=", BitwiseAnd)
2898 CYAssignment_("^=", BitwiseXOr)
2899 CYAssignment_("|=", BitwiseOr)
2901 #endif/*CYCRIPT_PARSER_HPP*/