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;
2157 struct CYTypeFloating :
2162 CYTypeFloating(int length) :
2167 virtual CYTarget *Replace(CYContext &context);
2168 virtual void Output(CYOutput &out) const;
2177 virtual CYTarget *Replace(CYContext &context);
2178 virtual void Output(CYOutput &out) const;
2181 enum CYTypeReferenceKind {
2182 CYTypeReferenceStruct,
2183 CYTypeReferenceEnum,
2186 struct CYTypeReference :
2189 CYTypeReferenceKind kind_;
2190 CYIdentifier *name_;
2192 CYTypeReference(CYTypeReferenceKind kind, CYIdentifier *name) :
2198 virtual CYTarget *Replace(CYContext &context);
2199 virtual void Output(CYOutput &out) const;
2202 struct CYTypeVariable :
2205 CYIdentifier *name_;
2207 CYTypeVariable(CYIdentifier *name) :
2212 CYTypeVariable(const char *name) :
2213 name_(new($pool) CYIdentifier(name))
2217 virtual CYTarget *Replace(CYContext &context);
2218 virtual void Output(CYOutput &out) const;
2221 struct CYTypeFunctionWith;
2223 struct CYTypeModifier :
2224 CYNext<CYTypeModifier>
2226 CYTypeModifier(CYTypeModifier *next) :
2227 CYNext<CYTypeModifier>(next)
2231 virtual int Precedence() const = 0;
2233 virtual CYTarget *Replace_(CYContext &context, CYTarget *type) = 0;
2234 CYTarget *Replace(CYContext &context, CYTarget *type);
2236 virtual void Output(CYOutput &out, CYPropertyName *name) const = 0;
2237 void Output(CYOutput &out, int precedence, CYPropertyName *name, bool space) const;
2239 virtual CYTypeFunctionWith *Function() { return NULL; }
2242 struct CYTypeArrayOf :
2245 CYExpression *size_;
2247 CYTypeArrayOf(CYExpression *size, CYTypeModifier *next = NULL) :
2248 CYTypeModifier(next),
2255 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2256 void Output(CYOutput &out, CYPropertyName *name) const override;
2259 struct CYTypeConstant :
2262 CYTypeConstant(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 CYTypePointerTo :
2276 CYTypePointerTo(CYTypeModifier *next = NULL) :
2277 CYTypeModifier(next)
2283 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2284 void Output(CYOutput &out, CYPropertyName *name) const override;
2287 struct CYTypeVolatile :
2290 CYTypeVolatile(CYTypeModifier *next = NULL) :
2291 CYTypeModifier(next)
2297 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2298 void Output(CYOutput &out, CYPropertyName *name) const override;
2304 CYTypeSpecifier *specifier_;
2305 CYTypeModifier *modifier_;
2307 CYType(CYTypeSpecifier *specifier = NULL, CYTypeModifier *modifier = NULL) :
2308 specifier_(specifier),
2313 inline CYType *Modify(CYTypeModifier *modifier) {
2314 CYSetLast(modifier_) = modifier;
2318 void Output(CYOutput &out, CYPropertyName *name) const;
2320 virtual CYTarget *Replace(CYContext &context);
2321 virtual void Output(CYOutput &out) const;
2323 CYTypeFunctionWith *Function();
2326 struct CYTypedLocation :
2329 CYLocation location_;
2331 CYTypedLocation(const CYLocation &location) :
2337 struct CYTypedName :
2340 CYPropertyName *name_;
2342 CYTypedName(const CYLocation &location, CYPropertyName *name = NULL) :
2343 CYTypedLocation(location),
2349 struct CYEncodedType :
2354 CYEncodedType(CYType *typed) :
2361 virtual CYTarget *Replace(CYContext &context);
2362 virtual void Output(CYOutput &out, CYFlags flags) const;
2365 struct CYTypedParameter :
2366 CYNext<CYTypedParameter>,
2370 CYIdentifier *name_;
2372 CYTypedParameter(CYType *type, CYIdentifier *name, CYTypedParameter *next = NULL) :
2373 CYNext<CYTypedParameter>(next),
2379 CYArgument *Argument(CYContext &context);
2380 CYFunctionParameter *Parameters(CYContext &context);
2381 CYExpression *TypeSignature(CYContext &context, CYExpression *prefix);
2383 virtual void Output(CYOutput &out) const;
2386 struct CYTypedFormal {
2388 CYTypedParameter *parameters_;
2390 CYTypedFormal(bool variadic) :
2391 variadic_(variadic),
2401 CYTypedParameter *parameters_;
2404 CYLambda(CYType *typed, CYTypedParameter *parameters, CYStatement *code) :
2406 parameters_(parameters),
2413 virtual CYTarget *Replace(CYContext &context);
2414 virtual void Output(CYOutput &out, CYFlags flags) const;
2423 CYModule(CYWord *part, CYModule *next = NULL) :
2424 CYNext<CYModule>(next),
2429 CYString *Replace(CYContext &context, const char *separator) const;
2430 void Output(CYOutput &out) const;
2438 CYImport(CYModule *module) :
2445 virtual CYStatement *Replace(CYContext &context);
2446 virtual void Output(CYOutput &out, CYFlags flags) const;
2449 struct CYImportSpecifier :
2450 CYNext<CYImportSpecifier>
2453 CYIdentifier *binding_;
2455 CYImportSpecifier(CYWord *name, CYIdentifier *binding) :
2461 CYStatement *Replace(CYContext &context, CYIdentifier *module);
2464 struct CYImportDeclaration :
2467 CYImportSpecifier *specifiers_;
2470 CYImportDeclaration(CYImportSpecifier *specifiers, CYString *module) :
2471 specifiers_(specifiers),
2478 virtual CYStatement *Replace(CYContext &context);
2479 virtual void Output(CYOutput &out, CYFlags flags) const;
2482 struct CYExternalExpression :
2487 CYPropertyName *name_;
2489 CYExternalExpression(CYString *abi, CYType *type, CYPropertyName *name) :
2498 virtual CYTarget *Replace(CYContext &context);
2499 virtual void Output(CYOutput &out, CYFlags flags) const;
2502 struct CYExternalDefinition :
2507 CYIdentifier *name_;
2509 CYExternalDefinition(CYString *abi, CYType *type, CYIdentifier *name) :
2518 virtual CYStatement *Replace(CYContext &context);
2519 virtual void Output(CYOutput &out, CYFlags flags) const;
2522 struct CYTypeExpression :
2527 CYTypeExpression(CYType *typed) :
2534 virtual CYTarget *Replace(CYContext &context);
2535 virtual void Output(CYOutput &out, CYFlags flags) const;
2538 struct CYTypeDefinition :
2542 CYIdentifier *name_;
2544 CYTypeDefinition(CYType *type, CYIdentifier *name) :
2552 virtual CYStatement *Replace(CYContext &context);
2553 virtual void Output(CYOutput &out, CYFlags flags) const;
2556 struct CYTypeBlockWith :
2559 CYTypedParameter *parameters_;
2561 CYTypeBlockWith(CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2562 CYTypeModifier(next),
2563 parameters_(parameters)
2569 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2570 void Output(CYOutput &out, CYPropertyName *name) const override;
2573 struct CYTypeFunctionWith :
2577 CYTypedParameter *parameters_;
2579 CYTypeFunctionWith(bool variadic, CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
2580 CYTypeModifier(next),
2581 variadic_(variadic),
2582 parameters_(parameters)
2588 virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
2589 void Output(CYOutput &out, CYPropertyName *name) const override;
2591 virtual CYTypeFunctionWith *Function() { return this; }
2594 struct CYTypeStructField :
2595 CYNext<CYTypeStructField>
2598 CYPropertyName *name_;
2600 CYTypeStructField(CYType *type, CYPropertyName *name, CYTypeStructField *next = NULL) :
2601 CYNext<CYTypeStructField>(next),
2608 struct CYStructTail :
2611 CYTypeStructField *fields_;
2613 CYStructTail(CYTypeStructField *fields) :
2618 CYTarget *Replace(CYContext &context);
2619 virtual void Output(CYOutput &out) const;
2622 struct CYTypeStruct :
2625 CYIdentifier *name_;
2626 CYStructTail *tail_;
2628 CYTypeStruct(CYIdentifier *name, CYStructTail *tail) :
2634 virtual CYTarget *Replace(CYContext &context);
2635 virtual void Output(CYOutput &out) const;
2638 struct CYStructDefinition :
2641 CYIdentifier *name_;
2642 CYStructTail *tail_;
2644 CYStructDefinition(CYIdentifier *name, CYStructTail *tail) :
2652 virtual CYStatement *Replace(CYContext &context);
2653 virtual void Output(CYOutput &out, CYFlags flags) const;
2656 struct CYEnumConstant :
2657 CYNext<CYEnumConstant>
2659 CYIdentifier *name_;
2662 CYEnumConstant(CYIdentifier *name, CYNumber *value, CYEnumConstant *next = NULL) :
2663 CYNext<CYEnumConstant>(next),
2673 CYIdentifier *name_;
2674 CYTypeSpecifier *specifier_;
2675 CYEnumConstant *constants_;
2677 CYTypeEnum(CYIdentifier *name, CYTypeSpecifier *specifier, CYEnumConstant *constants) :
2679 specifier_(specifier),
2680 constants_(constants)
2684 virtual CYTarget *Replace(CYContext &context);
2685 virtual void Output(CYOutput &out) const;
2694 CYIdentifier *name_;
2697 Catch(CYIdentifier *name, CYStatement *code) :
2703 void Replace(CYContext &context);
2704 virtual void Output(CYOutput &out) const;
2712 CYFinally *finally_;
2714 Try(CYStatement *code, Catch *_catch, CYFinally *finally) :
2723 virtual CYStatement *Replace(CYContext &context);
2724 virtual void Output(CYOutput &out, CYFlags flags) const;
2730 CYExpression *value_;
2732 Throw(CYExpression *value = NULL) :
2739 virtual CYStatement *Replace(CYContext &context);
2740 virtual void Output(CYOutput &out, CYFlags flags) const;
2748 CYExpression *scope_;
2751 CYWith(CYExpression *scope, CYStatement *code) :
2759 virtual CYStatement *Replace(CYContext &context);
2760 virtual void Output(CYOutput &out, CYFlags flags) const;
2766 CYExpression *value_;
2769 CYSwitch(CYExpression *value, CYClause *clauses) :
2777 virtual CYStatement *Replace(CYContext &context);
2778 virtual void Output(CYOutput &out, CYFlags flags) const;
2790 virtual CYStatement *Replace(CYContext &context);
2791 virtual void Output(CYOutput &out, CYFlags flags) const;
2794 struct CYCondition :
2797 CYExpression *test_;
2798 CYExpression *true_;
2799 CYExpression *false_;
2801 CYCondition(CYExpression *test, CYExpression *_true, CYExpression *_false) :
2810 virtual CYExpression *Replace(CYContext &context);
2811 virtual void Output(CYOutput &out, CYFlags flags) const;
2814 struct CYAddressOf :
2817 CYAddressOf(CYExpression *rhs) :
2822 virtual const char *Operator() const {
2828 virtual CYExpression *Replace(CYContext &context);
2836 CYIndirect(CYExpression *rhs) :
2841 // XXX: this should be checked
2844 virtual CYTarget *Replace(CYContext &context);
2845 virtual void Output(CYOutput &out, CYFlags flags) const;
2849 virtual CYExpression *Replace(CYContext &context);
2851 #define CYPostfix_(op, name, args...) \
2852 struct CY ## name : \
2855 CY ## name(CYExpression *lhs) : \
2860 virtual const char *Operator() const { \
2865 #define CYPrefix_(alphabetic, op, name, args...) \
2866 struct CY ## name : \
2869 CY ## name(CYExpression *rhs) : \
2874 CYAlphabetic(alphabetic) \
2876 virtual const char *Operator() const { \
2881 #define CYInfix_(alphabetic, precedence, op, name, args...) \
2882 struct CY ## name : \
2885 CY ## name(CYExpression *lhs, CYExpression *rhs) : \
2890 CYAlphabetic(alphabetic) \
2891 CYPrecedence(precedence) \
2893 virtual const char *Operator() const { \
2898 #define CYAssignment_(op, name, args...) \
2899 struct CY ## name ## Assign : \
2902 CY ## name ## Assign(CYTarget *lhs, CYExpression *rhs) : \
2903 CYAssignment(lhs, rhs) \
2907 virtual const char *Operator() const { \
2912 CYPostfix_("++", PostIncrement)
2913 CYPostfix_("--", PostDecrement)
2915 CYPrefix_(true, "delete", Delete)
2916 CYPrefix_(true, "void", Void)
2917 CYPrefix_(true, "typeof", TypeOf)
2918 CYPrefix_(false, "++", PreIncrement)
2919 CYPrefix_(false, "--", PreDecrement)
2920 CYPrefix_(false, "+", Affirm)
2921 CYPrefix_(false, "-", Negate)
2922 CYPrefix_(false, "~", BitwiseNot)
2923 CYPrefix_(false, "!", LogicalNot)
2925 CYInfix_(false, 5, "*", Multiply, CYReplace)
2926 CYInfix_(false, 5, "/", Divide)
2927 CYInfix_(false, 5, "%", Modulus)
2928 CYInfix_(false, 6, "+", Add, CYReplace)
2929 CYInfix_(false, 6, "-", Subtract)
2930 CYInfix_(false, 7, "<<", ShiftLeft)
2931 CYInfix_(false, 7, ">>", ShiftRightSigned)
2932 CYInfix_(false, 7, ">>>", ShiftRightUnsigned)
2933 CYInfix_(false, 8, "<", Less)
2934 CYInfix_(false, 8, ">", Greater)
2935 CYInfix_(false, 8, "<=", LessOrEqual)
2936 CYInfix_(false, 8, ">=", GreaterOrEqual)
2937 CYInfix_(true, 8, "instanceof", InstanceOf)
2938 CYInfix_(true, 8, "in", In)
2939 CYInfix_(false, 9, "==", Equal)
2940 CYInfix_(false, 9, "!=", NotEqual)
2941 CYInfix_(false, 9, "===", Identical)
2942 CYInfix_(false, 9, "!==", NotIdentical)
2943 CYInfix_(false, 10, "&", BitwiseAnd)
2944 CYInfix_(false, 11, "^", BitwiseXOr)
2945 CYInfix_(false, 12, "|", BitwiseOr)
2946 CYInfix_(false, 13, "&&", LogicalAnd)
2947 CYInfix_(false, 14, "||", LogicalOr)
2949 CYAssignment_("=", )
2950 CYAssignment_("*=", Multiply)
2951 CYAssignment_("/=", Divide)
2952 CYAssignment_("%=", Modulus)
2953 CYAssignment_("+=", Add)
2954 CYAssignment_("-=", Subtract)
2955 CYAssignment_("<<=", ShiftLeft)
2956 CYAssignment_(">>=", ShiftRightSigned)
2957 CYAssignment_(">>>=", ShiftRightUnsigned)
2958 CYAssignment_("&=", BitwiseAnd)
2959 CYAssignment_("^=", BitwiseXOr)
2960 CYAssignment_("|=", BitwiseOr)
2962 #endif/*CYCRIPT_PARSER_HPP*/