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/>.
23 #define YYSTACKEXPANDABLE 1
31 #define CYNew new(driver.pool_)
34 #include "ObjectiveC/Syntax.hpp"
38 #include "E4X/Syntax.hpp"
41 #include "Highlight.hpp"
44 %union { bool bool_; }
46 %union { CYMember *access_; }
47 %union { CYArgument *argument_; }
48 %union { CYAssignment *assignment_; }
49 %union { CYBinding *binding_; }
50 %union { CYBindings *bindings_; }
51 %union { CYBoolean *boolean_; }
52 %union { CYBraced *braced_; }
53 %union { CYClause *clause_; }
54 %union { cy::Syntax::Catch *catch_; }
55 %union { CYClassTail *classTail_; }
56 %union { CYComprehension *comprehension_; }
57 %union { CYElement *element_; }
58 %union { CYEnumConstant *constant_; }
59 %union { CYExpression *expression_; }
60 %union { CYFalse *false_; }
61 %union { CYVariable *variable_; }
62 %union { CYFinally *finally_; }
63 %union { CYForInitializer *for_; }
64 %union { CYForInInitializer *forin_; }
65 %union { CYFunctionParameter *functionParameter_; }
66 %union { CYIdentifier *identifier_; }
67 %union { CYImportSpecifier *import_; }
68 %union { CYInfix *infix_; }
69 %union { CYLiteral *literal_; }
70 %union { CYMethod *method_; }
71 %union { CYModule *module_; }
72 %union { CYNull *null_; }
73 %union { CYNumber *number_; }
74 %union { CYParenthetical *parenthetical_; }
75 %union { CYProperty *property_; }
76 %union { CYPropertyName *propertyName_; }
77 %union { CYTypeSigning signing_; }
78 %union { CYSpan *span_; }
79 %union { CYStatement *statement_; }
80 %union { CYString *string_; }
81 %union { CYTarget *target_; }
82 %union { CYThis *this_; }
83 %union { CYTrue *true_; }
84 %union { CYWord *word_; }
87 %union { CYTypeIntegral *integral_; }
88 %union { CYTypeStructField *structField_; }
89 %union { CYTypeModifier *modifier_; }
90 %union { CYTypeSpecifier *specifier_; }
91 %union { CYTypedFormal *typedFormal_; }
92 %union { CYTypedLocation *typedLocation_; }
93 %union { CYTypedName *typedName_; }
94 %union { CYTypedParameter *typedParameter_; }
95 %union { CYType *typedThing_; }
99 %union { CYObjCKeyValue *keyValue_; }
100 %union { CYImplementationField *implementationField_; }
101 %union { CYMessage *message_; }
102 %union { CYMessageParameter *messageParameter_; }
103 %union { CYProtocol *protocol_; }
104 %union { CYSelectorPart *selector_; }
108 %union { CYAttribute *attribute_; }
109 %union { CYPropertyIdentifier *propertyIdentifier_; }
110 %union { CYSelector *selector_; }
116 cy::parser::semantic_type semantic_;
117 hi::Value highlight_;
120 int cylex(YYSTYPE *, CYLocation *, void *);
128 typedef cy::parser::token tk;
130 _finline int cylex_(cy::parser::semantic_type *semantic, CYLocation *location, CYDriver &driver) {
131 driver.newline_ = false;
134 int token(cylex(&data, location, driver.scanner_));
135 *semantic = data.semantic_;
139 case tk::OpenBracket:
141 driver.in_.push(false);
145 if (driver.in_.top())
150 case tk::CloseBracket:
157 if (driver.yield_.top())
158 token = tk::_yield__;
162 driver.newline_ = true;
170 #define yylex_(semantic, location, driver) ({ \
172 if (driver.hold_ == cy::parser::empty_symbol) \
173 type = yytranslate_(cylex_(semantic, location, driver)); \
175 type = driver.hold_; \
176 driver.hold_ = cy::parser::empty_symbol; \
180 #define CYLEX() do if (yyla.empty()) { \
181 YYCDEBUG << "Mapping a token: "; \
182 yyla.type = yylex_(&yyla.value, &yyla.location, driver); \
183 YY_SYMBOL_PRINT("Next token is", yyla); \
186 #define CYMAP(to, from) do { \
188 if (yyla.type == yytranslate_(token::from)) \
189 yyla.type = yytranslate_(token::to); \
192 #define CYHLD(location, token) do { \
193 if (driver.hold_ != empty_symbol) \
194 CYERR(location, "unexpected hold"); \
195 driver.hold_ = yyla.type; \
196 yyla.type = yytranslate_(token); \
199 #define CYERR(location, message) do { \
200 error(location, message); \
204 #define CYEOK() do { \
206 driver.errors_.pop_back(); \
209 #define CYNOT(location) \
210 CYERR(location, "unimplemented feature")
212 #define CYMPT(location) do { \
213 if (!yyla.empty() && yyla.type_get() != yyeof_) \
214 CYERR(location, "unexpected lookahead"); \
224 @$.begin.filename = @$.end.filename = &driver.filename_;
226 switch (driver.mark_) {
228 driver.hold_ = yytranslate_(token::MarkScript);
231 driver.hold_ = yytranslate_(token::MarkModule);
233 case CYMarkExpression:
234 driver.hold_ = yytranslate_(token::MarkExpression);
242 %define api.location.type { CYLocation }
249 %param { CYDriver &driver }
251 /* Token Declarations {{{ */
257 %token XMLAttributeValue
259 %token XMLTagCharacters
265 %token LeftRight "<>"
266 %token LeftSlashRight "</>"
268 %token SlashRight "/>"
269 %token LeftSlash "</"
271 %token PeriodPeriod ".."
274 @begin E4X ObjectiveC
279 %token AmpersandAmpersand "&&"
280 %token AmpersandEqual "&="
282 %token CarrotEqual "^="
284 %token EqualEqual "=="
285 %token EqualEqualEqual "==="
286 %token EqualRight "=>"
287 %token Exclamation "!"
288 %token ExclamationEqual "!="
289 %token ExclamationEqualEqual "!=="
291 %token HyphenEqual "-="
292 %token HyphenHyphen "--"
293 %token HyphenRight "->"
295 %token LeftEqual "<="
297 %token LeftLeftEqual "<<="
299 %token PercentEqual "%="
301 %token PeriodPeriodPeriod "..."
303 %token PipeEqual "|="
306 %token PlusEqual "+="
309 %token RightEqual ">="
310 %token RightRight ">>"
311 %token RightRightEqual ">>="
312 %token RightRightRight ">>>"
313 %token RightRightRightEqual ">>>="
315 %token SlashEqual "/="
317 %token StarEqual "*="
321 %token ColonColon "::"
332 %token CloseParen ")"
335 %token OpenBrace_ ";{"
336 %token OpenBrace_let "let {"
337 %token CloseBrace "}"
339 %token OpenBracket "["
340 %token OpenBracket_let "let ["
341 %token CloseBracket "]"
343 %token At_error_ "@error"
346 %token At_class_ "@class"
350 %token _typedef_ "typedef"
351 %token _unsigned_ "unsigned"
352 %token _signed_ "signed"
353 %token _struct_ "struct"
354 %token _extern_ "extern"
358 %token At_encode_ "@encode"
362 %token At_implementation_ "@implementation"
363 %token At_import_ "@import"
364 %token At_end_ "@end"
365 %token At_selector_ "@selector"
366 %token At_null_ "@null"
367 %token At_YES_ "@YES"
369 %token At_true_ "@true"
370 %token At_false_ "@false"
375 %token _false_ "false"
380 %token _break_ "break"
382 %token _catch_ "catch"
383 %token _class_ "class"
384 %token _class__ ";class"
385 %token _const_ "const"
386 %token _continue_ "continue"
387 %token _debugger_ "debugger"
388 %token _default_ "default"
389 %token _delete_ "delete"
393 %token _export_ "export"
394 %token _extends_ "extends"
395 %token _finally_ "finally"
397 %token _function_ "function"
398 %token _function__ ";function"
400 %token _import_ "import"
403 %token _Infinity_ "Infinity"
404 %token _instanceof_ "instanceof"
406 %token _return_ "return"
407 %token _super_ "super"
408 %token _switch_ "switch"
409 %token _target_ "target"
411 %token _throw_ "throw"
413 %token _typeof_ "typeof"
416 %token _while_ "while"
419 %token _abstract_ "abstract"
420 %token _await_ "await"
421 %token _boolean_ "boolean"
424 %token _constructor_ "constructor"
425 %token _double_ "double"
427 %token _final_ "final"
428 %token _float_ "float"
432 %token _implements_ "implements"
434 %token ___int128_ "__int128"
435 %token _interface_ "interface"
439 %token _native_ "native"
440 %token _package_ "package"
441 %token _private_ "private"
442 %token _protected_ "protected"
443 %token ___proto___ "__proto__"
444 %token _prototype_ "prototype"
445 %token _public_ "public"
446 %token ___restrict_ "__restrict"
447 %token _restrict_ "restrict"
449 %token _short_ "short"
450 %token _static_ "static"
451 %token _synchronized_ "synchronized"
452 %token _throws_ "throws"
453 %token _transient_ "transient"
454 %token _typeid_ "typeid"
455 %token _volatile_ "volatile"
456 %token _yield_ "yield"
457 %token _yield__ "!yield"
459 %token _undefined_ "undefined"
475 %token _namespace_ "namespace"
480 %token YieldStar "yield *"
482 %token <identifier_> Identifier_
483 %token <number_> NumericLiteral
484 %token <string_> StringLiteral
485 %token <literal_> RegularExpressionLiteral_
487 %token <string_> NoSubstitutionTemplate
488 %token <string_> TemplateHead
489 %token <string_> TemplateMiddle
490 %token <string_> TemplateTail
492 %type <target_> AccessExpression
493 %type <expression_> AdditiveExpression
494 %type <argument_> ArgumentList_
495 %type <argument_> ArgumentList
496 %type <argument_> ArgumentListOpt
497 %type <argument_> Arguments
498 %type <target_> ArrayComprehension
499 %type <element_> ArrayElement
500 %type <literal_> ArrayLiteral
501 %type <expression_> ArrowFunction
502 %type <functionParameter_> ArrowParameters
503 %type <expression_> AssignmentExpression
504 %type <identifier_> BindingIdentifier
505 %type <identifier_> BindingIdentifierOpt
506 %type <bindings_> BindingList_
507 %type <bindings_> BindingList
508 %type <expression_> BitwiseANDExpression
509 %type <statement_> Block
510 %type <statement_> BlockStatement
511 %type <boolean_> BooleanLiteral
512 %type <binding_> BindingElement
513 %type <expression_> BitwiseORExpression
514 %type <expression_> BitwiseXORExpression
515 %type <target_> BracedExpression_
516 %type <target_> BracedExpression
517 %type <statement_> BreakStatement
518 %type <statement_> BreakableStatement
519 %type <expression_> CallExpression_
520 %type <target_> CallExpression
521 %type <clause_> CaseBlock
522 %type <clause_> CaseClause
523 %type <clause_> CaseClausesOpt
525 %type <identifier_> CatchParameter
526 %type <statement_> ClassDeclaration
527 %type <target_> ClassExpression
528 %type <classTail_> ClassHeritage
529 %type <classTail_> ClassHeritageOpt
530 %type <classTail_> ClassTail
531 %type <target_> Comprehension
532 %type <comprehension_> ComprehensionFor
533 %type <comprehension_> ComprehensionIf
534 %type <comprehension_> ComprehensionTail
535 %type <propertyName_> ComputedPropertyName
536 %type <expression_> ConditionalExpression
537 %type <statement_> ContinueStatement
538 %type <statement_> ConciseBody
539 %type <parenthetical_> CoverParenthesizedExpressionAndArrowParameterList
540 %type <statement_> DebuggerStatement
541 %type <statement_> Declaration_
542 %type <statement_> Declaration
543 %type <clause_> DefaultClause
544 %type <element_> ElementList_
545 %type <element_> ElementList
546 %type <element_> ElementListOpt
547 %type <statement_> ElseStatementOpt
548 %type <for_> EmptyStatement
549 %type <expression_> EqualityExpression
550 %type <expression_> Expression
551 %type <expression_> ExpressionOpt
552 %type <for_> ExpressionStatement_
553 %type <statement_> ExpressionStatement
554 %type <statement_> ExternC
555 %type <statement_> ExternCStatement
556 %type <statement_> ExternCStatementListOpt
557 %type <finally_> Finally
558 %type <binding_> ForBinding
559 %type <forin_> ForDeclaration
560 %type <forin_> ForInStatementInitializer
561 %type <for_> ForStatementInitializer
562 %type <binding_> FormalParameter
563 %type <functionParameter_> FormalParameterList_
564 %type <functionParameter_> FormalParameterList
565 %type <functionParameter_> FormalParameters
566 %type <string_> FromClause
567 %type <statement_> FunctionBody
568 %type <statement_> FunctionDeclaration
569 %type <target_> FunctionExpression
570 %type <statement_> FunctionStatementList
571 %type <statement_> GeneratorBody
572 %type <statement_> GeneratorDeclaration
573 %type <target_> GeneratorExpression
574 %type <method_> GeneratorMethod
575 %type <statement_> HoistableDeclaration
576 %type <identifier_> Identifier
577 %type <identifier_> IdentifierNoOf
578 %type <identifier_> IdentifierType
579 %type <identifier_> IdentifierTypeNoOf
580 %type <identifier_> IdentifierTypeOpt
581 %type <word_> IdentifierName
582 %type <variable_> IdentifierReference
583 %type <statement_> IfStatement
584 %type <import_> ImportClause
585 %type <statement_> ImportDeclaration
586 %type <import_> ImportSpecifier
587 %type <identifier_> ImportedBinding
588 %type <import_> ImportedDefaultBinding
589 %type <import_> ImportsList_
590 %type <import_> ImportsList
591 %type <import_> ImportsListOpt
592 %type <target_> IndirectExpression
593 %type <expression_> Initializer
594 %type <expression_> InitializerOpt
595 %type <statement_> IterationStatement
596 %type <identifier_> LabelIdentifier
597 %type <statement_> LabelledItem
598 %type <statement_> LabelledStatement
599 %type <assignment_> LeftHandSideAssignment
600 %type <target_> LeftHandSideExpression
601 %type <bool_> LetOrConst
602 %type <binding_> LexicalBinding
603 %type <for_> LexicalDeclaration_
604 %type <statement_> LexicalDeclaration
605 %type <literal_> Literal
606 %type <propertyName_> LiteralPropertyName
607 %type <expression_> LogicalANDExpression
608 %type <expression_> LogicalORExpression
609 %type <access_> MemberAccess
610 %type <target_> MemberExpression
611 %type <method_> MethodDefinition
612 %type <statement_> ModuleBody
613 %type <statement_> ModuleBodyOpt
614 %type <statement_> ModuleItem
615 %type <statement_> ModuleItemList
616 %type <statement_> ModuleItemListOpt
617 %type <module_> ModulePath
618 %type <string_> ModuleSpecifier
619 %type <expression_> MultiplicativeExpression
620 %type <import_> NameSpaceImport
621 %type <import_> NamedImports
622 %type <target_> NewExpression
623 %type <null_> NullLiteral
624 %type <literal_> ObjectLiteral
625 %type <expression_> PostfixExpression
626 %type <target_> PrimaryExpression
627 %type <propertyName_> PropertyName
628 %type <property_> PropertyDefinition
629 %type <property_> PropertyDefinitionList_
630 %type <property_> PropertyDefinitionList
631 %type <property_> PropertyDefinitionListOpt
632 %type <functionParameter_> PropertySetParameterList
633 %type <literal_> RegularExpressionLiteral
634 %type <bool_> RegularExpressionSlash
635 %type <expression_> RelationalExpression
636 %type <statement_> ReturnStatement
637 %type <braced_> BracedParameter
638 %type <functionParameter_> RubyProcParameterList_
639 %type <functionParameter_> RubyProcParameterList
640 %type <functionParameter_> RubyProcParameters
641 %type <functionParameter_> RubyProcParametersOpt
642 %type <statement_> Script
643 %type <statement_> ScriptBody
644 %type <statement_> ScriptBodyOpt
645 %type <expression_> ShiftExpression
646 %type <binding_> SingleNameBinding
647 %type <statement_> Statement__
648 %type <statement_> Statement_
649 %type <statement_> Statement
650 %type <statement_> StatementList
651 %type <statement_> StatementListOpt
652 %type <statement_> StatementListItem
653 %type <functionParameter_> StrictFormalParameters
654 %type <target_> SuperCall
655 %type <target_> SuperProperty
656 %type <statement_> SwitchStatement
657 %type <target_> TemplateLiteral
658 %type <span_> TemplateSpans
659 %type <statement_> ThrowStatement
660 %type <statement_> TryStatement
661 %type <statement_> TypeDefinition
662 %type <expression_> UnaryExpression_
663 %type <expression_> UnaryExpression
664 %type <binding_> VariableDeclaration
665 %type <bindings_> VariableDeclarationList_
666 %type <bindings_> VariableDeclarationList
667 %type <for_> VariableStatement_
668 %type <statement_> VariableStatement
669 %type <statement_> WithStatement
671 %type <word_> WordNoUnary
673 %type <word_> WordOpt
675 %type <expression_> YieldExpression
678 %type <constant_> EnumConstantListOpt_
679 %type <constant_> EnumConstantListOpt
680 %type <number_> IntegerNumber
681 %type <integral_> IntegerType
682 %type <integral_> IntegerTypeOpt
683 %type <typedName_> PrefixedType
684 %type <specifier_> PrimitiveReference
685 %type <specifier_> PrimitiveType
686 %type <structField_> StructFieldListOpt
687 %type <typedName_> SuffixedType
688 %type <typedName_> SuffixedTypeOpt
689 %type <typedName_> TypeSignifier
690 %type <typedName_> TypeSignifierNone
691 %type <typedName_> TypeSignifierOpt
692 %type <signing_> TypeSigning
693 %type <modifier_> ParameterTail
694 %type <modifier_> TypeQualifierLeft
695 %type <modifier_> TypeQualifierLeftOpt
696 %type <typedName_> TypeQualifierRight
697 %type <typedName_> TypeQualifierRightOpt
698 %type <typedName_> TypedIdentifierDefinition
699 %type <typedThing_> TypedIdentifierEncoding
700 %type <typedName_> TypedIdentifierField
701 %type <typedName_> TypedIdentifierMaybe
702 %type <typedLocation_> TypedIdentifierNo
703 %type <typedName_> TypedIdentifierTagged
704 %type <typedName_> TypedIdentifierYes
705 %type <typedFormal_> TypedParameterList_
706 %type <typedFormal_> TypedParameterList
707 %type <typedFormal_> TypedParameterListOpt
708 %type <typedParameter_> TypedParameters
712 %type <expression_> AssignmentExpressionClassic
713 %type <expression_> BoxableExpression
714 %type <statement_> CategoryStatement
715 %type <expression_> ClassSuperOpt
716 %type <expression_> ConditionalExpressionClassic
717 %type <message_> ClassMessageDeclaration
718 %type <message_> ClassMessageDeclarationListOpt
719 %type <protocol_> ClassProtocolListOpt
720 %type <protocol_> ClassProtocols
721 %type <protocol_> ClassProtocolsOpt
722 %type <implementationField_> ImplementationFieldListOpt
723 %type <statement_> ImplementationStatement
724 %type <keyValue_> KeyValuePairList_
725 %type <keyValue_> KeyValuePairList
726 %type <keyValue_> KeyValuePairListOpt
727 %type <target_> MessageExpression
728 %type <messageParameter_> MessageParameter
729 %type <messageParameter_> MessageParameters
730 %type <messageParameter_> MessageParameterList
731 %type <messageParameter_> MessageParameterListOpt
732 %type <bool_> MessageScope
733 %type <argument_> SelectorCall_
734 %type <argument_> SelectorCall
735 %type <selector_> SelectorExpression_
736 %type <selector_> SelectorExpression
737 %type <selector_> SelectorExpressionOpt
738 %type <argument_> SelectorList
739 %type <word_> SelectorWordOpt
740 %type <typedThing_> TypeOpt
741 %type <argument_> VariadicCall
745 %type <propertyIdentifier_> PropertyIdentifier_
746 %type <selector_> PropertySelector_
747 %type <selector_> PropertySelector
748 %type <identifier_> QualifiedIdentifier_
749 %type <identifier_> QualifiedIdentifier
750 %type <identifier_> WildcardIdentifier
751 %type <identifier_> XMLComment
752 %type <identifier_> XMLCDATA
753 %type <identifier_> XMLElement
754 %type <identifier_> XMLElementContent
755 %type <identifier_> XMLMarkup
756 %type <identifier_> XMLPI
758 %type <attribute_> AttributeIdentifier
759 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
760 %type <expression_> PropertyIdentifier
761 %type <expression_> XMLListInitilizer
762 %type <expression_> XMLInitilizer
765 /* Token Priorities {{{ */
776 %token MarkExpression
783 | MarkExpression Expression[expression] { driver.context_ = $expression; }
786 /* Lexer State {{{ */
787 LexPushInOn: { driver.in_.push(true); };
788 LexPushInOff: { driver.in_.push(false); };
789 LexPopIn: { driver.in_.pop(); };
791 LexPushReturnOn: { driver.return_.push(true); };
792 LexPopReturn: { driver.return_.pop(); };
793 Return: "return"[return] { if (!driver.return_.top()) CYERR(@return, "invalid return"); };
795 LexPushSuperOn: { driver.super_.push(true); };
796 LexPushSuperOff: { driver.super_.push(false); };
797 LexPopSuper: { driver.super_.pop(); };
798 Super: "super"[super] { if (!driver.super_.top()) CYERR(@super, "invalid super"); };
800 LexPushYieldOn: { driver.yield_.push(true); };
801 LexPushYieldOff: { driver.yield_.push(false); };
802 LexPopYield: { driver.yield_.pop(); };
805 : { CYLEX(); if (driver.newline_) { CYHLD(@$, tk::NewLine); } }
809 : { CYLEX(); CYHLD(@$, driver.newline_ ? tk::NewLine : tk::__); }
813 : { CYMAP(YieldStar, Star); }
817 : { CYMAP(OpenBrace_, OpenBrace); }
821 : { CYMAP(_class__, _class_); }
825 : { CYMAP(_function__, _function_); }
829 : LexNoBrace LexNoClass LexNoFunction
832 /* Virtual Tokens {{{ */
838 /* 11.6 Names and Keywords {{{ */
840 : Word[pass] { $$ = $pass; }
841 | "for" { $$ = CYNew CYWord("for"); }
842 | "in" { $$ = CYNew CYWord("in"); }
843 | "instanceof" { $$ = CYNew CYWord("instanceof"); }
847 : IdentifierNoOf[pass] { $$ = $pass; }
848 | "break" { $$ = CYNew CYWord("break"); }
849 | "case" { $$ = CYNew CYWord("case"); }
850 | "catch" { $$ = CYNew CYWord("catch"); }
851 | "class" LexOf { $$ = CYNew CYWord("class"); }
852 | ";class" { $$ = CYNew CYWord("class"); }
853 | "const" { $$ = CYNew CYWord("const"); }
854 | "continue" { $$ = CYNew CYWord("continue"); }
855 | "debugger" { $$ = CYNew CYWord("debugger"); }
856 | "default" { $$ = CYNew CYWord("default"); }
857 | "do" { $$ = CYNew CYWord("do"); }
858 | "else" { $$ = CYNew CYWord("else"); }
859 | "enum" { $$ = CYNew CYWord("enum"); }
860 | "export" { $$ = CYNew CYWord("export"); }
861 | "extends" { $$ = CYNew CYWord("extends"); }
862 | "false" { $$ = CYNew CYWord("false"); }
863 | "finally" { $$ = CYNew CYWord("finally"); }
864 | "function" LexOf { $$ = CYNew CYWord("function"); }
865 | "if" { $$ = CYNew CYWord("if"); }
866 | "import" { $$ = CYNew CYWord("import"); }
867 | "!in" { $$ = CYNew CYWord("in"); }
868 | "!of" { $$ = CYNew CYWord("of"); }
869 | "null" { $$ = CYNew CYWord("null"); }
870 | "return" { $$ = CYNew CYWord("return"); }
871 | "super" { $$ = CYNew CYWord("super"); }
872 | "switch" { $$ = CYNew CYWord("switch"); }
873 | "this" { $$ = CYNew CYWord("this"); }
874 | "throw" { $$ = CYNew CYWord("throw"); }
875 | "true" { $$ = CYNew CYWord("true"); }
876 | "try" { $$ = CYNew CYWord("try"); }
877 | "var" { $$ = CYNew CYWord("var"); }
878 | "while" { $$ = CYNew CYWord("while"); }
879 | "with" { $$ = CYNew CYWord("with"); }
883 : WordNoUnary[pass] { $$ = $pass; }
884 | "delete" { $$ = CYNew CYWord("delete"); }
885 | "typeof" { $$ = CYNew CYWord("typeof"); }
886 | "void" { $$ = CYNew CYWord("void"); }
887 | "yield" { $$ = CYNew CYIdentifier("yield"); }
892 : Word[pass] { $$ = $pass; }
897 /* 11.8.1 Null Literals {{{ */
899 : "null" { $$ = CYNew CYNull(); }
902 /* 11.8.2 Boolean Literals {{{ */
904 : "true" { $$ = CYNew CYTrue(); }
905 | "false" { $$ = CYNew CYFalse(); }
908 /* 11.8.5 Regular Expression Literals {{{ */
909 RegularExpressionSlash
910 : "/" { $$ = false; }
911 | "/=" { $$ = true; }
914 RegularExpressionLiteral
915 : RegularExpressionSlash[equals] { CYMPT(@$); driver.SetRegEx($equals); } RegularExpressionLiteral_[pass] { $$ = $pass; }
919 /* 11.9 Automatic Semicolon Insertion {{{ */
921 : { driver.Warning(@$, "warning, automatic semi-colon insertion required"); }
929 : LexNewLineOrNot "\n"
934 : LexNewLineOrNot "\n" StrictSemi
935 | NewLineNot LexOf Terminator
940 | error { if (yyla.type_get() != yyeof_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
945 | error { if (yyla.type_get() != yyeof_ && yyla.type != yytranslate_(token::CloseBrace) && !driver.newline_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
950 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
954 /* 12.1 Identifiers {{{ */
956 : Identifier[pass] { $$ = CYNew CYVariable($pass); }
957 | "yield" { $$ = CYNew CYVariable(CYNew CYIdentifier("yield")); }
961 : LexOf IdentifierNoOf[pass] { $$ = $pass; }
962 | LexOf "!of" { $$ = CYNew CYIdentifier("of"); }
963 | LexOf "yield" { $$ = CYNew CYIdentifier("yield"); }
967 : BindingIdentifier[pass] { $$ = $pass; }
968 | LexOf { $$ = NULL; }
972 : Identifier[pass] { $$ = $pass; }
973 | "yield" { $$ = CYNew CYIdentifier("yield"); }
977 : Identifier_[pass] { $$ = $pass; }
978 | "abstract" { $$ = CYNew CYIdentifier("abstract"); }
979 | "as" { $$ = CYNew CYIdentifier("as"); }
980 | "await" { $$ = CYNew CYIdentifier("await"); }
981 | "boolean" { $$ = CYNew CYIdentifier("boolean"); }
982 | "byte" { $$ = CYNew CYIdentifier("byte"); }
983 | "constructor" { $$ = CYNew CYIdentifier("constructor"); }
984 | "double" { $$ = CYNew CYIdentifier("double"); }
985 | "each" { $$ = CYNew CYIdentifier("each"); }
986 | "eval" { $$ = CYNew CYIdentifier("eval"); }
987 | "final" { $$ = CYNew CYIdentifier("final"); }
988 | "float" { $$ = CYNew CYIdentifier("float"); }
989 | "from" { $$ = CYNew CYIdentifier("from"); }
990 | "get" { $$ = CYNew CYIdentifier("get"); }
991 | "goto" { $$ = CYNew CYIdentifier("goto"); }
992 | "implements" { $$ = CYNew CYIdentifier("implements"); }
993 | "Infinity" { $$ = CYNew CYIdentifier("Infinity"); }
994 | "interface" { $$ = CYNew CYIdentifier("interface"); }
995 | "let" { $$ = CYNew CYIdentifier("let"); }
996 | "!let" LexBind LexOf { $$ = CYNew CYIdentifier("let"); }
997 | "native" { $$ = CYNew CYIdentifier("native"); }
998 | "package" { $$ = CYNew CYIdentifier("package"); }
999 | "private" { $$ = CYNew CYIdentifier("private"); }
1000 | "protected" { $$ = CYNew CYIdentifier("protected"); }
1001 | "__proto__" { $$ = CYNew CYIdentifier("__proto__"); }
1002 | "prototype" { $$ = CYNew CYIdentifier("prototype"); }
1003 | "public" { $$ = CYNew CYIdentifier("public"); }
1004 | "set" { $$ = CYNew CYIdentifier("set"); }
1005 | "synchronized" { $$ = CYNew CYIdentifier("synchronized"); }
1006 | "target" { $$ = CYNew CYIdentifier("target"); }
1007 | "throws" { $$ = CYNew CYIdentifier("throws"); }
1008 | "transient" { $$ = CYNew CYIdentifier("transient"); }
1009 | "typeid" { $$ = CYNew CYIdentifier("typeid"); }
1010 | "undefined" { $$ = CYNew CYIdentifier("undefined"); }
1012 | "bool" { $$ = CYNew CYIdentifier("bool"); }
1013 | "BOOL" { $$ = CYNew CYIdentifier("BOOL"); }
1014 | "id" { $$ = CYNew CYIdentifier("id"); }
1015 | "SEL" { $$ = CYNew CYIdentifier("SEL"); }
1020 : IdentifierTypeNoOf[pass] { $$ = $pass; }
1021 | "of" { $$ = CYNew CYIdentifier("of"); }
1025 : IdentifierType[pass] { $$ = $pass; }
1030 : IdentifierTypeNoOf
1031 | "char" { $$ = CYNew CYIdentifier("char"); }
1032 | "int" { $$ = CYNew CYIdentifier("int"); }
1033 | "__int128" { $$ = CYNew CYIdentifier("__int128"); }
1034 | "long" { $$ = CYNew CYIdentifier("long"); }
1035 | "__restrict" { $$ = CYNew CYIdentifier("__restrict"); }
1036 | "restrict" { $$ = CYNew CYIdentifier("restrict"); }
1037 | "short" { $$ = CYNew CYIdentifier("short"); }
1038 | "static" { $$ = CYNew CYIdentifier("static"); }
1039 | "volatile" { $$ = CYNew CYIdentifier("volatile"); }
1041 | "signed" { $$ = CYNew CYIdentifier("signed"); }
1042 | "unsigned" { $$ = CYNew CYIdentifier("unsigned"); }
1045 | "nil" { $$ = CYNew CYIdentifier("nil"); }
1046 | "NO" { $$ = CYNew CYIdentifier("NO"); }
1047 | "NULL" { $$ = CYNew CYIdentifier("NULL"); }
1048 | "YES" { $$ = CYNew CYIdentifier("YES"); }
1053 : IdentifierNoOf[pass] { $$ = $pass; }
1054 | "of" { $$ = CYNew CYIdentifier("of"); }
1055 | "!of" { $$ = CYNew CYIdentifier("of"); }
1058 /* 12.2 Primary Expression {{{ */
1060 : "this" { $$ = CYNew CYThis(); }
1061 | IdentifierReference[pass] { $$ = $pass; }
1062 | Literal[pass] { $$ = $pass; }
1063 | ArrayLiteral[pass] { $$ = $pass; }
1064 | ObjectLiteral[pass] { $$ = $pass; }
1065 | FunctionExpression[pass] { $$ = $pass; }
1066 | ClassExpression[pass] { $$ = $pass; }
1067 | GeneratorExpression[pass] { $$ = $pass; }
1068 | RegularExpressionLiteral[pass] { $$ = $pass; }
1069 | TemplateLiteral[pass] { $$ = $pass; }
1070 | CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) CYERR(@cover, "invalid parenthetical"); $$ = $cover; }
1071 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
1074 CoverParenthesizedExpressionAndArrowParameterList
1075 : "(" Expression[expression] ")" { $$ = CYNew CYParenthetical($expression); }
1076 | "(" LexOf ")" { $$ = NULL; }
1077 | "(" LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1078 | "(" Expression "," LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1081 /* 12.2.4 Literals {{{ */
1083 : NullLiteral[pass] { $$ = $pass; }
1084 | BooleanLiteral[pass] { $$ = $pass; }
1085 | NumericLiteral[pass] { $$ = $pass; }
1086 | StringLiteral[pass] { $$ = $pass; }
1089 /* 12.2.5 Array Initializer {{{ */
1091 : "[" ElementListOpt[elements] "]" { $$ = CYNew CYArray($elements); }
1095 : AssignmentExpression[value] { $$ = CYNew CYElementValue($value); }
1096 | LexOf "..." AssignmentExpression[values] { $$ = CYNew CYElementSpread($values); }
1100 : "," ElementListOpt[elements] { $$ = $elements; }
1105 : ArrayElement[element] ElementList_[next] { $$ = $element; $$->SetNext($next); }
1106 | LexOf "," ElementListOpt[next] { $$ = CYNew CYElementValue(NULL, $next); }
1110 : ElementList[pass] { $$ = $pass; }
1111 | LexOf { $$ = NULL; }
1114 /* 12.2.6 Object Initializer {{{ */
1116 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYObject($properties); }
1119 PropertyDefinitionList_
1120 : "," PropertyDefinitionListOpt[properties] { $$ = $properties; }
1124 PropertyDefinitionList
1125 : PropertyDefinition[property] PropertyDefinitionList_[next] { $property->SetNext($next); $$ = $property; }
1128 PropertyDefinitionListOpt
1129 : PropertyDefinitionList[properties] { $$ = $properties; }
1134 : IdentifierReference[value] { $$ = CYNew CYPropertyValue($value->name_, $value); }
1135 | CoverInitializedName[name] { CYNOT(@$); }
1136 | PropertyName[name] ":" AssignmentExpression[value] { $$ = CYNew CYPropertyValue($name, $value); }
1137 | MethodDefinition[pass] { $$ = $pass; }
1141 : LiteralPropertyName[pass] { $$ = $pass; }
1142 | ComputedPropertyName[pass] { $$ = $pass; }
1146 : IdentifierName[pass] { $$ = $pass; }
1147 | StringLiteral[pass] { $$ = $pass; }
1148 | NumericLiteral[pass] { $$ = $pass; }
1151 ComputedPropertyName
1152 : "[" AssignmentExpression[expression] "]" { $$ = CYNew CYComputed($expression); }
1155 CoverInitializedName
1156 : IdentifierReference Initializer
1160 : "=" AssignmentExpression[initializer] { $$ = $initializer; }
1164 : Initializer[pass] { $$ = $pass; }
1168 /* 12.2.9 Template Literals {{{ */
1170 : NoSubstitutionTemplate[string] { $$ = CYNew CYTemplate($string, NULL); }
1171 | TemplateHead[string] LexPushInOff TemplateSpans[spans] { $$ = CYNew CYTemplate($string, $spans); }
1175 : Expression[value] TemplateMiddle[string] TemplateSpans[spans] { $$ = CYNew CYSpan($value, $string, $spans); }
1176 | Expression[value] TemplateTail[string] LexPopIn { $$ = CYNew CYSpan($value, $string, NULL); }
1180 /* 12.3 Left-Hand-Side Expressions {{{ */
1182 : "[" Expression[property] "]" { $$ = CYNew CYDirectMember(NULL, $property); }
1183 | "." IdentifierName[property] { $$ = CYNew CYDirectMember(NULL, CYNew CYString($property)); }
1184 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
1185 | TemplateLiteral { CYNOT(@$); }
1189 : PrimaryExpression[pass] { $$ = $pass; }
1190 | MemberExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1191 | SuperProperty[pass] { $$ = $pass; }
1192 | MetaProperty { CYNOT(@$); }
1193 | "new" MemberExpression[constructor] Arguments[arguments] { $$ = CYNew cy::Syntax::New($constructor, $arguments); }
1197 : Super "[" Expression[property] "]" { $$ = CYNew CYSuperAccess($property); }
1198 | Super "." IdentifierName[property] { $$ = CYNew CYSuperAccess(CYNew CYString($property)); }
1206 : "new" "." "target"
1210 : MemberExpression[pass] { $$ = $pass; }
1211 | "new" NewExpression[expression] { $$ = CYNew cy::Syntax::New($expression, NULL); }
1215 : MemberExpression[pass] { $$ = $pass; }
1216 | CallExpression[pass] { $$ = $pass; }
1220 : CallExpression_[function] Arguments[arguments] { if (!$function->Eval()) $$ = CYNew CYCall($function, $arguments); else $$ = CYNew CYEval($arguments); }
1221 | SuperCall[pass] { $$ = $pass; }
1222 | CallExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1226 : Super Arguments[arguments] { $$ = CYNew CYSuperCall($arguments); }
1230 : "(" ArgumentListOpt[arguments] ")" { $$ = $arguments; }
1234 : "," ArgumentList[arguments] { $$ = $arguments; }
1239 : AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
1240 | LexOf "..." AssignmentExpression { CYNOT(@$); }
1244 : ArgumentList[pass] { $$ = $pass; }
1245 | LexOf { $$ = NULL; }
1249 : NewExpression[pass] { $$ = $pass; }
1250 | CallExpression[pass] { $$ = $pass; }
1253 LeftHandSideExpression
1254 : BracedExpression[pass] { $$ = $pass; }
1255 | IndirectExpression[pass] { $$ = $pass; }
1258 /* 12.4 Postfix Expressions {{{ */
1260 : BracedExpression[pass] { $$ = $pass; }
1261 | AccessExpression[lhs] LexNewLineOrOpt "++" { $$ = CYNew CYPostIncrement($lhs); }
1262 | AccessExpression[lhs] LexNewLineOrOpt "--" { $$ = CYNew CYPostDecrement($lhs); }
1265 /* 12.5 Unary Operators {{{ */
1267 : "delete" UnaryExpression[rhs] { $$ = CYNew CYDelete($rhs); }
1268 | "void" UnaryExpression[rhs] { $$ = CYNew CYVoid($rhs); }
1269 | "typeof" UnaryExpression[rhs] { $$ = CYNew CYTypeOf($rhs); }
1270 | "++" UnaryExpression[rhs] { $$ = CYNew CYPreIncrement($rhs); }
1271 | "--" UnaryExpression[rhs] { $$ = CYNew CYPreDecrement($rhs); }
1272 | "+" UnaryExpression[rhs] { $$ = CYNew CYAffirm($rhs); }
1273 | "-" UnaryExpression[rhs] { $$ = CYNew CYNegate($rhs); }
1274 | "~" UnaryExpression[rhs] { $$ = CYNew CYBitwiseNot($rhs); }
1275 | "!" UnaryExpression[rhs] { $$ = CYNew CYLogicalNot($rhs); }
1279 : PostfixExpression[expression] { $$ = $expression; }
1280 | UnaryExpression_[pass] { $$ = $pass; }
1283 /* 12.6 Multiplicative Operators {{{ */
1284 MultiplicativeExpression
1285 : UnaryExpression[pass] { $$ = $pass; }
1286 | MultiplicativeExpression[lhs] "*" UnaryExpression[rhs] { $$ = CYNew CYMultiply($lhs, $rhs); }
1287 | MultiplicativeExpression[lhs] "/" UnaryExpression[rhs] { $$ = CYNew CYDivide($lhs, $rhs); }
1288 | MultiplicativeExpression[lhs] "%" UnaryExpression[rhs] { $$ = CYNew CYModulus($lhs, $rhs); }
1291 /* 12.7 Additive Operators {{{ */
1293 : MultiplicativeExpression[pass] { $$ = $pass; }
1294 | AdditiveExpression[lhs] "+" MultiplicativeExpression[rhs] { $$ = CYNew CYAdd($lhs, $rhs); }
1295 | AdditiveExpression[lhs] "-" MultiplicativeExpression[rhs] { $$ = CYNew CYSubtract($lhs, $rhs); }
1298 /* 12.8 Bitwise Shift Operators {{{ */
1300 : AdditiveExpression[pass] { $$ = $pass; }
1301 | ShiftExpression[lhs] "<<" AdditiveExpression[rhs] { $$ = CYNew CYShiftLeft($lhs, $rhs); }
1302 | ShiftExpression[lhs] ">>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightSigned($lhs, $rhs); }
1303 | ShiftExpression[lhs] ">>>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightUnsigned($lhs, $rhs); }
1306 /* 12.9 Relational Operators {{{ */
1307 RelationalExpression
1308 : ShiftExpression[pass] { $$ = $pass; }
1309 | RelationalExpression[lhs] "<" ShiftExpression[rhs] { $$ = CYNew CYLess($lhs, $rhs); }
1310 | RelationalExpression[lhs] ">" ShiftExpression[rhs] { $$ = CYNew CYGreater($lhs, $rhs); }
1311 | RelationalExpression[lhs] "<=" ShiftExpression[rhs] { $$ = CYNew CYLessOrEqual($lhs, $rhs); }
1312 | RelationalExpression[lhs] ">=" ShiftExpression[rhs] { $$ = CYNew CYGreaterOrEqual($lhs, $rhs); }
1313 | RelationalExpression[lhs] "instanceof" ShiftExpression[rhs] { $$ = CYNew CYInstanceOf($lhs, $rhs); }
1314 | RelationalExpression[lhs] "in" ShiftExpression[rhs] { $$ = CYNew CYIn($lhs, $rhs); }
1317 /* 12.10 Equality Operators {{{ */
1319 : RelationalExpression[pass] { $$ = $pass; }
1320 | EqualityExpression[lhs] "==" RelationalExpression[rhs] { $$ = CYNew CYEqual($lhs, $rhs); }
1321 | EqualityExpression[lhs] "!=" RelationalExpression[rhs] { $$ = CYNew CYNotEqual($lhs, $rhs); }
1322 | EqualityExpression[lhs] "===" RelationalExpression[rhs] { $$ = CYNew CYIdentical($lhs, $rhs); }
1323 | EqualityExpression[lhs] "!==" RelationalExpression[rhs] { $$ = CYNew CYNotIdentical($lhs, $rhs); }
1326 /* 12.11 Binary Bitwise Operators {{{ */
1327 BitwiseANDExpression
1328 : EqualityExpression[pass] { $$ = $pass; }
1329 | BitwiseANDExpression[lhs] "&" EqualityExpression[rhs] { $$ = CYNew CYBitwiseAnd($lhs, $rhs); }
1332 BitwiseXORExpression
1333 : BitwiseANDExpression[pass] { $$ = $pass; }
1334 | BitwiseXORExpression[lhs] "^" BitwiseANDExpression[rhs] { $$ = CYNew CYBitwiseXOr($lhs, $rhs); }
1338 : BitwiseXORExpression[pass] { $$ = $pass; }
1339 | BitwiseORExpression[lhs] "|" BitwiseXORExpression[rhs] { $$ = CYNew CYBitwiseOr($lhs, $rhs); }
1342 /* 12.12 Binary Logical Operators {{{ */
1343 LogicalANDExpression
1344 : BitwiseORExpression[pass] { $$ = $pass; }
1345 | LogicalANDExpression[lhs] "&&" BitwiseORExpression[rhs] { $$ = CYNew CYLogicalAnd($lhs, $rhs); }
1349 : LogicalANDExpression[pass] { $$ = $pass; }
1350 | LogicalORExpression[lhs] "||" LogicalANDExpression[rhs] { $$ = CYNew CYLogicalOr($lhs, $rhs); }
1353 /* 12.13 Conditional Operator ( ? : ) {{{ */
1355 ConditionalExpressionClassic
1356 : LogicalORExpression[pass] { $$ = $pass; }
1357 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpressionClassic[false] { $$ = CYNew CYCondition($test, $true, $false); }
1361 ConditionalExpression
1362 : LogicalORExpression[pass] { $$ = $pass; }
1363 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpression[false] { $$ = CYNew CYCondition($test, $true, $false); }
1366 /* 12.14 Assignment Operators {{{ */
1367 LeftHandSideAssignment
1368 : LeftHandSideExpression[lhs] "=" { $$ = CYNew CYAssign($lhs, NULL); }
1369 | LeftHandSideExpression[lhs] "*=" { $$ = CYNew CYMultiplyAssign($lhs, NULL); }
1370 | LeftHandSideExpression[lhs] "/=" { $$ = CYNew CYDivideAssign($lhs, NULL); }
1371 | LeftHandSideExpression[lhs] "%=" { $$ = CYNew CYModulusAssign($lhs, NULL); }
1372 | LeftHandSideExpression[lhs] "+=" { $$ = CYNew CYAddAssign($lhs, NULL); }
1373 | LeftHandSideExpression[lhs] "-=" { $$ = CYNew CYSubtractAssign($lhs, NULL); }
1374 | LeftHandSideExpression[lhs] "<<=" { $$ = CYNew CYShiftLeftAssign($lhs, NULL); }
1375 | LeftHandSideExpression[lhs] ">>=" { $$ = CYNew CYShiftRightSignedAssign($lhs, NULL); }
1376 | LeftHandSideExpression[lhs] ">>>=" { $$ = CYNew CYShiftRightUnsignedAssign($lhs, NULL); }
1377 | LeftHandSideExpression[lhs] "&=" { $$ = CYNew CYBitwiseAndAssign($lhs, NULL); }
1378 | LeftHandSideExpression[lhs] "^=" { $$ = CYNew CYBitwiseXOrAssign($lhs, NULL); }
1379 | LeftHandSideExpression[lhs] "|=" { $$ = CYNew CYBitwiseOrAssign($lhs, NULL); }
1383 AssignmentExpressionClassic
1384 : LexOf ConditionalExpressionClassic[pass] { $$ = $pass; }
1385 | LexOf LeftHandSideAssignment[assignment] AssignmentExpressionClassic[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1389 AssignmentExpression
1390 : LexOf ConditionalExpression[pass] { $$ = $pass; }
1391 | LexOf YieldExpression[pass] { $$ = $pass; }
1392 | ArrowFunction[pass] { $$ = $pass; }
1393 | LexOf LeftHandSideAssignment[assignment] AssignmentExpression[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1396 /* 12.15 Comma Operator ( , ) {{{ */
1398 : AssignmentExpression[pass] { $$ = $pass; }
1399 | Expression[expression] "," AssignmentExpression[next] { $$ = CYNew CYCompound($expression, $next); }
1403 : Expression[pass] { $$ = $pass; }
1404 | LexOf { $$ = NULL; }
1408 /* 13 Statements and Declarations {{{ */
1410 : BlockStatement[pass] { $$ = $pass; }
1411 | VariableStatement[pass] { $$ = $pass; }
1412 | EmptyStatement[pass] { $$ = $pass; }
1413 | IfStatement[pass] { $$ = $pass; }
1414 | BreakableStatement[pass] { $$ = $pass; }
1415 | ContinueStatement[pass] { $$ = $pass; }
1416 | BreakStatement[pass] { $$ = $pass; }
1417 | ReturnStatement[pass] { $$ = $pass; }
1418 | WithStatement[pass] { $$ = $pass; }
1419 | LabelledStatement[pass] { $$ = $pass; }
1420 | ThrowStatement[pass] { $$ = $pass; }
1421 | TryStatement[pass] { $$ = $pass; }
1422 | DebuggerStatement[pass] { $$ = $pass; }
1426 : LexOf Statement__[pass] { $$ = $pass; }
1427 | ExpressionStatement[pass] { $$ = $pass; }
1431 : LexSetStatement LexLet Statement_[pass] { $$ = $pass; }
1435 : HoistableDeclaration[pass] { $$ = $pass; }
1436 | ClassDeclaration[pass] { $$ = $pass; }
1440 : LexSetStatement LexLet LexOf Declaration_[pass] { $$ = $pass; }
1441 | LexSetStatement LexicalDeclaration[pass] { $$ = $pass; }
1444 HoistableDeclaration
1445 : FunctionDeclaration[pass] { $$ = $pass; }
1446 | GeneratorDeclaration[pass] { $$ = $pass; }
1450 : IterationStatement[pass] { $$ = $pass; }
1451 | SwitchStatement[pass] { $$ = $pass; }
1454 /* 13.2 Block {{{ */
1456 : ";{" StatementListOpt[code] "}" { $$ = CYNew CYBlock($code); }
1460 : "{" StatementListOpt[code] "}" { $$ = $code; }
1464 : StatementListItem[statement] StatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1468 : StatementList[pass] { $$ = $pass; }
1469 | LexSetStatement LexLet LexOf { $$ = NULL; }
1473 : Statement[pass] { $$ = $pass; }
1474 | Declaration[pass] { $$ = $pass; }
1477 /* 13.3 Let and Const Declarations {{{ */
1479 : LetOrConst[constant] BindingList[bindings] { $$ = CYNew CYLexical($constant, $bindings); }
1483 : LexicalDeclaration_[statement] Terminator { $$ = $statement; }
1487 : { CYMAP(_let__, _let_); }
1491 : { CYMAP(_of__, _of_); }
1495 : { CYMAP(OpenBrace_let, OpenBrace); CYMAP(OpenBracket_let, OpenBracket); }
1499 : LexLet LexOf "!let" LexBind LexOf { $$ = false; }
1500 | LexLet LexOf "const" { $$ = true; }
1504 : "," LexBind BindingList[bindings] { $$ = $bindings; }
1509 : LexicalBinding[binding] BindingList_[next] { $$ = CYNew CYBindings($binding, $next); }
1513 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1514 | LexOf BindingPattern Initializer { CYNOT(@$); }
1517 /* 13.3.2 Variable Statement {{{ */
1519 : Var_ VariableDeclarationList[bindings] { $$ = CYNew CYVar($bindings); }
1523 : VariableStatement_[statement] Terminator { $$ = $statement; }
1526 VariableDeclarationList_
1527 : "," VariableDeclarationList[bindings] { $$ = $bindings; }
1531 VariableDeclarationList
1532 : LexBind VariableDeclaration[binding] VariableDeclarationList_[next] { $$ = CYNew CYBindings($binding, $next); }
1536 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1537 | LexOf BindingPattern Initializer { CYNOT(@$); }
1540 /* 13.3.3 Destructuring Binding Patterns {{{ */
1542 : ObjectBindingPattern
1543 | ArrayBindingPattern
1546 ObjectBindingPattern
1547 : "let {" BindingPropertyListOpt "}"
1551 : "let [" BindingElementListOpt "]"
1554 BindingPropertyList_
1555 : "," BindingPropertyListOpt
1560 : BindingProperty BindingPropertyList_
1563 BindingPropertyListOpt
1564 : BindingPropertyList
1569 : BindingElementOpt[element] "," BindingElementListOpt[next]
1570 | BindingRestElement[element]
1571 | BindingElement[element]
1574 BindingElementListOpt
1575 : BindingElementList[pass]
1581 | LexOf PropertyName ":" BindingElement
1585 : LexBind SingleNameBinding[pass] { $$ = $pass; }
1586 | LexBind LexOf BindingPattern InitializerOpt[initializer] { CYNOT(@$); }
1590 : BindingElement[pass]
1595 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1599 : LexBind LexOf "..." BindingIdentifier
1602 /* 13.4 Empty Statement {{{ */
1604 : ";" { $$ = CYNew CYEmpty(); }
1607 /* 13.5 Expression Statement {{{ */
1608 ExpressionStatement_
1609 : Expression[expression] { $$ = CYNew CYExpress($[expression]); }
1612 : ExpressionStatement_[statement] Terminator { $$ = $statement; }
1615 /* 13.6 The if Statement {{{ */
1617 : "else" Statement[false] { $$ = $false; }
1618 | %prec "if" { $$ = NULL; }
1622 : "if" "(" Expression[test] ")" Statement[true] ElseStatementOpt[false] { $$ = CYNew CYIf($test, $true, $false); }
1625 /* 13.7 Iteration Statements {{{ */
1627 : "do" Statement[code] "while" "(" Expression[test] ")" TerminatorOpt { $$ = CYNew CYDoWhile($test, $code); }
1628 | "while" "(" Expression[test] ")" Statement[code] { $$ = CYNew CYWhile($test, $code); }
1629 | "for" "(" LexPushInOn ForStatementInitializer[initializer] LexPopIn ExpressionOpt[test] ";" ExpressionOpt[increment] ")" Statement[code] { $$ = CYNew CYFor($initializer, $test, $increment, $code); }
1630 | "for" "(" LexPushInOn LexLet LexOf Var_ LexBind BindingIdentifier[identifier] Initializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForInitialized(CYNew CYBinding($identifier, $initializer), $iterable, $code); }
1631 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForIn($initializer, $iterable, $code); }
1632 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "of" LexPopIn AssignmentExpression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
1635 ForStatementInitializer
1636 : LexLet LexOf EmptyStatement[pass] { $$ = $pass; }
1637 | LexLet ExpressionStatement_[initializer] ";" { $$ = $initializer; }
1638 | LexLet LexOf VariableStatement_[initializer] ";" { $$ = $initializer; }
1639 | LexicalDeclaration_[initializer] ";" { $$ = $initializer; }
1642 ForInStatementInitializer
1643 : LexLet LexOf BracedExpression[pass] { $$ = $pass; }
1644 | LexLet LexOf IndirectExpression[pass] { $$ = $pass; }
1645 | LexLet LexOf Var_ LexBind ForBinding[binding] { $$ = CYNew CYForVariable($binding); }
1646 | ForDeclaration[pass] { $$ = $pass; }
1650 : LetOrConst[constant] ForBinding[binding] { $$ = CYNew CYForLexical($constant, $binding); }
1654 : BindingIdentifier[identifier] { $$ = CYNew CYBinding($identifier, NULL); }
1655 | LexOf BindingPattern { CYNOT(@$); }
1658 /* 13.8 The continue Statement {{{ */
1660 : "continue" TerminatorSoft { $$ = CYNew CYContinue(NULL); }
1661 | "continue" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYContinue($label); }
1664 /* 13.9 The break Statement {{{ */
1666 : "break" TerminatorSoft { $$ = CYNew CYBreak(NULL); }
1667 | "break" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYBreak($label); }
1670 /* 13.10 The return Statement {{{ */
1672 : Return TerminatorSoft { $$ = CYNew CYReturn(NULL); }
1673 | Return NewLineNot Expression[value] Terminator { $$ = CYNew CYReturn($value); }
1676 /* 13.11 The with Statement {{{ */
1678 : "with" "(" Expression[scope] ")" Statement[code] { $$ = CYNew CYWith($scope, $code); }
1681 /* 13.12 The switch Statement {{{ */
1683 : "switch" "(" Expression[value] ")" CaseBlock[clauses] { $$ = CYNew CYSwitch($value, $clauses); }
1687 : "{" CaseClausesOpt[clauses] "}" { $$ = $clauses; }
1691 : "case" Expression[value] ":" StatementListOpt[code] { $$ = CYNew CYClause($value, $code); }
1695 : CaseClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1696 | DefaultClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1700 // XXX: the standard makes certain you can only have one of these
1702 : "default" ":" StatementListOpt[code] { $$ = CYNew CYClause(NULL, $code); }
1705 /* 13.13 Labelled Statements {{{ */
1707 : LabelIdentifier[name] ":" LabelledItem[statement] { $$ = CYNew CYLabel($name, $statement); }
1711 : Statement[pass] { $$ = $pass; }
1712 | LexSetStatement LexLet LexOf FunctionDeclaration[pass] { $$ = $pass; }
1715 /* 13.14 The throw Statement {{{ */
1717 : "throw"[throw] TerminatorSoft { CYERR(@throw, "throw without exception"); }
1718 | "throw" NewLineNot Expression[value] Terminator { $$ = CYNew cy::Syntax::Throw($value); }
1721 /* 13.15 The try Statement {{{ */
1723 : "try" Block[code] Catch[catch] { $$ = CYNew cy::Syntax::Try($code, $catch, NULL); }
1724 | "try" Block[code] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, NULL, $finally); }
1725 | "try" Block[code] Catch[catch] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, $catch, $finally); }
1729 : "catch" "(" LexBind CatchParameter[name] ")" Block[code] { $$ = CYNew cy::Syntax::Catch($name, $code); }
1733 : "finally" Block[code] { $$ = CYNew CYFinally($code); }
1737 : BindingIdentifier[pass] { $$ = $pass; }
1738 | LexOf BindingPattern { CYNOT(@$); }
1741 /* 13.16 The debugger Statement {{{ */
1743 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1747 /* 14.1 Function Definitions {{{ */
1749 : ";function" BindingIdentifier[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionStatement($name, $parameters, $code); }
1753 : "function" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionExpression($name, $parameters, $code); }
1756 StrictFormalParameters
1757 : FormalParameters[pass] { $$ = $pass; }
1761 : LexBind LexOf { $$ = NULL; }
1762 | FormalParameterList
1765 FormalParameterList_
1766 : "," FormalParameterList[parameters] { $$ = $parameters; }
1771 : FunctionRestParameter { CYNOT(@$); }
1772 | FormalParameter[binding] FormalParameterList_[next] { $$ = CYNew CYFunctionParameter($binding, $next); }
1775 FunctionRestParameter
1776 : BindingRestElement
1780 : BindingElement[pass] { $$ = $pass; }
1784 : LexPushYieldOff FunctionStatementList[code] LexPopYield { $$ = $code; }
1787 FunctionStatementList
1788 : LexPushReturnOn StatementListOpt[code] LexPopReturn { $$ = $code; }
1791 /* 14.2 Arrow Function Definitions {{{ */
1793 : ArrowParameters[parameters] LexNewLineOrOpt "=>" LexNoBrace ConciseBody[code] { $$ = CYNew CYFatArrow($parameters, $code); }
1797 : BindingIdentifier[identifier] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier)); }
1798 | LexOf CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) $$ = NULL; else { $$ = $cover->expression_->Parameter(); if ($$ == NULL) CYERR(@cover, "invalid parameter list"); } }
1802 : AssignmentExpression[expression] { $$ = CYNew CYReturn($expression); }
1803 | LexOf ";{" FunctionBody[code] "}" { $$ = $code; }
1806 /* 14.3 Method Definitions {{{ */
1808 : PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyMethod($name, $parameters, $code); }
1809 | GeneratorMethod[pass] { $$ = $pass; }
1810 | "get" PropertyName[name] "(" ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyGetter($name, $code); }
1811 | "set" PropertyName[name] "(" PropertySetParameterList[parameter] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertySetter($name, $parameter, $code); }
1814 PropertySetParameterList
1815 : FormalParameter[binding] { $$ = CYNew CYFunctionParameter($binding); }
1818 /* 14.4 Generator Function Definitions {{{ */
1820 : "*" PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorMethod($name, $parameters, $code); */ }
1823 GeneratorDeclaration
1824 : ";function" LexOf "*" BindingIdentifier[name] "(" FormalParameters[code] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorStatement($name, $parameters, $code); */ }
1828 : "function" LexOf "*" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorExpression($name, $parameters, $code); */ }
1832 : LexPushYieldOn FunctionStatementList[code] LexPopYield { $$ = $code; }
1836 : "!yield" LexNewLineOrNot "\n" LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ }
1837 | "!yield" LexNewLineOrNot "" LexNoStar LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ } %prec "!yield"
1838 | "!yield" LexNewLineOrNot "" LexNoStar AssignmentExpression[value] { CYNOT(@$); /* $$ = CYNew CYYieldValue($value); */ }
1839 | "!yield" LexNewLineOrNot "" LexNoStar LexOf "yield *" AssignmentExpression[generator] { CYNOT(@$); /* $$ = CYNew CYYieldGenerator($generator); */ }
1842 /* 14.5 Class Definitions {{{ */
1844 : ";class" BindingIdentifier[name] ClassTail[tail] { $$ = CYNew CYClassStatement($name, $tail); }
1848 : "class" BindingIdentifierOpt[name] ClassTail[tail] { $$ = CYNew CYClassExpression($name, $tail); }
1852 : ClassHeritageOpt[tail] { driver.class_.push($tail); } "{" LexPushSuperOn ClassBodyOpt "}" LexPopSuper { driver.class_.pop(); $$ = $tail; }
1856 : "extends" AccessExpression[extends] { $$ = CYNew CYClassTail($extends); }
1860 : ClassHeritage[pass] { $$ = $pass; }
1861 | { $$ = CYNew CYClassTail(NULL); }
1874 : ClassElementListOpt ClassElement
1883 : MethodDefinition[method] { if (CYFunctionExpression *constructor = $method->Constructor()) driver.class_.top()->constructor_ = constructor; else driver.class_.top()->instance_->*$method; }
1884 | "static" MethodDefinition[method] { driver.class_.top()->static_->*$method; }
1889 /* 15.1 Scripts {{{ */
1891 : ScriptBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1895 : StatementList[pass] { $$ = $pass; }
1899 : ScriptBody[pass] { $$ = $pass; }
1900 | LexSetStatement LexLet LexOf { $$ = NULL; }
1903 /* 15.2 Modules {{{ */
1905 : ModuleBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1909 : ModuleItemList[pass] { $$ = $pass; }
1913 : ModuleBody[pass] { $$ = $pass; }
1914 | LexSetStatement LexLet LexOf { $$ = NULL; }
1918 : ModuleItem[statement] ModuleItemListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1922 : ModuleItemList[pass] { $$ = $pass; }
1923 | LexSetStatement LexLet LexOf { $$ = NULL; }
1927 : LexSetStatement LexLet LexOf ImportDeclaration[pass] { $$ = $pass; }
1928 | LexSetStatement LexLet LexOf ExportDeclaration { CYNOT(@$); }
1929 | StatementListItem[pass] { $$ = $pass; }
1932 /* 15.2.2 Imports {{{ */
1934 : "import" ImportClause[specifiers] FromClause[module] Terminator { $$ = CYNew CYImportDeclaration($specifiers, $module); }
1935 | "import" LexOf ModuleSpecifier[module] Terminator { $$ = CYNew CYImportDeclaration(NULL, $module); }
1939 : ImportedDefaultBinding[default] { $$ = $default; }
1940 | LexOf NameSpaceImport[pass] { $$ = $pass; }
1941 | LexOf NamedImports[pass] { $$ = $pass; }
1942 | ImportedDefaultBinding[default] "," NameSpaceImport[next] { $$ = $default; CYSetLast($$) = $next; }
1943 | ImportedDefaultBinding[default] "," NamedImports[next] { $$ = $default; CYSetLast($$) = $next; }
1946 ImportedDefaultBinding
1947 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(CYNew CYIdentifier("default"), $binding); }
1951 : "*" "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(NULL, $binding); }
1955 : "{" ImportsListOpt[pass] "}" { $$ = $pass; }
1959 : "from" ModuleSpecifier[pass] { $$ = $pass; }
1963 : "," ImportsListOpt[pass] { $$ = $pass; }
1968 : ImportSpecifier[import] ImportsList_[next] { $$ = $import; CYSetLast($$) = $next; }
1972 : ImportsList[pass] { $$ = $pass; }
1973 | LexOf { $$ = NULL; }
1977 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($binding, $binding); }
1978 | LexOf IdentifierName[name] "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($name, $binding); }
1982 : StringLiteral[pass] { $$ = $pass; }
1986 : BindingIdentifier[pass] { $$ = $pass; }
1989 /* 15.2.3 Exports {{{ */
1991 : "*" FromClause Terminator
1992 | ExportClause FromClause Terminator
1993 | ExportClause Terminator
1995 | "default" LexSetStatement LexOf HoistableDeclaration
1996 | "default" LexSetStatement LexOf ClassDeclaration
1997 | "default" LexSetStatement AssignmentExpression Terminator
2001 : "export" LexSetStatement LexLet LexOf ExportDeclaration_
2002 | "export" Declaration
2006 : ";{" ExportsListOpt "}"
2010 : "," ExportsListOpt
2015 : ExportSpecifier ExportsList_
2025 | IdentifierName "as" IdentifierName
2030 /* Cycript (C): Type Encoding {{{ */
2032 : IdentifierType[name] { $$ = CYNew CYTypedName(@name, $name); }
2033 | StringLiteral[name] { $$ = CYNew CYTypedName(@name, $name); }
2034 | NumericLiteral[name] { $$ = CYNew CYTypedName(@name, $name); }
2035 | "(" "*" TypeQualifierRightOpt[typed] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2039 : { $$ = CYNew CYTypedName(@$); }
2043 : TypeSignifier[pass] { $$ = $pass; }
2044 | TypeSignifierNone[pass] { $$ = $pass; }
2061 ParameterModifierOpt
2067 : TypedParameterListOpt[formal] ")" ParameterModifierOpt { $$ = CYNew CYTypeFunctionWith($formal->variadic_, $formal->parameters_); }
2071 : SuffixedTypeOpt[typed] "[" RestrictOpt NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
2072 | "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameters[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
2073 | TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2074 | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedName(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2078 : SuffixedType[pass] { $$ = $pass; }
2079 | TypeSignifierOpt[pass] { $$ = $pass; }
2083 : "*" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2087 : "const" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeConstant(); }
2088 | "volatile" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeVolatile(); }
2091 TypeQualifierLeftOpt
2092 : TypeQualifierLeft[pass] { $$ = $pass; }
2097 : SuffixedType[pass] { $$ = $pass; }
2098 | PrefixedType[pass] { $$ = $pass; }
2099 | "const" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
2100 | "volatile" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
2101 | Restrict TypeQualifierRightOpt[typed] { $$ = $typed; }
2104 TypeQualifierRightOpt
2105 : TypeQualifierRight[pass] { $$ = $pass; }
2106 | TypeSignifierOpt[pass] { $$ = $pass; }
2110 : "int" { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2111 | "unsigned" IntegerTypeOpt[integral] { $$ = $integral->Unsigned(); if ($$ == NULL) CYERR(@1, "incompatible unsigned"); }
2112 | "signed" IntegerTypeOpt[integral] { $$ = $integral->Signed(); if ($$ == NULL) CYERR(@1, "incompatible signed"); }
2113 | "long" IntegerTypeOpt[integral] { $$ = $integral->Long(); if ($$ == NULL) CYERR(@1, "incompatible long"); }
2114 | "short" IntegerTypeOpt[integral] { $$ = $integral->Short(); if ($$ == NULL) CYERR(@1, "incompatible short"); }
2118 : IntegerType[pass] { $$ = $pass; }
2119 | { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2123 : TypedIdentifierField[typed] ";" StructFieldListOpt[next] { $$ = CYNew CYTypeStructField($typed, $typed->name_, $next); }
2128 : NumericLiteral[pass] { $$ = $pass; }
2129 | "-" NumericLiteral[positive] { $$ = $positive; $$->value_ = -$$->value_; }
2132 EnumConstantListOpt_
2133 : "," EnumConstantListOpt[pass] { $$ = $pass; }
2138 : IdentifierType[name] "=" IntegerNumber[value] EnumConstantListOpt_[next] { $$ = CYNew CYEnumConstant($name, $value, $next); }
2143 : { $$ = CYTypeNeutral; }
2144 | "signed" { $$ = CYTypeSigned; }
2145 | "unsigned" { $$ = CYTypeUnsigned; }
2149 : IdentifierType[name] { $$ = CYNew CYTypeVariable($name); }
2150 | IntegerType[pass] { $$ = $pass; }
2151 | TypeSigning[signing] "char" { $$ = CYNew CYTypeCharacter($signing); }
2152 | TypeSigning[signing] "__int128" { $$ = CYNew CYTypeInt128($signing); }
2156 : PrimitiveType[pass] { $$ = $pass; }
2157 | "struct" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); }
2158 | "enum" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceEnum, $name); }
2159 | "struct" AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2160 | "enum" AutoComplete { driver.mode_ = CYDriver::AutoEnum; YYACCEPT; }
2163 TypedIdentifierMaybe
2164 : TypeQualifierLeft[modifier] "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2165 | "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2166 | TypeQualifierLeftOpt[modifier] PrimitiveReference[specifier] TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = $specifier; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2170 : TypedIdentifierMaybe[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2174 : TypedIdentifierMaybe[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2177 TypedIdentifierTagged
2178 : TypeQualifierLeftOpt[modifier] "struct" "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeStruct(NULL, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2179 | TypeQualifierLeftOpt[modifier] "enum" ":" PrimitiveType[specifier] "{" EnumConstantListOpt[constants] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeEnum(NULL, $specifier, $constants); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2182 TypedIdentifierField
2183 : TypedIdentifierYes[pass] { $$ = $pass; }
2184 | TypedIdentifierTagged[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2187 TypedIdentifierEncoding
2188 : TypedIdentifierNo[pass] { $$ = $pass; }
2189 | TypedIdentifierTagged[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2190 | "void" TypeSignifierNone[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2193 TypedIdentifierDefinition
2194 : TypedIdentifierYes[pass] { $$ = $pass; }
2195 | TypeQualifierLeftOpt[modifier] "struct" IdentifierTypeOpt[name] "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; $$->specifier_ = CYNew CYTypeStruct($name, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2196 | "void" TypeSignifier[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2200 : "@encode" "(" TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYEncodedType($typed); }
2206 /* Cycript (Objective-C): @class Declaration {{{ */
2208 /* XXX: why the hell did I choose MemberExpression? */
2209 : ":" MemberExpression[extends] { $$ = $extends; }
2213 ImplementationFieldListOpt
2214 : TypedIdentifierField[typed] ";" ImplementationFieldListOpt[next] { $$ = CYNew CYImplementationField($typed, $typed->name_, $next); }
2219 : "+" { $$ = false; }
2220 | "-" { $$ = true; }
2224 : "(" TypedIdentifierNo[type] ")" { $$ = $type; }
2225 | { $$ = CYNew CYType(CYNew CYTypeVariable("id")); }
2229 : Word[tag] ":" TypeOpt[type] BindingIdentifier[identifier] { $$ = CYNew CYMessageParameter($tag, $type, $identifier); }
2232 MessageParameterList
2233 : MessageParameter[parameter] MessageParameterListOpt[next] { $parameter->SetNext($next); $$ = $parameter; }
2236 MessageParameterListOpt
2237 : MessageParameterList[pass] { $$ = $pass; }
2238 | TypedParameterList_[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); /*XXX*/ if ($formal->parameters_ != NULL) CYERR(@$, "temporarily unsupported"); $$ = NULL; }
2242 : MessageParameterList[pass] { $$ = $pass; }
2243 | Word[tag] { $$ = CYNew CYMessageParameter($tag); }
2246 ClassMessageDeclaration
2247 : MessageScope[instance] TypeOpt[type] MessageParameters[parameters] "{" LexPushSuperOn FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYMessage($instance, $type, $parameters, $code); }
2250 ClassMessageDeclarationListOpt
2251 : ClassMessageDeclarationListOpt[next] ClassMessageDeclaration[message] { $message->SetNext($next); $$ = $message; }
2255 // XXX: this should be AssignmentExpressionNoRight
2257 : ShiftExpression[name] ClassProtocolsOpt[next] { $$ = CYNew CYProtocol($name, $next); }
2261 : "," ClassProtocols[protocols] { $$ = $protocols; }
2265 ClassProtocolListOpt
2266 : "<" ClassProtocols[protocols] ">" { $$ = $protocols; }
2270 ImplementationStatement
2271 : "@implementation" Identifier[name] ClassSuperOpt[extends] ClassProtocolListOpt[protocols] "{" ImplementationFieldListOpt[fields] "}" ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYImplementation($name, $extends, $protocols, $fields, $messages); }
2279 : "@implementation" Identifier[name] CategoryName ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYCategory($name, $messages); }
2283 : ImplementationStatement[pass] { $$ = $pass; }
2284 | CategoryStatement[pass] { $$ = $pass; }
2287 /* Cycript (Objective-C): Send Message {{{ */
2289 : "," AssignmentExpressionClassic[value] VariadicCall[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
2294 : WordOpt[name] { driver.contexts_.back().words_.push_back($name); } { $$ = $name; }
2295 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
2299 : SelectorCall[pass] { $$ = $pass; }
2300 | VariadicCall[pass] { $$ = $pass; }
2304 : SelectorWordOpt[name] ":" AssignmentExpressionClassic[value] SelectorCall_[next] { $$ = CYNew CYArgument($name ?: CYNew CYWord(""), $value, $next); }
2308 : SelectorCall[pass] { $$ = $pass; }
2309 | Word[name] { $$ = CYNew CYArgument($name, NULL); }
2313 : "[" AssignmentExpressionClassic[self] { driver.contexts_.push_back($self); } SelectorList[arguments] "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($self, $arguments); }
2314 | "[" LexOf "super" { driver.context_ = NULL; } SelectorList[arguments] "]" { $$ = CYNew CYSendSuper($arguments); }
2318 : WordOpt[name] ":" SelectorExpressionOpt[next] { $$ = CYNew CYSelectorPart($name, true, $next); }
2322 : SelectorExpression_[pass] { $$ = $pass; }
2323 | Word[name] { $$ = CYNew CYSelectorPart($name, false, NULL); }
2326 SelectorExpressionOpt
2327 : SelectorExpression_[pass] { $$ = $pass; }
2332 : MessageExpression[pass] { $$ = $pass; }
2333 | "@selector" "(" SelectorExpression[parts] ")" { $$ = CYNew CYSelector($parts); }
2338 /* Cycript: @import Directive {{{ */
2340 : ModulePath[next] "." Word[part] { $$ = CYNew CYModule($part, $next); }
2341 | Word[part] { $$ = CYNew CYModule($part); }
2345 : "@import" ModulePath[path] { $$ = CYNew CYImport($path); }
2350 /* Cycript (Objective-C): Boxed Expressions {{{ */
2352 : NullLiteral[pass] { $$ = $pass; }
2353 | BooleanLiteral[pass] { $$ = $pass; }
2354 | NumericLiteral[pass] { $$ = $pass; }
2355 | StringLiteral[pass] { $$ = $pass; }
2356 | CoverParenthesizedExpressionAndArrowParameterList[pass] { $$ = $pass; }
2357 | "YES" { $$ = CYNew CYTrue(); }
2358 | "NO" { $$ = CYNew CYFalse(); }
2362 : "," KeyValuePairListOpt[next] { $$ = $next; }
2366 : AssignmentExpression[key] ":" AssignmentExpression[value] KeyValuePairList_[next] { $$ = CYNew CYObjCKeyValue($key, $value, $next); }
2370 : KeyValuePairList[pass] { $$ = $pass; }
2371 | LexOf { $$ = NULL; }
2375 : "@" BoxableExpression[expression] { $$ = CYNew CYBox($expression); }
2376 | "@" "[" ElementListOpt[elements] "]" { $$ = CYNew CYObjCArray($elements); }
2377 | "@" "{" KeyValuePairListOpt[pairs] "}" { $$ = CYNew CYObjCDictionary($pairs); }
2379 | "@YES" { $$ = CYNew CYBox(CYNew CYTrue()); }
2380 | "@NO" { $$ = CYNew CYBox(CYNew CYFalse()); }
2381 | "@true" { $$ = CYNew CYBox(CYNew CYTrue()); }
2382 | "@false" { $$ = CYNew CYBox(CYNew CYFalse()); }
2383 | "@null" { $$ = CYNew CYBox(CYNew CYNull()); }
2386 /* Cycript (Objective-C): Block Expressions {{{ */
2388 : "^" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { if (CYTypeFunctionWith *function = $type->Function()) $$ = CYNew CYObjCBlock($type, function->parameters_, $code); else CYERR($type->location_, "expected parameters"); }
2391 /* Cycript (Objective-C): Instance Literals {{{ */
2393 : "#" NumericLiteral[address] { $$ = CYNew CYInstanceLiteral($address); }
2399 /* Cycript (C): Pointer Indirection/Addressing {{{ */
2401 : IndirectExpression[pass] { $$ = $pass; }
2405 : "*" UnaryExpression[rhs] { $$ = CYNew CYIndirect($rhs); }
2409 : "&" UnaryExpression[rhs] { $$ = CYNew CYAddressOf($rhs); }
2413 : "->" "[" Expression[property] "]" { $$ = CYNew CYIndirectMember(NULL, $property); }
2414 | "->" IdentifierName[property] { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($property)); }
2415 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
2418 /* Cycript (C): Lambda Expressions {{{ */
2420 : "," TypedParameterList[parameters] { $$ = $parameters; }
2421 | { $$ = CYNew CYTypedFormal(false); }
2425 : TypedIdentifierMaybe[typed] TypedParameterList_[formal] { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = $formal; $$->parameters_ = CYNew CYTypedParameter($typed, identifier, $$->parameters_); }
2426 | "..." { $$ = CYNew CYTypedFormal(true); }
2429 TypedParameterListOpt
2430 : TypedParameterList[pass] { $$ = $pass; }
2431 | "void" { $$ = CYNew CYTypedFormal(false); }
2432 | { $$ = CYNew CYTypedFormal(false); }
2436 : TypedParameterListOpt[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); $$ = $formal->parameters_; }
2440 : "[" LexOf "&" "]" "(" TypedParameters[parameters] ")" "->" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { $$ = CYNew CYLambda($type, $parameters, $code); }
2443 /* Cycript (C): Structure Definitions {{{ */
2445 : "struct" NewLineOpt { $$ = CYNew CYIdentifier("struct"); }
2449 : "struct" NewLineNot IdentifierType[name] "{" StructFieldListOpt[fields] "}" { $$ = CYNew CYStructDefinition($name, CYNew CYStructTail($fields)); }
2453 : "(" LexOf "struct" NewLineOpt IdentifierType[name] TypeQualifierRightOpt[typed] ")" { $typed->specifier_ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); $$ = CYNew CYTypeExpression($typed); }
2454 | "(" LexOf "struct" NewLineOpt AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2457 /* Cycript (C): Type Definitions {{{ */
2459 : "typedef" NewLineOpt { $$ = CYNew CYIdentifier("typedef"); }
2463 : "typedef" NewLineNot TypedIdentifierDefinition[typed] TerminatorHard { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = CYNew CYTypeDefinition($typed, identifier); }
2467 : TypeDefinition[pass] { $$ = $pass; }
2471 : "(" LexOf "typedef" NewLineOpt TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYTypeExpression($typed); }
2474 /* Cycript (C): extern "C" {{{ */
2476 : "extern" NewLineOpt { $$ = CYNew CYIdentifier("extern"); }
2480 : TypedIdentifierField[typed] TerminatorHard { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = CYNew CYExternalDefinition(CYNew CYString("C"), $typed, identifier); }
2481 | TypeDefinition[pass] { $$ = $pass; }
2484 ExternCStatementListOpt
2485 : ExternCStatement[statement] ExternCStatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
2490 : "{" ExternCStatementListOpt[pass] "}" { $$ = $pass; }
2491 | ExternCStatement[pass] { $$ = $pass; }
2495 : StringLiteral[abi] { if (strcmp($abi->Value(), "C") != 0) CYERR(@abi, "unknown extern binding"); }
2499 : "extern" NewLineNot ABI[abi] ExternC[pass] { $$ = $pass; }
2503 : "(" LexOf "extern" NewLineOpt ABI[abi] TypedIdentifierField[typed] ")" { $$ = CYNew CYExternalExpression(CYNew CYString("C"), $typed, $typed->name_); }
2509 /* Lexer State {{{ */
2511 : { driver.PushCondition(CYDriver::RegExpCondition); }
2515 : { driver.PushCondition(CYDriver::XMLContentCondition); }
2519 : { driver.PushCondition(CYDriver::XMLTagCondition); }
2523 : { driver.PopCondition(); }
2527 : { driver.SetCondition(CYDriver::XMLContentCondition); }
2531 : { driver.SetCondition(CYDriver::XMLTagCondition); }
2534 /* Virtual Tokens {{{ */
2541 /* 8.1 Context Keywords {{{ */
2543 : "namespace" { $$ = CYNew CYIdentifier("namespace"); }
2544 | "xml" { $$ = CYNew CYIdentifier("xml"); }
2547 /* 8.3 XML Initializer Input Elements {{{ */
2549 : XMLComment { $$ = $1; }
2550 | XMLCDATA { $$ = $1; }
2551 | XMLPI { $$ = $1; }
2555 /* 11.1 Primary Expressions {{{ */
2557 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
2558 | XMLInitilizer { $$ = $1; }
2559 | XMLListInitilizer { $$ = $1; }
2563 : AttributeIdentifier { $$ = $1; }
2564 | QualifiedIdentifier { $$ = $1; }
2565 | WildcardIdentifier { $$ = $1; }
2568 /* 11.1.1 Attribute Identifiers {{{ */
2570 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
2574 : PropertySelector { $$ = $1; }
2575 | "[" Expression "]" { $$ = CYNew CYSelector($2); }
2579 : Identifier { $$ = CYNew CYSelector($1); }
2580 | WildcardIdentifier { $$ = $1; }
2583 /* 11.1.2 Qualified Identifiers {{{ */
2584 QualifiedIdentifier_
2585 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
2586 | QualifiedIdentifier { $$ = $1; }
2590 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
2593 /* 11.1.3 Wildcard Identifiers {{{ */
2595 : "*" { $$ = CYNew CYWildcard(); }
2598 /* 11.1.4 XML Initializer {{{ */
2600 : XMLMarkup { $$ = $1; }
2601 | XMLElement { $$ = $1; }
2605 : "<" LexPushInOff XMLTagContent LexPop "/>" LexPopIn
2606 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop ">" LexPopIn
2610 : LexPushXMLTag XMLTagName XMLAttributes
2614 : "{" LexPushRegExp Expression LexPop "}"
2623 : XMLAttributes_ XMLAttribute
2628 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
2629 | XMLAttributes_ XMLWhitespaceOpt
2638 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
2642 : XMLExpression XMLElementContentOpt
2643 | XMLMarkup XMLElementContentOpt
2644 | XMLText XMLElementContentOpt
2645 | XMLElement XMLElementContentOpt
2648 XMLElementContentOpt
2653 /* 11.1.5 XMLList Initializer {{{ */
2655 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop "</>" LexPopIn { $$ = CYNew CYXMLList($4); }
2659 /* 11.2 Left-Hand-Side Expressions {{{ */
2661 : Identifier { $$ = $1; }
2662 | PropertyIdentifier { $$ = $1; }
2666 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
2667 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
2668 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
2671 /* 12.1 The default xml namespace Statement {{{ */
2672 /* XXX: DefaultXMLNamespaceStatement
2673 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
2677 : DefaultXMLNamespaceStatement { $$ = $1; }
2682 /* JavaScript FTL: Array Comprehensions {{{ */
2684 : AssignmentExpression[expression] ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2688 : "for" "each" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2691 /* JavaScript FTL: for each {{{ */
2693 : "for" "each" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
2697 /* JavaScript FTW: Array Comprehensions {{{ */
2699 : ArrayComprehension
2703 : "[" Comprehension[comprehension] "]" { $$ = $comprehension; }
2707 : LexOf ComprehensionFor[comprehension] ComprehensionTail[next] AssignmentExpression[expression] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2712 | ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2713 | ComprehensionIf[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2717 : "for" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForInComprehension($binding, $iterable); }
2718 | "for" "(" LexPushInOn LexBind ForBinding[binding] "of" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2722 : "if" "(" AssignmentExpression[test] ")" { $$ = CYNew CYIfComprehension($test); }
2725 /* JavaScript FTW: Named Arguments {{{ */
2727 : LexOf WordNoUnary[tag] ":" AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument($tag, $value, $next); }
2730 /* JavaScript FTW: Subscript Access {{{ */
2732 : "." "[" AssignmentExpression[property] "]" { $$ = CYNew CYSubscriptMember(NULL, $property); }
2736 /* JavaScript FTW: Java "Anonymous Inner Classes" {{{ */
2738 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYExtend(NULL, $properties); }
2742 /* JavaScript FTW: Ruby Blocks {{{ */
2743 RubyProcParameterList_
2744 : "," RubyProcParameterList[parameters] { $$ = $parameters; }
2748 RubyProcParameterList
2749 : BindingIdentifier[identifier] RubyProcParameterList_[next] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier), $next); }
2750 | LexOf { $$ = NULL; }
2754 : "|" RubyProcParameterList[parameters] "|" { $$ = $parameters; }
2755 | "||" { $$ = NULL; }
2758 RubyProcParametersOpt
2759 : RubyProcParameters[pass] { $$ = $pass; }
2764 : ";{" RubyProcParametersOpt[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyBlock(NULL, CYNew CYRubyProc($parameters, $code)); }
2768 : "{" RubyProcParameters[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyProc($parameters, $code); }
2772 : AccessExpression[pass] LexNewLineOrOpt { $$ = $pass; }
2773 | BracedExpression_[lhs] { if (!$lhs->IsNew()) CYMAP(OpenBrace_, OpenBrace); } BracedParameter[rhs] LexNewLineOrOpt { $rhs->SetLeft($lhs); $$ = $rhs; }
2777 : BracedExpression_[pass] "\n" { $$ = $pass; }
2778 | BracedExpression_[pass] { $$ = $pass; }
2781 /* JavaScript FTW: Ruby Scopes {{{ */
2783 : "::" "[" Expression[property] "]" { $$ = CYNew CYResolveMember(NULL, $property); }
2784 | "::" IdentifierName[property] { $$ = CYNew CYResolveMember(NULL, CYNew CYString($property)); }
2785 | "::" AutoComplete { driver.mode_ = CYDriver::AutoResolve; YYACCEPT; }
2788 /* JavaScript FTW: Ruby Symbols {{{ */
2790 : ":" Word[name] { $$ = CYNew CYSymbol($name->Word()); }
2796 bool CYDriver::Parse(CYMark mark) {
2798 CYLocal<CYPool> local(&pool_);
2799 cy::parser parser(*this);
2801 parser.set_debug_level(debug_);
2803 return parser.parse() != 0;
2806 void CYDriver::Warning(const cy::parser::location_type &location, const char *message) {
2810 CYDriver::Error error;
2811 error.warning_ = true;
2812 error.location_ = location;
2813 error.message_ = message;
2814 errors_.push_back(error);
2817 void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
2818 CYDriver::Error error;
2819 error.warning_ = false;
2820 error.location_ = location;
2821 error.message_ = message;
2822 driver.errors_.push_back(error);