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 { CYTypedIdentifier *typedIdentifier_; }
93 %union { CYTypedParameter *typedParameter_; }
97 %union { CYObjCKeyValue *keyValue_; }
98 %union { CYImplementationField *implementationField_; }
99 %union { CYMessage *message_; }
100 %union { CYMessageParameter *messageParameter_; }
101 %union { CYProtocol *protocol_; }
102 %union { CYSelectorPart *selector_; }
106 %union { CYAttribute *attribute_; }
107 %union { CYPropertyIdentifier *propertyIdentifier_; }
108 %union { CYSelector *selector_; }
114 cy::parser::semantic_type semantic_;
115 hi::Value highlight_;
118 int cylex(YYSTYPE *, CYLocation *, void *);
126 typedef cy::parser::token tk;
128 _finline int cylex_(cy::parser::semantic_type *semantic, CYLocation *location, CYDriver &driver) {
129 driver.newline_ = false;
132 int token(cylex(&data, location, driver.scanner_));
133 *semantic = data.semantic_;
137 case tk::OpenBracket:
139 driver.in_.push(false);
143 if (driver.in_.top())
148 case tk::CloseBracket:
155 if (driver.yield_.top())
156 token = tk::_yield__;
160 driver.newline_ = true;
168 #define yylex_(semantic, location, driver) ({ \
170 if (driver.hold_ == cy::parser::empty_symbol) \
171 type = yytranslate_(cylex_(semantic, location, driver)); \
173 type = driver.hold_; \
174 driver.hold_ = cy::parser::empty_symbol; \
178 #define CYLEX() do if (yyla.empty()) { \
179 YYCDEBUG << "Mapping a token: "; \
180 yyla.type = yylex_(&yyla.value, &yyla.location, driver); \
181 YY_SYMBOL_PRINT("Next token is", yyla); \
184 #define CYMAP(to, from) do { \
186 if (yyla.type == yytranslate_(token::from)) \
187 yyla.type = yytranslate_(token::to); \
190 #define CYHLD(location, token) do { \
191 if (driver.hold_ != empty_symbol) \
192 CYERR(location, "unexpected hold"); \
193 driver.hold_ = yyla.type; \
194 yyla.type = yytranslate_(token); \
197 #define CYERR(location, message) do { \
198 error(location, message); \
202 #define CYEOK() do { \
204 driver.errors_.pop_back(); \
207 #define CYNOT(location) \
208 CYERR(location, "unimplemented feature")
210 #define CYMPT(location) do { \
211 if (!yyla.empty() && yyla.type_get() != yyeof_) \
212 CYERR(location, "unexpected lookahead"); \
222 @$.begin.filename = @$.end.filename = &driver.filename_;
224 switch (driver.mark_) {
226 driver.hold_ = yytranslate_(token::MarkScript);
229 driver.hold_ = yytranslate_(token::MarkModule);
231 case CYMarkExpression:
232 driver.hold_ = yytranslate_(token::MarkExpression);
240 %define api.location.type { CYLocation }
247 %param { CYDriver &driver }
249 /* Token Declarations {{{ */
255 %token XMLAttributeValue
257 %token XMLTagCharacters
263 %token LeftRight "<>"
264 %token LeftSlashRight "</>"
266 %token SlashRight "/>"
267 %token LeftSlash "</"
269 %token PeriodPeriod ".."
272 @begin E4X ObjectiveC
277 %token AmpersandAmpersand "&&"
278 %token AmpersandEqual "&="
280 %token CarrotEqual "^="
282 %token EqualEqual "=="
283 %token EqualEqualEqual "==="
284 %token EqualRight "=>"
285 %token Exclamation "!"
286 %token ExclamationEqual "!="
287 %token ExclamationEqualEqual "!=="
289 %token HyphenEqual "-="
290 %token HyphenHyphen "--"
291 %token HyphenRight "->"
293 %token LeftEqual "<="
295 %token LeftLeftEqual "<<="
297 %token PercentEqual "%="
299 %token PeriodPeriodPeriod "..."
301 %token PipeEqual "|="
304 %token PlusEqual "+="
307 %token RightEqual ">="
308 %token RightRight ">>"
309 %token RightRightEqual ">>="
310 %token RightRightRight ">>>"
311 %token RightRightRightEqual ">>>="
313 %token SlashEqual "/="
315 %token StarEqual "*="
319 %token ColonColon "::"
330 %token CloseParen ")"
333 %token OpenBrace_ ";{"
334 %token OpenBrace_let "let {"
335 %token CloseBrace "}"
337 %token OpenBracket "["
338 %token OpenBracket_let "let ["
339 %token CloseBracket "]"
341 %token At_error_ "@error"
344 %token At_class_ "@class"
348 %token _typedef_ "typedef"
349 %token _unsigned_ "unsigned"
350 %token _signed_ "signed"
351 %token _struct_ "struct"
352 %token _extern_ "extern"
356 %token At_encode_ "@encode"
360 %token At_implementation_ "@implementation"
361 %token At_import_ "@import"
362 %token At_end_ "@end"
363 %token At_selector_ "@selector"
364 %token At_null_ "@null"
365 %token At_YES_ "@YES"
367 %token At_true_ "@true"
368 %token At_false_ "@false"
373 %token _false_ "false"
378 %token _break_ "break"
380 %token _catch_ "catch"
381 %token _class_ "class"
382 %token _class__ ";class"
383 %token _const_ "const"
384 %token _continue_ "continue"
385 %token _debugger_ "debugger"
386 %token _default_ "default"
387 %token _delete_ "delete"
391 %token _export_ "export"
392 %token _extends_ "extends"
393 %token _finally_ "finally"
395 %token _function_ "function"
396 %token _function__ ";function"
398 %token _import_ "import"
401 %token _Infinity_ "Infinity"
402 %token _instanceof_ "instanceof"
404 %token _return_ "return"
405 %token _super_ "super"
406 %token _switch_ "switch"
407 %token _target_ "target"
409 %token _throw_ "throw"
411 %token _typeof_ "typeof"
414 %token _while_ "while"
417 %token _abstract_ "abstract"
418 %token _await_ "await"
419 %token _boolean_ "boolean"
422 %token _constructor_ "constructor"
423 %token _double_ "double"
425 %token _final_ "final"
426 %token _float_ "float"
430 %token _implements_ "implements"
432 %token ___int128_ "__int128"
433 %token _interface_ "interface"
437 %token _native_ "native"
438 %token _package_ "package"
439 %token _private_ "private"
440 %token _protected_ "protected"
441 %token ___proto___ "__proto__"
442 %token _prototype_ "prototype"
443 %token _public_ "public"
444 %token ___restrict_ "__restrict"
445 %token _restrict_ "restrict"
447 %token _short_ "short"
448 %token _static_ "static"
449 %token _synchronized_ "synchronized"
450 %token _throws_ "throws"
451 %token _transient_ "transient"
452 %token _typeid_ "typeid"
453 %token _volatile_ "volatile"
454 %token _yield_ "yield"
455 %token _yield__ "!yield"
457 %token _undefined_ "undefined"
473 %token _namespace_ "namespace"
478 %token YieldStar "yield *"
480 %token <identifier_> Identifier_
481 %token <number_> NumericLiteral
482 %token <string_> StringLiteral
483 %token <literal_> RegularExpressionLiteral_
485 %token <string_> NoSubstitutionTemplate
486 %token <string_> TemplateHead
487 %token <string_> TemplateMiddle
488 %token <string_> TemplateTail
490 %type <target_> AccessExpression
491 %type <expression_> AdditiveExpression
492 %type <argument_> ArgumentList_
493 %type <argument_> ArgumentList
494 %type <argument_> ArgumentListOpt
495 %type <argument_> Arguments
496 %type <target_> ArrayComprehension
497 %type <element_> ArrayElement
498 %type <literal_> ArrayLiteral
499 %type <expression_> ArrowFunction
500 %type <functionParameter_> ArrowParameters
501 %type <expression_> AssignmentExpression
502 %type <identifier_> BindingIdentifier
503 %type <identifier_> BindingIdentifierOpt
504 %type <bindings_> BindingList_
505 %type <bindings_> BindingList
506 %type <expression_> BitwiseANDExpression
507 %type <statement_> Block
508 %type <statement_> BlockStatement
509 %type <boolean_> BooleanLiteral
510 %type <binding_> BindingElement
511 %type <expression_> BitwiseORExpression
512 %type <expression_> BitwiseXORExpression
513 %type <target_> BracedExpression_
514 %type <target_> BracedExpression
515 %type <statement_> BreakStatement
516 %type <statement_> BreakableStatement
517 %type <expression_> CallExpression_
518 %type <target_> CallExpression
519 %type <clause_> CaseBlock
520 %type <clause_> CaseClause
521 %type <clause_> CaseClausesOpt
523 %type <identifier_> CatchParameter
524 %type <statement_> ClassDeclaration
525 %type <target_> ClassExpression
526 %type <classTail_> ClassHeritage
527 %type <classTail_> ClassHeritageOpt
528 %type <classTail_> ClassTail
529 %type <target_> Comprehension
530 %type <comprehension_> ComprehensionFor
531 %type <comprehension_> ComprehensionIf
532 %type <comprehension_> ComprehensionTail
533 %type <propertyName_> ComputedPropertyName
534 %type <expression_> ConditionalExpression
535 %type <statement_> ContinueStatement
536 %type <statement_> ConciseBody
537 %type <parenthetical_> CoverParenthesizedExpressionAndArrowParameterList
538 %type <statement_> DebuggerStatement
539 %type <statement_> Declaration_
540 %type <statement_> Declaration
541 %type <clause_> DefaultClause
542 %type <element_> ElementList_
543 %type <element_> ElementList
544 %type <element_> ElementListOpt
545 %type <statement_> ElseStatementOpt
546 %type <for_> EmptyStatement
547 %type <expression_> EqualityExpression
548 %type <expression_> Expression
549 %type <expression_> ExpressionOpt
550 %type <for_> ExpressionStatement_
551 %type <statement_> ExpressionStatement
552 %type <statement_> ExternC
553 %type <statement_> ExternCStatement
554 %type <statement_> ExternCStatementListOpt
555 %type <finally_> Finally
556 %type <binding_> ForBinding
557 %type <forin_> ForDeclaration
558 %type <forin_> ForInStatementInitializer
559 %type <for_> ForStatementInitializer
560 %type <binding_> FormalParameter
561 %type <functionParameter_> FormalParameterList_
562 %type <functionParameter_> FormalParameterList
563 %type <functionParameter_> FormalParameters
564 %type <string_> FromClause
565 %type <statement_> FunctionBody
566 %type <statement_> FunctionDeclaration
567 %type <target_> FunctionExpression
568 %type <statement_> FunctionStatementList
569 %type <statement_> GeneratorBody
570 %type <statement_> GeneratorDeclaration
571 %type <target_> GeneratorExpression
572 %type <method_> GeneratorMethod
573 %type <statement_> HoistableDeclaration
574 %type <identifier_> Identifier
575 %type <identifier_> IdentifierNoOf
576 %type <identifier_> IdentifierType
577 %type <identifier_> IdentifierTypeNoOf
578 %type <identifier_> IdentifierTypeOpt
579 %type <word_> IdentifierName
580 %type <variable_> IdentifierReference
581 %type <statement_> IfStatement
582 %type <import_> ImportClause
583 %type <statement_> ImportDeclaration
584 %type <import_> ImportSpecifier
585 %type <identifier_> ImportedBinding
586 %type <import_> ImportedDefaultBinding
587 %type <import_> ImportsList_
588 %type <import_> ImportsList
589 %type <import_> ImportsListOpt
590 %type <target_> IndirectExpression
591 %type <expression_> Initializer
592 %type <expression_> InitializerOpt
593 %type <statement_> IterationStatement
594 %type <identifier_> LabelIdentifier
595 %type <statement_> LabelledItem
596 %type <statement_> LabelledStatement
597 %type <assignment_> LeftHandSideAssignment
598 %type <target_> LeftHandSideExpression
599 %type <bool_> LetOrConst
600 %type <binding_> LexicalBinding
601 %type <for_> LexicalDeclaration_
602 %type <statement_> LexicalDeclaration
603 %type <literal_> Literal
604 %type <propertyName_> LiteralPropertyName
605 %type <expression_> LogicalANDExpression
606 %type <expression_> LogicalORExpression
607 %type <access_> MemberAccess
608 %type <target_> MemberExpression
609 %type <method_> MethodDefinition
610 %type <statement_> ModuleBody
611 %type <statement_> ModuleBodyOpt
612 %type <statement_> ModuleItem
613 %type <statement_> ModuleItemList
614 %type <statement_> ModuleItemListOpt
615 %type <module_> ModulePath
616 %type <string_> ModuleSpecifier
617 %type <expression_> MultiplicativeExpression
618 %type <import_> NameSpaceImport
619 %type <import_> NamedImports
620 %type <target_> NewExpression
621 %type <null_> NullLiteral
622 %type <literal_> ObjectLiteral
623 %type <expression_> PostfixExpression
624 %type <target_> PrimaryExpression
625 %type <propertyName_> PropertyName
626 %type <property_> PropertyDefinition
627 %type <property_> PropertyDefinitionList_
628 %type <property_> PropertyDefinitionList
629 %type <property_> PropertyDefinitionListOpt
630 %type <functionParameter_> PropertySetParameterList
631 %type <literal_> RegularExpressionLiteral
632 %type <bool_> RegularExpressionSlash
633 %type <expression_> RelationalExpression
634 %type <statement_> ReturnStatement
635 %type <braced_> BracedParameter
636 %type <functionParameter_> RubyProcParameterList_
637 %type <functionParameter_> RubyProcParameterList
638 %type <functionParameter_> RubyProcParameters
639 %type <functionParameter_> RubyProcParametersOpt
640 %type <statement_> Script
641 %type <statement_> ScriptBody
642 %type <statement_> ScriptBodyOpt
643 %type <expression_> ShiftExpression
644 %type <binding_> SingleNameBinding
645 %type <statement_> Statement__
646 %type <statement_> Statement_
647 %type <statement_> Statement
648 %type <statement_> StatementList
649 %type <statement_> StatementListOpt
650 %type <statement_> StatementListItem
651 %type <functionParameter_> StrictFormalParameters
652 %type <target_> SuperCall
653 %type <target_> SuperProperty
654 %type <statement_> SwitchStatement
655 %type <target_> TemplateLiteral
656 %type <span_> TemplateSpans
657 %type <statement_> ThrowStatement
658 %type <statement_> TryStatement
659 %type <statement_> TypeDefinition
660 %type <expression_> UnaryExpression_
661 %type <expression_> UnaryExpression
662 %type <binding_> VariableDeclaration
663 %type <bindings_> VariableDeclarationList_
664 %type <bindings_> VariableDeclarationList
665 %type <for_> VariableStatement_
666 %type <statement_> VariableStatement
667 %type <statement_> WithStatement
669 %type <word_> WordNoUnary
671 %type <word_> WordOpt
673 %type <expression_> YieldExpression
676 %type <constant_> EnumConstantListOpt_
677 %type <constant_> EnumConstantListOpt
678 %type <number_> IntegerNumber
679 %type <integral_> IntegerType
680 %type <integral_> IntegerTypeOpt
681 %type <typedIdentifier_> PrefixedType
682 %type <specifier_> PrimitiveReference
683 %type <specifier_> PrimitiveType
684 %type <structField_> StructFieldListOpt
685 %type <typedIdentifier_> SuffixedType
686 %type <typedIdentifier_> SuffixedTypeOpt
687 %type <typedIdentifier_> TypeSignifier
688 %type <typedIdentifier_> TypeSignifierNone
689 %type <typedIdentifier_> TypeSignifierOpt
690 %type <signing_> TypeSigning
691 %type <modifier_> ParameterTail
692 %type <modifier_> TypeQualifierLeft
693 %type <modifier_> TypeQualifierLeftOpt
694 %type <typedIdentifier_> TypeQualifierRight
695 %type <typedIdentifier_> TypeQualifierRightOpt
696 %type <typedIdentifier_> TypedIdentifierDefinition
697 %type <typedIdentifier_> TypedIdentifierEncoding
698 %type <typedIdentifier_> TypedIdentifierField
699 %type <typedIdentifier_> TypedIdentifierMaybe
700 %type <typedIdentifier_> TypedIdentifierNo
701 %type <typedIdentifier_> TypedIdentifierTagged
702 %type <typedIdentifier_> TypedIdentifierYes
703 %type <typedFormal_> TypedParameterList_
704 %type <typedFormal_> TypedParameterList
705 %type <typedFormal_> TypedParameterListOpt
706 %type <typedParameter_> TypedParameters
710 %type <expression_> AssignmentExpressionClassic
711 %type <expression_> BoxableExpression
712 %type <statement_> CategoryStatement
713 %type <expression_> ClassSuperOpt
714 %type <expression_> ConditionalExpressionClassic
715 %type <message_> ClassMessageDeclaration
716 %type <message_> ClassMessageDeclarationListOpt
717 %type <protocol_> ClassProtocolListOpt
718 %type <protocol_> ClassProtocols
719 %type <protocol_> ClassProtocolsOpt
720 %type <implementationField_> ImplementationFieldListOpt
721 %type <statement_> ImplementationStatement
722 %type <keyValue_> KeyValuePairList_
723 %type <keyValue_> KeyValuePairList
724 %type <keyValue_> KeyValuePairListOpt
725 %type <target_> MessageExpression
726 %type <messageParameter_> MessageParameter
727 %type <messageParameter_> MessageParameters
728 %type <messageParameter_> MessageParameterList
729 %type <messageParameter_> MessageParameterListOpt
730 %type <bool_> MessageScope
731 %type <argument_> SelectorCall_
732 %type <argument_> SelectorCall
733 %type <selector_> SelectorExpression_
734 %type <selector_> SelectorExpression
735 %type <selector_> SelectorExpressionOpt
736 %type <argument_> SelectorList
737 %type <word_> SelectorWordOpt
738 %type <typedIdentifier_> TypeOpt
739 %type <argument_> VariadicCall
743 %type <propertyIdentifier_> PropertyIdentifier_
744 %type <selector_> PropertySelector_
745 %type <selector_> PropertySelector
746 %type <identifier_> QualifiedIdentifier_
747 %type <identifier_> QualifiedIdentifier
748 %type <identifier_> WildcardIdentifier
749 %type <identifier_> XMLComment
750 %type <identifier_> XMLCDATA
751 %type <identifier_> XMLElement
752 %type <identifier_> XMLElementContent
753 %type <identifier_> XMLMarkup
754 %type <identifier_> XMLPI
756 %type <attribute_> AttributeIdentifier
757 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
758 %type <expression_> PropertyIdentifier
759 %type <expression_> XMLListInitilizer
760 %type <expression_> XMLInitilizer
763 /* Token Priorities {{{ */
774 %token MarkExpression
781 | MarkExpression Expression[expression] { driver.context_ = $expression; }
784 /* Lexer State {{{ */
785 LexPushInOn: { driver.in_.push(true); };
786 LexPushInOff: { driver.in_.push(false); };
787 LexPopIn: { driver.in_.pop(); };
789 LexPushReturnOn: { driver.return_.push(true); };
790 LexPopReturn: { driver.return_.pop(); };
791 Return: "return"[return] { if (!driver.return_.top()) CYERR(@return, "invalid return"); };
793 LexPushSuperOn: { driver.super_.push(true); };
794 LexPushSuperOff: { driver.super_.push(false); };
795 LexPopSuper: { driver.super_.pop(); };
796 Super: "super"[super] { if (!driver.super_.top()) CYERR(@super, "invalid super"); };
798 LexPushYieldOn: { driver.yield_.push(true); };
799 LexPushYieldOff: { driver.yield_.push(false); };
800 LexPopYield: { driver.yield_.pop(); };
803 : { CYLEX(); if (driver.newline_) { CYHLD(@$, tk::NewLine); } }
807 : { CYLEX(); CYHLD(@$, driver.newline_ ? tk::NewLine : tk::__); }
811 : { CYMAP(YieldStar, Star); }
815 : { CYMAP(OpenBrace_, OpenBrace); }
819 : { CYMAP(_class__, _class_); }
823 : { CYMAP(_function__, _function_); }
827 : LexNoBrace LexNoClass LexNoFunction
830 /* Virtual Tokens {{{ */
836 /* 11.6 Names and Keywords {{{ */
838 : Word[pass] { $$ = $pass; }
839 | "for" { $$ = CYNew CYWord("for"); }
840 | "in" { $$ = CYNew CYWord("in"); }
841 | "instanceof" { $$ = CYNew CYWord("instanceof"); }
845 : IdentifierNoOf[pass] { $$ = $pass; }
846 | "break" { $$ = CYNew CYWord("break"); }
847 | "case" { $$ = CYNew CYWord("case"); }
848 | "catch" { $$ = CYNew CYWord("catch"); }
849 | "class" LexOf { $$ = CYNew CYWord("class"); }
850 | ";class" { $$ = CYNew CYWord("class"); }
851 | "const" { $$ = CYNew CYWord("const"); }
852 | "continue" { $$ = CYNew CYWord("continue"); }
853 | "debugger" { $$ = CYNew CYWord("debugger"); }
854 | "default" { $$ = CYNew CYWord("default"); }
855 | "do" { $$ = CYNew CYWord("do"); }
856 | "else" { $$ = CYNew CYWord("else"); }
857 | "enum" { $$ = CYNew CYWord("enum"); }
858 | "export" { $$ = CYNew CYWord("export"); }
859 | "extends" { $$ = CYNew CYWord("extends"); }
860 | "false" { $$ = CYNew CYWord("false"); }
861 | "finally" { $$ = CYNew CYWord("finally"); }
862 | "function" LexOf { $$ = CYNew CYWord("function"); }
863 | "if" { $$ = CYNew CYWord("if"); }
864 | "import" { $$ = CYNew CYWord("import"); }
865 | "!in" { $$ = CYNew CYWord("in"); }
866 | "!of" { $$ = CYNew CYWord("of"); }
867 | "null" { $$ = CYNew CYWord("null"); }
868 | "return" { $$ = CYNew CYWord("return"); }
869 | "super" { $$ = CYNew CYWord("super"); }
870 | "switch" { $$ = CYNew CYWord("switch"); }
871 | "this" { $$ = CYNew CYWord("this"); }
872 | "throw" { $$ = CYNew CYWord("throw"); }
873 | "true" { $$ = CYNew CYWord("true"); }
874 | "try" { $$ = CYNew CYWord("try"); }
875 | "var" { $$ = CYNew CYWord("var"); }
876 | "while" { $$ = CYNew CYWord("while"); }
877 | "with" { $$ = CYNew CYWord("with"); }
881 : WordNoUnary[pass] { $$ = $pass; }
882 | "delete" { $$ = CYNew CYWord("delete"); }
883 | "typeof" { $$ = CYNew CYWord("typeof"); }
884 | "void" { $$ = CYNew CYWord("void"); }
885 | "yield" { $$ = CYNew CYIdentifier("yield"); }
890 : Word[pass] { $$ = $pass; }
895 /* 11.8.1 Null Literals {{{ */
897 : "null" { $$ = CYNew CYNull(); }
900 /* 11.8.2 Boolean Literals {{{ */
902 : "true" { $$ = CYNew CYTrue(); }
903 | "false" { $$ = CYNew CYFalse(); }
906 /* 11.8.5 Regular Expression Literals {{{ */
907 RegularExpressionSlash
908 : "/" { $$ = false; }
909 | "/=" { $$ = true; }
912 RegularExpressionLiteral
913 : RegularExpressionSlash[equals] { CYMPT(@$); driver.SetRegEx($equals); } RegularExpressionLiteral_[pass] { $$ = $pass; }
917 /* 11.9 Automatic Semicolon Insertion {{{ */
919 : { driver.Warning(@$, "warning, automatic semi-colon insertion required"); }
927 : LexNewLineOrNot "\n"
932 : LexNewLineOrNot "\n" StrictSemi
933 | NewLineNot LexOf Terminator
938 | error { if (yyla.type_get() != yyeof_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
943 | error { if (yyla.type_get() != yyeof_ && yyla.type != yytranslate_(token::CloseBrace) && !driver.newline_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
948 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
952 /* 12.1 Identifiers {{{ */
954 : Identifier[pass] { $$ = CYNew CYVariable($pass); }
955 | "yield" { $$ = CYNew CYVariable(CYNew CYIdentifier("yield")); }
959 : LexOf IdentifierNoOf[pass] { $$ = $pass; }
960 | LexOf "!of" { $$ = CYNew CYIdentifier("of"); }
961 | LexOf "yield" { $$ = CYNew CYIdentifier("yield"); }
965 : BindingIdentifier[pass] { $$ = $pass; }
966 | LexOf { $$ = NULL; }
970 : Identifier[pass] { $$ = $pass; }
971 | "yield" { $$ = CYNew CYIdentifier("yield"); }
975 : Identifier_[pass] { $$ = $pass; }
976 | "abstract" { $$ = CYNew CYIdentifier("abstract"); }
977 | "as" { $$ = CYNew CYIdentifier("as"); }
978 | "await" { $$ = CYNew CYIdentifier("await"); }
979 | "boolean" { $$ = CYNew CYIdentifier("boolean"); }
980 | "byte" { $$ = CYNew CYIdentifier("byte"); }
981 | "constructor" { $$ = CYNew CYIdentifier("constructor"); }
982 | "double" { $$ = CYNew CYIdentifier("double"); }
983 | "each" { $$ = CYNew CYIdentifier("each"); }
984 | "eval" { $$ = CYNew CYIdentifier("eval"); }
985 | "final" { $$ = CYNew CYIdentifier("final"); }
986 | "float" { $$ = CYNew CYIdentifier("float"); }
987 | "from" { $$ = CYNew CYIdentifier("from"); }
988 | "get" { $$ = CYNew CYIdentifier("get"); }
989 | "goto" { $$ = CYNew CYIdentifier("goto"); }
990 | "implements" { $$ = CYNew CYIdentifier("implements"); }
991 | "Infinity" { $$ = CYNew CYIdentifier("Infinity"); }
992 | "interface" { $$ = CYNew CYIdentifier("interface"); }
993 | "let" { $$ = CYNew CYIdentifier("let"); }
994 | "!let" LexBind LexOf { $$ = CYNew CYIdentifier("let"); }
995 | "native" { $$ = CYNew CYIdentifier("native"); }
996 | "package" { $$ = CYNew CYIdentifier("package"); }
997 | "private" { $$ = CYNew CYIdentifier("private"); }
998 | "protected" { $$ = CYNew CYIdentifier("protected"); }
999 | "__proto__" { $$ = CYNew CYIdentifier("__proto__"); }
1000 | "prototype" { $$ = CYNew CYIdentifier("prototype"); }
1001 | "public" { $$ = CYNew CYIdentifier("public"); }
1002 | "set" { $$ = CYNew CYIdentifier("set"); }
1003 | "synchronized" { $$ = CYNew CYIdentifier("synchronized"); }
1004 | "target" { $$ = CYNew CYIdentifier("target"); }
1005 | "throws" { $$ = CYNew CYIdentifier("throws"); }
1006 | "transient" { $$ = CYNew CYIdentifier("transient"); }
1007 | "typeid" { $$ = CYNew CYIdentifier("typeid"); }
1008 | "undefined" { $$ = CYNew CYIdentifier("undefined"); }
1010 | "bool" { $$ = CYNew CYIdentifier("bool"); }
1011 | "BOOL" { $$ = CYNew CYIdentifier("BOOL"); }
1012 | "id" { $$ = CYNew CYIdentifier("id"); }
1013 | "SEL" { $$ = CYNew CYIdentifier("SEL"); }
1018 : IdentifierTypeNoOf[pass] { $$ = $pass; }
1019 | "of" { $$ = CYNew CYIdentifier("of"); }
1023 : IdentifierType[pass] { $$ = $pass; }
1028 : IdentifierTypeNoOf
1029 | "char" { $$ = CYNew CYIdentifier("char"); }
1030 | "int" { $$ = CYNew CYIdentifier("int"); }
1031 | "__int128" { $$ = CYNew CYIdentifier("__int128"); }
1032 | "long" { $$ = CYNew CYIdentifier("long"); }
1033 | "__restrict" { $$ = CYNew CYIdentifier("__restrict"); }
1034 | "restrict" { $$ = CYNew CYIdentifier("restrict"); }
1035 | "short" { $$ = CYNew CYIdentifier("short"); }
1036 | "static" { $$ = CYNew CYIdentifier("static"); }
1037 | "volatile" { $$ = CYNew CYIdentifier("volatile"); }
1039 | "signed" { $$ = CYNew CYIdentifier("signed"); }
1040 | "unsigned" { $$ = CYNew CYIdentifier("unsigned"); }
1043 | "nil" { $$ = CYNew CYIdentifier("nil"); }
1044 | "NO" { $$ = CYNew CYIdentifier("NO"); }
1045 | "NULL" { $$ = CYNew CYIdentifier("NULL"); }
1046 | "YES" { $$ = CYNew CYIdentifier("YES"); }
1051 : IdentifierNoOf[pass] { $$ = $pass; }
1052 | "of" { $$ = CYNew CYIdentifier("of"); }
1053 | "!of" { $$ = CYNew CYIdentifier("of"); }
1056 /* 12.2 Primary Expression {{{ */
1058 : "this" { $$ = CYNew CYThis(); }
1059 | IdentifierReference[pass] { $$ = $pass; }
1060 | Literal[pass] { $$ = $pass; }
1061 | ArrayLiteral[pass] { $$ = $pass; }
1062 | ObjectLiteral[pass] { $$ = $pass; }
1063 | FunctionExpression[pass] { $$ = $pass; }
1064 | ClassExpression[pass] { $$ = $pass; }
1065 | GeneratorExpression[pass] { $$ = $pass; }
1066 | RegularExpressionLiteral[pass] { $$ = $pass; }
1067 | TemplateLiteral[pass] { $$ = $pass; }
1068 | CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) CYERR(@cover, "invalid parenthetical"); $$ = $cover; }
1069 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
1072 CoverParenthesizedExpressionAndArrowParameterList
1073 : "(" Expression[expression] ")" { $$ = CYNew CYParenthetical($expression); }
1074 | "(" LexOf ")" { $$ = NULL; }
1075 | "(" LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1076 | "(" Expression "," LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1079 /* 12.2.4 Literals {{{ */
1081 : NullLiteral[pass] { $$ = $pass; }
1082 | BooleanLiteral[pass] { $$ = $pass; }
1083 | NumericLiteral[pass] { $$ = $pass; }
1084 | StringLiteral[pass] { $$ = $pass; }
1087 /* 12.2.5 Array Initializer {{{ */
1089 : "[" ElementListOpt[elements] "]" { $$ = CYNew CYArray($elements); }
1093 : AssignmentExpression[value] { $$ = CYNew CYElementValue($value); }
1094 | LexOf "..." AssignmentExpression[values] { $$ = CYNew CYElementSpread($values); }
1098 : "," ElementListOpt[elements] { $$ = $elements; }
1103 : ArrayElement[element] ElementList_[next] { $$ = $element; $$->SetNext($next); }
1104 | LexOf "," ElementListOpt[next] { $$ = CYNew CYElementValue(NULL, $next); }
1108 : ElementList[pass] { $$ = $pass; }
1109 | LexOf { $$ = NULL; }
1112 /* 12.2.6 Object Initializer {{{ */
1114 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYObject($properties); }
1117 PropertyDefinitionList_
1118 : "," PropertyDefinitionListOpt[properties] { $$ = $properties; }
1122 PropertyDefinitionList
1123 : PropertyDefinition[property] PropertyDefinitionList_[next] { $property->SetNext($next); $$ = $property; }
1126 PropertyDefinitionListOpt
1127 : PropertyDefinitionList[properties] { $$ = $properties; }
1132 : IdentifierReference[value] { $$ = CYNew CYPropertyValue($value->name_, $value); }
1133 | CoverInitializedName[name] { CYNOT(@$); }
1134 | PropertyName[name] ":" AssignmentExpression[value] { $$ = CYNew CYPropertyValue($name, $value); }
1135 | MethodDefinition[pass] { $$ = $pass; }
1139 : LiteralPropertyName[pass] { $$ = $pass; }
1140 | ComputedPropertyName[pass] { $$ = $pass; }
1144 : IdentifierName[pass] { $$ = $pass; }
1145 | StringLiteral[pass] { $$ = $pass; }
1146 | NumericLiteral[pass] { $$ = $pass; }
1149 ComputedPropertyName
1150 : "[" AssignmentExpression[expression] "]" { $$ = CYNew CYComputed($expression); }
1153 CoverInitializedName
1154 : IdentifierReference Initializer
1158 : "=" AssignmentExpression[initializer] { $$ = $initializer; }
1162 : Initializer[pass] { $$ = $pass; }
1166 /* 12.2.9 Template Literals {{{ */
1168 : NoSubstitutionTemplate[string] { $$ = CYNew CYTemplate($string, NULL); }
1169 | TemplateHead[string] LexPushInOff TemplateSpans[spans] { $$ = CYNew CYTemplate($string, $spans); }
1173 : Expression[value] TemplateMiddle[string] TemplateSpans[spans] { $$ = CYNew CYSpan($value, $string, $spans); }
1174 | Expression[value] TemplateTail[string] LexPopIn { $$ = CYNew CYSpan($value, $string, NULL); }
1178 /* 12.3 Left-Hand-Side Expressions {{{ */
1180 : "[" Expression[property] "]" { $$ = CYNew CYDirectMember(NULL, $property); }
1181 | "." IdentifierName[property] { $$ = CYNew CYDirectMember(NULL, CYNew CYString($property)); }
1182 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
1183 | TemplateLiteral { CYNOT(@$); }
1187 : PrimaryExpression[pass] { $$ = $pass; }
1188 | MemberExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1189 | SuperProperty[pass] { $$ = $pass; }
1190 | MetaProperty { CYNOT(@$); }
1191 | "new" MemberExpression[constructor] Arguments[arguments] { $$ = CYNew cy::Syntax::New($constructor, $arguments); }
1195 : Super "[" Expression[property] "]" { $$ = CYNew CYSuperAccess($property); }
1196 | Super "." IdentifierName[property] { $$ = CYNew CYSuperAccess(CYNew CYString($property)); }
1204 : "new" "." "target"
1208 : MemberExpression[pass] { $$ = $pass; }
1209 | "new" NewExpression[expression] { $$ = CYNew cy::Syntax::New($expression, NULL); }
1213 : MemberExpression[pass] { $$ = $pass; }
1214 | CallExpression[pass] { $$ = $pass; }
1218 : CallExpression_[function] Arguments[arguments] { if (!$function->Eval()) $$ = CYNew CYCall($function, $arguments); else $$ = CYNew CYEval($arguments); }
1219 | SuperCall[pass] { $$ = $pass; }
1220 | CallExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1224 : Super Arguments[arguments] { $$ = CYNew CYSuperCall($arguments); }
1228 : "(" ArgumentListOpt[arguments] ")" { $$ = $arguments; }
1232 : "," ArgumentList[arguments] { $$ = $arguments; }
1237 : AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
1238 | LexOf "..." AssignmentExpression { CYNOT(@$); }
1242 : ArgumentList[pass] { $$ = $pass; }
1243 | LexOf { $$ = NULL; }
1247 : NewExpression[pass] { $$ = $pass; }
1248 | CallExpression[pass] { $$ = $pass; }
1251 LeftHandSideExpression
1252 : BracedExpression[pass] { $$ = $pass; }
1253 | IndirectExpression[pass] { $$ = $pass; }
1256 /* 12.4 Postfix Expressions {{{ */
1258 : BracedExpression[pass] { $$ = $pass; }
1259 | AccessExpression[lhs] LexNewLineOrOpt "++" { $$ = CYNew CYPostIncrement($lhs); }
1260 | AccessExpression[lhs] LexNewLineOrOpt "--" { $$ = CYNew CYPostDecrement($lhs); }
1263 /* 12.5 Unary Operators {{{ */
1265 : "delete" UnaryExpression[rhs] { $$ = CYNew CYDelete($rhs); }
1266 | "void" UnaryExpression[rhs] { $$ = CYNew CYVoid($rhs); }
1267 | "typeof" UnaryExpression[rhs] { $$ = CYNew CYTypeOf($rhs); }
1268 | "++" UnaryExpression[rhs] { $$ = CYNew CYPreIncrement($rhs); }
1269 | "--" UnaryExpression[rhs] { $$ = CYNew CYPreDecrement($rhs); }
1270 | "+" UnaryExpression[rhs] { $$ = CYNew CYAffirm($rhs); }
1271 | "-" UnaryExpression[rhs] { $$ = CYNew CYNegate($rhs); }
1272 | "~" UnaryExpression[rhs] { $$ = CYNew CYBitwiseNot($rhs); }
1273 | "!" UnaryExpression[rhs] { $$ = CYNew CYLogicalNot($rhs); }
1277 : PostfixExpression[expression] { $$ = $expression; }
1278 | UnaryExpression_[pass] { $$ = $pass; }
1281 /* 12.6 Multiplicative Operators {{{ */
1282 MultiplicativeExpression
1283 : UnaryExpression[pass] { $$ = $pass; }
1284 | MultiplicativeExpression[lhs] "*" UnaryExpression[rhs] { $$ = CYNew CYMultiply($lhs, $rhs); }
1285 | MultiplicativeExpression[lhs] "/" UnaryExpression[rhs] { $$ = CYNew CYDivide($lhs, $rhs); }
1286 | MultiplicativeExpression[lhs] "%" UnaryExpression[rhs] { $$ = CYNew CYModulus($lhs, $rhs); }
1289 /* 12.7 Additive Operators {{{ */
1291 : MultiplicativeExpression[pass] { $$ = $pass; }
1292 | AdditiveExpression[lhs] "+" MultiplicativeExpression[rhs] { $$ = CYNew CYAdd($lhs, $rhs); }
1293 | AdditiveExpression[lhs] "-" MultiplicativeExpression[rhs] { $$ = CYNew CYSubtract($lhs, $rhs); }
1296 /* 12.8 Bitwise Shift Operators {{{ */
1298 : AdditiveExpression[pass] { $$ = $pass; }
1299 | ShiftExpression[lhs] "<<" AdditiveExpression[rhs] { $$ = CYNew CYShiftLeft($lhs, $rhs); }
1300 | ShiftExpression[lhs] ">>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightSigned($lhs, $rhs); }
1301 | ShiftExpression[lhs] ">>>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightUnsigned($lhs, $rhs); }
1304 /* 12.9 Relational Operators {{{ */
1305 RelationalExpression
1306 : ShiftExpression[pass] { $$ = $pass; }
1307 | RelationalExpression[lhs] "<" ShiftExpression[rhs] { $$ = CYNew CYLess($lhs, $rhs); }
1308 | RelationalExpression[lhs] ">" ShiftExpression[rhs] { $$ = CYNew CYGreater($lhs, $rhs); }
1309 | RelationalExpression[lhs] "<=" ShiftExpression[rhs] { $$ = CYNew CYLessOrEqual($lhs, $rhs); }
1310 | RelationalExpression[lhs] ">=" ShiftExpression[rhs] { $$ = CYNew CYGreaterOrEqual($lhs, $rhs); }
1311 | RelationalExpression[lhs] "instanceof" ShiftExpression[rhs] { $$ = CYNew CYInstanceOf($lhs, $rhs); }
1312 | RelationalExpression[lhs] "in" ShiftExpression[rhs] { $$ = CYNew CYIn($lhs, $rhs); }
1315 /* 12.10 Equality Operators {{{ */
1317 : RelationalExpression[pass] { $$ = $pass; }
1318 | EqualityExpression[lhs] "==" RelationalExpression[rhs] { $$ = CYNew CYEqual($lhs, $rhs); }
1319 | EqualityExpression[lhs] "!=" RelationalExpression[rhs] { $$ = CYNew CYNotEqual($lhs, $rhs); }
1320 | EqualityExpression[lhs] "===" RelationalExpression[rhs] { $$ = CYNew CYIdentical($lhs, $rhs); }
1321 | EqualityExpression[lhs] "!==" RelationalExpression[rhs] { $$ = CYNew CYNotIdentical($lhs, $rhs); }
1324 /* 12.11 Binary Bitwise Operators {{{ */
1325 BitwiseANDExpression
1326 : EqualityExpression[pass] { $$ = $pass; }
1327 | BitwiseANDExpression[lhs] "&" EqualityExpression[rhs] { $$ = CYNew CYBitwiseAnd($lhs, $rhs); }
1330 BitwiseXORExpression
1331 : BitwiseANDExpression[pass] { $$ = $pass; }
1332 | BitwiseXORExpression[lhs] "^" BitwiseANDExpression[rhs] { $$ = CYNew CYBitwiseXOr($lhs, $rhs); }
1336 : BitwiseXORExpression[pass] { $$ = $pass; }
1337 | BitwiseORExpression[lhs] "|" BitwiseXORExpression[rhs] { $$ = CYNew CYBitwiseOr($lhs, $rhs); }
1340 /* 12.12 Binary Logical Operators {{{ */
1341 LogicalANDExpression
1342 : BitwiseORExpression[pass] { $$ = $pass; }
1343 | LogicalANDExpression[lhs] "&&" BitwiseORExpression[rhs] { $$ = CYNew CYLogicalAnd($lhs, $rhs); }
1347 : LogicalANDExpression[pass] { $$ = $pass; }
1348 | LogicalORExpression[lhs] "||" LogicalANDExpression[rhs] { $$ = CYNew CYLogicalOr($lhs, $rhs); }
1351 /* 12.13 Conditional Operator ( ? : ) {{{ */
1353 ConditionalExpressionClassic
1354 : LogicalORExpression[pass] { $$ = $pass; }
1355 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpressionClassic[false] { $$ = CYNew CYCondition($test, $true, $false); }
1359 ConditionalExpression
1360 : LogicalORExpression[pass] { $$ = $pass; }
1361 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpression[false] { $$ = CYNew CYCondition($test, $true, $false); }
1364 /* 12.14 Assignment Operators {{{ */
1365 LeftHandSideAssignment
1366 : LeftHandSideExpression[lhs] "=" { $$ = CYNew CYAssign($lhs, NULL); }
1367 | LeftHandSideExpression[lhs] "*=" { $$ = CYNew CYMultiplyAssign($lhs, NULL); }
1368 | LeftHandSideExpression[lhs] "/=" { $$ = CYNew CYDivideAssign($lhs, NULL); }
1369 | LeftHandSideExpression[lhs] "%=" { $$ = CYNew CYModulusAssign($lhs, NULL); }
1370 | LeftHandSideExpression[lhs] "+=" { $$ = CYNew CYAddAssign($lhs, NULL); }
1371 | LeftHandSideExpression[lhs] "-=" { $$ = CYNew CYSubtractAssign($lhs, NULL); }
1372 | LeftHandSideExpression[lhs] "<<=" { $$ = CYNew CYShiftLeftAssign($lhs, NULL); }
1373 | LeftHandSideExpression[lhs] ">>=" { $$ = CYNew CYShiftRightSignedAssign($lhs, NULL); }
1374 | LeftHandSideExpression[lhs] ">>>=" { $$ = CYNew CYShiftRightUnsignedAssign($lhs, NULL); }
1375 | LeftHandSideExpression[lhs] "&=" { $$ = CYNew CYBitwiseAndAssign($lhs, NULL); }
1376 | LeftHandSideExpression[lhs] "^=" { $$ = CYNew CYBitwiseXOrAssign($lhs, NULL); }
1377 | LeftHandSideExpression[lhs] "|=" { $$ = CYNew CYBitwiseOrAssign($lhs, NULL); }
1381 AssignmentExpressionClassic
1382 : LexOf ConditionalExpressionClassic[pass] { $$ = $pass; }
1383 | LexOf LeftHandSideAssignment[assignment] AssignmentExpressionClassic[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1387 AssignmentExpression
1388 : LexOf ConditionalExpression[pass] { $$ = $pass; }
1389 | LexOf YieldExpression[pass] { $$ = $pass; }
1390 | ArrowFunction[pass] { $$ = $pass; }
1391 | LexOf LeftHandSideAssignment[assignment] AssignmentExpression[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1394 /* 12.15 Comma Operator ( , ) {{{ */
1396 : AssignmentExpression[pass] { $$ = $pass; }
1397 | Expression[expression] "," AssignmentExpression[next] { $$ = CYNew CYCompound($expression, $next); }
1401 : Expression[pass] { $$ = $pass; }
1402 | LexOf { $$ = NULL; }
1406 /* 13 Statements and Declarations {{{ */
1408 : BlockStatement[pass] { $$ = $pass; }
1409 | VariableStatement[pass] { $$ = $pass; }
1410 | EmptyStatement[pass] { $$ = $pass; }
1411 | IfStatement[pass] { $$ = $pass; }
1412 | BreakableStatement[pass] { $$ = $pass; }
1413 | ContinueStatement[pass] { $$ = $pass; }
1414 | BreakStatement[pass] { $$ = $pass; }
1415 | ReturnStatement[pass] { $$ = $pass; }
1416 | WithStatement[pass] { $$ = $pass; }
1417 | LabelledStatement[pass] { $$ = $pass; }
1418 | ThrowStatement[pass] { $$ = $pass; }
1419 | TryStatement[pass] { $$ = $pass; }
1420 | DebuggerStatement[pass] { $$ = $pass; }
1424 : LexOf Statement__[pass] { $$ = $pass; }
1425 | ExpressionStatement[pass] { $$ = $pass; }
1429 : LexSetStatement LexLet Statement_[pass] { $$ = $pass; }
1433 : HoistableDeclaration[pass] { $$ = $pass; }
1434 | ClassDeclaration[pass] { $$ = $pass; }
1438 : LexSetStatement LexLet LexOf Declaration_[pass] { $$ = $pass; }
1439 | LexSetStatement LexicalDeclaration[pass] { $$ = $pass; }
1442 HoistableDeclaration
1443 : FunctionDeclaration[pass] { $$ = $pass; }
1444 | GeneratorDeclaration[pass] { $$ = $pass; }
1448 : IterationStatement[pass] { $$ = $pass; }
1449 | SwitchStatement[pass] { $$ = $pass; }
1452 /* 13.2 Block {{{ */
1454 : ";{" StatementListOpt[code] "}" { $$ = CYNew CYBlock($code); }
1458 : "{" StatementListOpt[code] "}" { $$ = $code; }
1462 : StatementListItem[statement] StatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1466 : StatementList[pass] { $$ = $pass; }
1467 | LexSetStatement LexLet LexOf { $$ = NULL; }
1471 : Statement[pass] { $$ = $pass; }
1472 | Declaration[pass] { $$ = $pass; }
1475 /* 13.3 Let and Const Declarations {{{ */
1477 : LetOrConst[constant] BindingList[bindings] { $$ = CYNew CYLexical($constant, $bindings); }
1481 : LexicalDeclaration_[statement] Terminator { $$ = $statement; }
1485 : { CYMAP(_let__, _let_); }
1489 : { CYMAP(_of__, _of_); }
1493 : { CYMAP(OpenBrace_let, OpenBrace); CYMAP(OpenBracket_let, OpenBracket); }
1497 : LexLet LexOf "!let" LexBind LexOf { $$ = false; }
1498 | LexLet LexOf "const" { $$ = true; }
1502 : "," LexBind BindingList[bindings] { $$ = $bindings; }
1507 : LexicalBinding[binding] BindingList_[next] { $$ = CYNew CYBindings($binding, $next); }
1511 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1512 | LexOf BindingPattern Initializer { CYNOT(@$); }
1515 /* 13.3.2 Variable Statement {{{ */
1517 : Var_ VariableDeclarationList[bindings] { $$ = CYNew CYVar($bindings); }
1521 : VariableStatement_[statement] Terminator { $$ = $statement; }
1524 VariableDeclarationList_
1525 : "," VariableDeclarationList[bindings] { $$ = $bindings; }
1529 VariableDeclarationList
1530 : LexBind VariableDeclaration[binding] VariableDeclarationList_[next] { $$ = CYNew CYBindings($binding, $next); }
1534 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1535 | LexOf BindingPattern Initializer { CYNOT(@$); }
1538 /* 13.3.3 Destructuring Binding Patterns {{{ */
1540 : ObjectBindingPattern
1541 | ArrayBindingPattern
1544 ObjectBindingPattern
1545 : "let {" BindingPropertyListOpt "}"
1549 : "let [" BindingElementListOpt "]"
1552 BindingPropertyList_
1553 : "," BindingPropertyListOpt
1558 : BindingProperty BindingPropertyList_
1561 BindingPropertyListOpt
1562 : BindingPropertyList
1567 : BindingElementOpt[element] "," BindingElementListOpt[next]
1568 | BindingRestElement[element]
1569 | BindingElement[element]
1572 BindingElementListOpt
1573 : BindingElementList[pass]
1579 | LexOf PropertyName ":" BindingElement
1583 : LexBind SingleNameBinding[pass] { $$ = $pass; }
1584 | LexBind LexOf BindingPattern InitializerOpt[initializer] { CYNOT(@$); }
1588 : BindingElement[pass]
1593 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1597 : LexBind LexOf "..." BindingIdentifier
1600 /* 13.4 Empty Statement {{{ */
1602 : ";" { $$ = CYNew CYEmpty(); }
1605 /* 13.5 Expression Statement {{{ */
1606 ExpressionStatement_
1607 : Expression[expression] { $$ = CYNew CYExpress($[expression]); }
1610 : ExpressionStatement_[statement] Terminator { $$ = $statement; }
1613 /* 13.6 The if Statement {{{ */
1615 : "else" Statement[false] { $$ = $false; }
1616 | %prec "if" { $$ = NULL; }
1620 : "if" "(" Expression[test] ")" Statement[true] ElseStatementOpt[false] { $$ = CYNew CYIf($test, $true, $false); }
1623 /* 13.7 Iteration Statements {{{ */
1625 : "do" Statement[code] "while" "(" Expression[test] ")" TerminatorOpt { $$ = CYNew CYDoWhile($test, $code); }
1626 | "while" "(" Expression[test] ")" Statement[code] { $$ = CYNew CYWhile($test, $code); }
1627 | "for" "(" LexPushInOn ForStatementInitializer[initializer] LexPopIn ExpressionOpt[test] ";" ExpressionOpt[increment] ")" Statement[code] { $$ = CYNew CYFor($initializer, $test, $increment, $code); }
1628 | "for" "(" LexPushInOn LexLet LexOf Var_ LexBind BindingIdentifier[identifier] Initializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForInitialized(CYNew CYBinding($identifier, $initializer), $iterable, $code); }
1629 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForIn($initializer, $iterable, $code); }
1630 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "of" LexPopIn AssignmentExpression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
1633 ForStatementInitializer
1634 : LexLet LexOf EmptyStatement[pass] { $$ = $pass; }
1635 | LexLet ExpressionStatement_[initializer] ";" { $$ = $initializer; }
1636 | LexLet LexOf VariableStatement_[initializer] ";" { $$ = $initializer; }
1637 | LexicalDeclaration_[initializer] ";" { $$ = $initializer; }
1640 ForInStatementInitializer
1641 : LexLet LexOf BracedExpression[pass] { $$ = $pass; }
1642 | LexLet LexOf IndirectExpression[pass] { $$ = $pass; }
1643 | LexLet LexOf Var_ LexBind ForBinding[binding] { $$ = CYNew CYForVariable($binding); }
1644 | ForDeclaration[pass] { $$ = $pass; }
1648 : LetOrConst[constant] ForBinding[binding] { $$ = CYNew CYForLexical($constant, $binding); }
1652 : BindingIdentifier[identifier] { $$ = CYNew CYBinding($identifier, NULL); }
1653 | LexOf BindingPattern { CYNOT(@$); }
1656 /* 13.8 The continue Statement {{{ */
1658 : "continue" TerminatorSoft { $$ = CYNew CYContinue(NULL); }
1659 | "continue" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYContinue($label); }
1662 /* 13.9 The break Statement {{{ */
1664 : "break" TerminatorSoft { $$ = CYNew CYBreak(NULL); }
1665 | "break" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYBreak($label); }
1668 /* 13.10 The return Statement {{{ */
1670 : Return TerminatorSoft { $$ = CYNew CYReturn(NULL); }
1671 | Return NewLineNot Expression[value] Terminator { $$ = CYNew CYReturn($value); }
1674 /* 13.11 The with Statement {{{ */
1676 : "with" "(" Expression[scope] ")" Statement[code] { $$ = CYNew CYWith($scope, $code); }
1679 /* 13.12 The switch Statement {{{ */
1681 : "switch" "(" Expression[value] ")" CaseBlock[clauses] { $$ = CYNew CYSwitch($value, $clauses); }
1685 : "{" CaseClausesOpt[clauses] "}" { $$ = $clauses; }
1689 : "case" Expression[value] ":" StatementListOpt[code] { $$ = CYNew CYClause($value, $code); }
1693 : CaseClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1694 | DefaultClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1698 // XXX: the standard makes certain you can only have one of these
1700 : "default" ":" StatementListOpt[code] { $$ = CYNew CYClause(NULL, $code); }
1703 /* 13.13 Labelled Statements {{{ */
1705 : LabelIdentifier[name] ":" LabelledItem[statement] { $$ = CYNew CYLabel($name, $statement); }
1709 : Statement[pass] { $$ = $pass; }
1710 | LexSetStatement LexLet LexOf FunctionDeclaration[pass] { $$ = $pass; }
1713 /* 13.14 The throw Statement {{{ */
1715 : "throw"[throw] TerminatorSoft { CYERR(@throw, "throw without exception"); }
1716 | "throw" NewLineNot Expression[value] Terminator { $$ = CYNew cy::Syntax::Throw($value); }
1719 /* 13.15 The try Statement {{{ */
1721 : "try" Block[code] Catch[catch] { $$ = CYNew cy::Syntax::Try($code, $catch, NULL); }
1722 | "try" Block[code] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, NULL, $finally); }
1723 | "try" Block[code] Catch[catch] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, $catch, $finally); }
1727 : "catch" "(" LexBind CatchParameter[name] ")" Block[code] { $$ = CYNew cy::Syntax::Catch($name, $code); }
1731 : "finally" Block[code] { $$ = CYNew CYFinally($code); }
1735 : BindingIdentifier[pass] { $$ = $pass; }
1736 | LexOf BindingPattern { CYNOT(@$); }
1739 /* 13.16 The debugger Statement {{{ */
1741 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1745 /* 14.1 Function Definitions {{{ */
1747 : ";function" BindingIdentifier[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionStatement($name, $parameters, $code); }
1751 : "function" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionExpression($name, $parameters, $code); }
1754 StrictFormalParameters
1755 : FormalParameters[pass] { $$ = $pass; }
1759 : LexBind LexOf { $$ = NULL; }
1760 | FormalParameterList
1763 FormalParameterList_
1764 : "," FormalParameterList[parameters] { $$ = $parameters; }
1769 : FunctionRestParameter { CYNOT(@$); }
1770 | FormalParameter[binding] FormalParameterList_[next] { $$ = CYNew CYFunctionParameter($binding, $next); }
1773 FunctionRestParameter
1774 : BindingRestElement
1778 : BindingElement[pass] { $$ = $pass; }
1782 : LexPushYieldOff FunctionStatementList[code] LexPopYield { $$ = $code; }
1785 FunctionStatementList
1786 : LexPushReturnOn StatementListOpt[code] LexPopReturn { $$ = $code; }
1789 /* 14.2 Arrow Function Definitions {{{ */
1791 : ArrowParameters[parameters] LexNewLineOrOpt "=>" LexNoBrace ConciseBody[code] { $$ = CYNew CYFatArrow($parameters, $code); }
1795 : BindingIdentifier[identifier] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier)); }
1796 | LexOf CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) $$ = NULL; else { $$ = $cover->expression_->Parameter(); if ($$ == NULL) CYERR(@cover, "invalid parameter list"); } }
1800 : AssignmentExpression[expression] { $$ = CYNew CYReturn($expression); }
1801 | LexOf ";{" FunctionBody[code] "}" { $$ = $code; }
1804 /* 14.3 Method Definitions {{{ */
1806 : PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyMethod($name, $parameters, $code); }
1807 | GeneratorMethod[pass] { $$ = $pass; }
1808 | "get" PropertyName[name] "(" ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyGetter($name, $code); }
1809 | "set" PropertyName[name] "(" PropertySetParameterList[parameter] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertySetter($name, $parameter, $code); }
1812 PropertySetParameterList
1813 : FormalParameter[binding] { $$ = CYNew CYFunctionParameter($binding); }
1816 /* 14.4 Generator Function Definitions {{{ */
1818 : "*" PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorMethod($name, $parameters, $code); */ }
1821 GeneratorDeclaration
1822 : ";function" LexOf "*" BindingIdentifier[name] "(" FormalParameters[code] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorStatement($name, $parameters, $code); */ }
1826 : "function" LexOf "*" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorExpression($name, $parameters, $code); */ }
1830 : LexPushYieldOn FunctionStatementList[code] LexPopYield { $$ = $code; }
1834 : "!yield" LexNewLineOrNot "\n" LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ }
1835 | "!yield" LexNewLineOrNot "" LexNoStar LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ } %prec "!yield"
1836 | "!yield" LexNewLineOrNot "" LexNoStar AssignmentExpression[value] { CYNOT(@$); /* $$ = CYNew CYYieldValue($value); */ }
1837 | "!yield" LexNewLineOrNot "" LexNoStar LexOf "yield *" AssignmentExpression[generator] { CYNOT(@$); /* $$ = CYNew CYYieldGenerator($generator); */ }
1840 /* 14.5 Class Definitions {{{ */
1842 : ";class" BindingIdentifier[name] ClassTail[tail] { $$ = CYNew CYClassStatement($name, $tail); }
1846 : "class" BindingIdentifierOpt[name] ClassTail[tail] { $$ = CYNew CYClassExpression($name, $tail); }
1850 : ClassHeritageOpt[tail] { driver.class_.push($tail); } "{" LexPushSuperOn ClassBodyOpt "}" LexPopSuper { driver.class_.pop(); $$ = $tail; }
1854 : "extends" AccessExpression[extends] { $$ = CYNew CYClassTail($extends); }
1858 : ClassHeritage[pass] { $$ = $pass; }
1859 | { $$ = CYNew CYClassTail(NULL); }
1872 : ClassElementListOpt ClassElement
1881 : MethodDefinition[method] { if (CYFunctionExpression *constructor = $method->Constructor()) driver.class_.top()->constructor_ = constructor; else driver.class_.top()->instance_->*$method; }
1882 | "static" MethodDefinition[method] { driver.class_.top()->static_->*$method; }
1887 /* 15.1 Scripts {{{ */
1889 : ScriptBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1893 : StatementList[pass] { $$ = $pass; }
1897 : ScriptBody[pass] { $$ = $pass; }
1898 | LexSetStatement LexLet LexOf { $$ = NULL; }
1901 /* 15.2 Modules {{{ */
1903 : ModuleBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1907 : ModuleItemList[pass] { $$ = $pass; }
1911 : ModuleBody[pass] { $$ = $pass; }
1912 | LexSetStatement LexLet LexOf { $$ = NULL; }
1916 : ModuleItem[statement] ModuleItemListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1920 : ModuleItemList[pass] { $$ = $pass; }
1921 | LexSetStatement LexLet LexOf { $$ = NULL; }
1925 : LexSetStatement LexLet LexOf ImportDeclaration[pass] { $$ = $pass; }
1926 | LexSetStatement LexLet LexOf ExportDeclaration { CYNOT(@$); }
1927 | StatementListItem[pass] { $$ = $pass; }
1930 /* 15.2.2 Imports {{{ */
1932 : "import" ImportClause[specifiers] FromClause[module] Terminator { $$ = CYNew CYImportDeclaration($specifiers, $module); }
1933 | "import" LexOf ModuleSpecifier[module] Terminator { $$ = CYNew CYImportDeclaration(NULL, $module); }
1937 : ImportedDefaultBinding[default] { $$ = $default; }
1938 | LexOf NameSpaceImport[pass] { $$ = $pass; }
1939 | LexOf NamedImports[pass] { $$ = $pass; }
1940 | ImportedDefaultBinding[default] "," NameSpaceImport[next] { $$ = $default; CYSetLast($$) = $next; }
1941 | ImportedDefaultBinding[default] "," NamedImports[next] { $$ = $default; CYSetLast($$) = $next; }
1944 ImportedDefaultBinding
1945 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(CYNew CYIdentifier("default"), $binding); }
1949 : "*" "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(NULL, $binding); }
1953 : "{" ImportsListOpt[pass] "}" { $$ = $pass; }
1957 : "from" ModuleSpecifier[pass] { $$ = $pass; }
1961 : "," ImportsListOpt[pass] { $$ = $pass; }
1966 : ImportSpecifier[import] ImportsList_[next] { $$ = $import; CYSetLast($$) = $next; }
1970 : ImportsList[pass] { $$ = $pass; }
1971 | LexOf { $$ = NULL; }
1975 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($binding, $binding); }
1976 | LexOf IdentifierName[name] "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($name, $binding); }
1980 : StringLiteral[pass] { $$ = $pass; }
1984 : BindingIdentifier[pass] { $$ = $pass; }
1987 /* 15.2.3 Exports {{{ */
1989 : "*" FromClause Terminator
1990 | ExportClause FromClause Terminator
1991 | ExportClause Terminator
1993 | "default" LexSetStatement LexOf HoistableDeclaration
1994 | "default" LexSetStatement LexOf ClassDeclaration
1995 | "default" LexSetStatement AssignmentExpression Terminator
1999 : "export" LexSetStatement LexLet LexOf ExportDeclaration_
2000 | "export" Declaration
2004 : ";{" ExportsListOpt "}"
2008 : "," ExportsListOpt
2013 : ExportSpecifier ExportsList_
2023 | IdentifierName "as" IdentifierName
2028 /* Cycript (C): Type Encoding {{{ */
2030 : IdentifierType[identifier] { $$ = CYNew CYTypedIdentifier(@identifier, $identifier); }
2031 | "(" "*" TypeQualifierRightOpt[typed] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2035 : { $$ = CYNew CYTypedIdentifier(@$); }
2039 : TypeSignifier[pass] { $$ = $pass; }
2040 | TypeSignifierNone[pass] { $$ = $pass; }
2057 ParameterModifierOpt
2063 : TypedParameterListOpt[formal] ")" ParameterModifierOpt { $$ = CYNew CYTypeFunctionWith($formal->variadic_, $formal->parameters_); }
2067 : SuffixedTypeOpt[typed] "[" RestrictOpt NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
2068 | "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameters[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
2069 | TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2070 | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedIdentifier(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2074 : SuffixedType[pass] { $$ = $pass; }
2075 | TypeSignifierOpt[pass] { $$ = $pass; }
2079 : "*" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2083 : "const" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeConstant(); }
2084 | "volatile" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeVolatile(); }
2087 TypeQualifierLeftOpt
2088 : TypeQualifierLeft[pass] { $$ = $pass; }
2093 : SuffixedType[pass] { $$ = $pass; }
2094 | PrefixedType[pass] { $$ = $pass; }
2095 | "const" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
2096 | "volatile" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
2097 | Restrict TypeQualifierRightOpt[typed] { $$ = $typed; }
2100 TypeQualifierRightOpt
2101 : TypeQualifierRight[pass] { $$ = $pass; }
2102 | TypeSignifierOpt[pass] { $$ = $pass; }
2106 : "int" { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2107 | "unsigned" IntegerTypeOpt[integral] { $$ = $integral->Unsigned(); if ($$ == NULL) CYERR(@1, "incompatible unsigned"); }
2108 | "signed" IntegerTypeOpt[integral] { $$ = $integral->Signed(); if ($$ == NULL) CYERR(@1, "incompatible signed"); }
2109 | "long" IntegerTypeOpt[integral] { $$ = $integral->Long(); if ($$ == NULL) CYERR(@1, "incompatible long"); }
2110 | "short" IntegerTypeOpt[integral] { $$ = $integral->Short(); if ($$ == NULL) CYERR(@1, "incompatible short"); }
2114 : IntegerType[pass] { $$ = $pass; }
2115 | { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2119 : TypedIdentifierField[typed] ";" StructFieldListOpt[next] { $$ = CYNew CYTypeStructField($typed, $next); }
2124 : NumericLiteral[pass] { $$ = $pass; }
2125 | "-" NumericLiteral[positive] { $$ = $positive; $$->value_ = -$$->value_; }
2128 EnumConstantListOpt_
2129 : "," EnumConstantListOpt[pass] { $$ = $pass; }
2134 : IdentifierType[name] "=" IntegerNumber[value] EnumConstantListOpt_[next] { $$ = CYNew CYEnumConstant($name, $value, $next); }
2139 : { $$ = CYTypeNeutral; }
2140 | "signed" { $$ = CYTypeSigned; }
2141 | "unsigned" { $$ = CYTypeUnsigned; }
2145 : IdentifierType[name] { $$ = CYNew CYTypeVariable($name); }
2146 | IntegerType[pass] { $$ = $pass; }
2147 | TypeSigning[signing] "char" { $$ = CYNew CYTypeCharacter($signing); }
2148 | TypeSigning[signing] "__int128" { $$ = CYNew CYTypeInt128($signing); }
2152 : PrimitiveType[pass] { $$ = $pass; }
2153 | "struct" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); }
2154 | "enum" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceEnum, $name); }
2155 | "struct" AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2156 | "enum" AutoComplete { driver.mode_ = CYDriver::AutoEnum; YYACCEPT; }
2159 TypedIdentifierMaybe
2160 : TypeQualifierLeft[modifier] "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2161 | "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2162 | TypeQualifierLeftOpt[modifier] PrimitiveReference[specifier] TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = $specifier; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2166 : TypedIdentifierMaybe[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2170 : TypedIdentifierMaybe[typed] { if ($typed->identifier_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2173 TypedIdentifierTagged
2174 : TypeQualifierLeftOpt[modifier] "struct" "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeStruct(NULL, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2175 | TypeQualifierLeftOpt[modifier] "enum" ":" PrimitiveType[specifier] "{" EnumConstantListOpt[constants] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeEnum(NULL, $specifier, $constants); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2178 TypedIdentifierField
2179 : TypedIdentifierYes[pass] { $$ = $pass; }
2180 | TypedIdentifierTagged[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2183 TypedIdentifierEncoding
2184 : TypedIdentifierNo[pass] { $$ = $pass; }
2185 | TypedIdentifierTagged[typed] { if ($typed->identifier_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2186 | "void" TypeSignifierNone[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2189 TypedIdentifierDefinition
2190 : TypedIdentifierYes[pass] { $$ = $pass; }
2191 | TypeQualifierLeftOpt[modifier] "struct" IdentifierTypeOpt[name] "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; $$->specifier_ = CYNew CYTypeStruct($name, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2192 | "void" TypeSignifier[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2196 : "@encode" "(" TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYEncodedType($typed); }
2202 /* Cycript (Objective-C): @class Declaration {{{ */
2204 /* XXX: why the hell did I choose MemberExpression? */
2205 : ":" MemberExpression[extends] { $$ = $extends; }
2209 ImplementationFieldListOpt
2210 : TypedIdentifierField[typed] ";" ImplementationFieldListOpt[next] { $$ = CYNew CYImplementationField($typed, $next); }
2215 : "+" { $$ = false; }
2216 | "-" { $$ = true; }
2220 : "(" TypedIdentifierNo[type] ")" { $$ = $type; }
2221 | { $$ = CYNew CYTypedIdentifier(CYNew CYTypeVariable("id")); }
2225 : Word[tag] ":" TypeOpt[type] BindingIdentifier[identifier] { $type->identifier_ = $identifier; $$ = CYNew CYMessageParameter($tag, $type); }
2228 MessageParameterList
2229 : MessageParameter[parameter] MessageParameterListOpt[next] { $parameter->SetNext($next); $$ = $parameter; }
2232 MessageParameterListOpt
2233 : MessageParameterList[pass] { $$ = $pass; }
2234 | TypedParameterList_[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); /*XXX*/ if ($formal->parameters_ != NULL) CYERR(@$, "temporarily unsupported"); $$ = NULL; }
2238 : MessageParameterList[pass] { $$ = $pass; }
2239 | Word[tag] { $$ = CYNew CYMessageParameter($tag, NULL); }
2242 ClassMessageDeclaration
2243 : MessageScope[instance] TypeOpt[type] MessageParameters[parameters] "{" LexPushSuperOn FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYMessage($instance, $type, $parameters, $code); }
2246 ClassMessageDeclarationListOpt
2247 : ClassMessageDeclarationListOpt[next] ClassMessageDeclaration[message] { $message->SetNext($next); $$ = $message; }
2251 // XXX: this should be AssignmentExpressionNoRight
2253 : ShiftExpression[name] ClassProtocolsOpt[next] { $$ = CYNew CYProtocol($name, $next); }
2257 : "," ClassProtocols[protocols] { $$ = $protocols; }
2261 ClassProtocolListOpt
2262 : "<" ClassProtocols[protocols] ">" { $$ = $protocols; }
2266 ImplementationStatement
2267 : "@implementation" Identifier[name] ClassSuperOpt[extends] ClassProtocolListOpt[protocols] "{" ImplementationFieldListOpt[fields] "}" ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYImplementation($name, $extends, $protocols, $fields, $messages); }
2275 : "@implementation" Identifier[name] CategoryName ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYCategory($name, $messages); }
2279 : ImplementationStatement[pass] { $$ = $pass; }
2280 | CategoryStatement[pass] { $$ = $pass; }
2283 /* Cycript (Objective-C): Send Message {{{ */
2285 : "," AssignmentExpressionClassic[value] VariadicCall[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
2290 : WordOpt[name] { driver.contexts_.back().words_.push_back($name); } { $$ = $name; }
2291 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
2295 : SelectorCall[pass] { $$ = $pass; }
2296 | VariadicCall[pass] { $$ = $pass; }
2300 : SelectorWordOpt[name] ":" AssignmentExpressionClassic[value] SelectorCall_[next] { $$ = CYNew CYArgument($name ?: CYNew CYWord(""), $value, $next); }
2304 : SelectorCall[pass] { $$ = $pass; }
2305 | Word[name] { $$ = CYNew CYArgument($name, NULL); }
2309 : "[" AssignmentExpressionClassic[self] { driver.contexts_.push_back($self); } SelectorList[arguments] "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($self, $arguments); }
2310 | "[" LexOf "super" { driver.context_ = NULL; } SelectorList[arguments] "]" { $$ = CYNew CYSendSuper($arguments); }
2314 : WordOpt[name] ":" SelectorExpressionOpt[next] { $$ = CYNew CYSelectorPart($name, true, $next); }
2318 : SelectorExpression_[pass] { $$ = $pass; }
2319 | Word[name] { $$ = CYNew CYSelectorPart($name, false, NULL); }
2322 SelectorExpressionOpt
2323 : SelectorExpression_[pass] { $$ = $pass; }
2328 : MessageExpression[pass] { $$ = $pass; }
2329 | "@selector" "(" SelectorExpression[parts] ")" { $$ = CYNew CYSelector($parts); }
2334 /* Cycript: @import Directive {{{ */
2336 : ModulePath[next] "." Word[part] { $$ = CYNew CYModule($part, $next); }
2337 | Word[part] { $$ = CYNew CYModule($part); }
2341 : "@import" ModulePath[path] { $$ = CYNew CYImport($path); }
2346 /* Cycript (Objective-C): Boxed Expressions {{{ */
2348 : NullLiteral[pass] { $$ = $pass; }
2349 | BooleanLiteral[pass] { $$ = $pass; }
2350 | NumericLiteral[pass] { $$ = $pass; }
2351 | StringLiteral[pass] { $$ = $pass; }
2352 | CoverParenthesizedExpressionAndArrowParameterList[pass] { $$ = $pass; }
2353 | "YES" { $$ = CYNew CYTrue(); }
2354 | "NO" { $$ = CYNew CYFalse(); }
2358 : "," KeyValuePairListOpt[next] { $$ = $next; }
2362 : AssignmentExpression[key] ":" AssignmentExpression[value] KeyValuePairList_[next] { $$ = CYNew CYObjCKeyValue($key, $value, $next); }
2366 : KeyValuePairList[pass] { $$ = $pass; }
2367 | LexOf { $$ = NULL; }
2371 : "@" BoxableExpression[expression] { $$ = CYNew CYBox($expression); }
2372 | "@" "[" ElementListOpt[elements] "]" { $$ = CYNew CYObjCArray($elements); }
2373 | "@" "{" KeyValuePairListOpt[pairs] "}" { $$ = CYNew CYObjCDictionary($pairs); }
2375 | "@YES" { $$ = CYNew CYBox(CYNew CYTrue()); }
2376 | "@NO" { $$ = CYNew CYBox(CYNew CYFalse()); }
2377 | "@true" { $$ = CYNew CYBox(CYNew CYTrue()); }
2378 | "@false" { $$ = CYNew CYBox(CYNew CYFalse()); }
2379 | "@null" { $$ = CYNew CYBox(CYNew CYNull()); }
2382 /* Cycript (Objective-C): Block Expressions {{{ */
2384 : "^" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { if (CYTypeFunctionWith *function = $type->Function()) $$ = CYNew CYObjCBlock($type, function->parameters_, $code); else CYERR($type->location_, "expected parameters"); }
2387 /* Cycript (Objective-C): Instance Literals {{{ */
2389 : "#" NumericLiteral[address] { $$ = CYNew CYInstanceLiteral($address); }
2395 /* Cycript (C): Pointer Indirection/Addressing {{{ */
2397 : IndirectExpression[pass] { $$ = $pass; }
2401 : "*" UnaryExpression[rhs] { $$ = CYNew CYIndirect($rhs); }
2405 : "&" UnaryExpression[rhs] { $$ = CYNew CYAddressOf($rhs); }
2409 : "->" "[" Expression[property] "]" { $$ = CYNew CYIndirectMember(NULL, $property); }
2410 | "->" IdentifierName[property] { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($property)); }
2411 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
2414 /* Cycript (C): Lambda Expressions {{{ */
2416 : "," TypedParameterList[parameters] { $$ = $parameters; }
2417 | { $$ = CYNew CYTypedFormal(false); }
2421 : TypedIdentifierMaybe[typed] TypedParameterList_[formal] { $$ = $formal; $$->parameters_ = CYNew CYTypedParameter($typed, $$->parameters_); }
2422 | "..." { $$ = CYNew CYTypedFormal(true); }
2425 TypedParameterListOpt
2426 : TypedParameterList[pass] { $$ = $pass; }
2427 | "void" { $$ = CYNew CYTypedFormal(false); }
2428 | { $$ = CYNew CYTypedFormal(false); }
2432 : TypedParameterListOpt[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); $$ = $formal->parameters_; }
2436 : "[" LexOf "&" "]" "(" TypedParameters[parameters] ")" "->" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { $$ = CYNew CYLambda($type, $parameters, $code); }
2439 /* Cycript (C): Structure Definitions {{{ */
2441 : "struct" NewLineOpt { $$ = CYNew CYIdentifier("struct"); }
2445 : "struct" NewLineNot IdentifierType[name] "{" StructFieldListOpt[fields] "}" { $$ = CYNew CYStructDefinition($name, CYNew CYStructTail($fields)); }
2449 : "(" LexOf "struct" NewLineOpt IdentifierType[name] TypeQualifierRightOpt[typed] ")" { $typed->specifier_ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); $$ = CYNew CYTypeExpression($typed); }
2450 | "(" LexOf "struct" NewLineOpt AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2453 /* Cycript (C): Type Definitions {{{ */
2455 : "typedef" NewLineOpt { $$ = CYNew CYIdentifier("typedef"); }
2459 : "typedef" NewLineNot TypedIdentifierDefinition[typed] TerminatorHard { $$ = CYNew CYTypeDefinition($typed); }
2463 : TypeDefinition[pass] { $$ = $pass; }
2467 : "(" LexOf "typedef" NewLineOpt TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYTypeExpression($typed); }
2470 /* Cycript (C): extern "C" {{{ */
2472 : "extern" NewLineOpt { $$ = CYNew CYIdentifier("extern"); }
2476 : TypedIdentifierField[typed] TerminatorHard { $$ = CYNew CYExternalDefinition(CYNew CYString("C"), $typed); }
2477 | TypeDefinition[pass] { $$ = $pass; }
2480 ExternCStatementListOpt
2481 : ExternCStatement[statement] ExternCStatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
2486 : "{" ExternCStatementListOpt[pass] "}" { $$ = $pass; }
2487 | ExternCStatement[pass] { $$ = $pass; }
2491 : StringLiteral[abi] { if (strcmp($abi->Value(), "C") != 0) CYERR(@abi, "unknown extern binding"); }
2495 : "extern" NewLineNot ABI[abi] ExternC[pass] { $$ = $pass; }
2499 : "(" LexOf "extern" NewLineOpt ABI[abi] TypedIdentifierField[typed] ")" { $$ = CYNew CYExternalExpression(CYNew CYString("C"), $typed); }
2505 /* Lexer State {{{ */
2507 : { driver.PushCondition(CYDriver::RegExpCondition); }
2511 : { driver.PushCondition(CYDriver::XMLContentCondition); }
2515 : { driver.PushCondition(CYDriver::XMLTagCondition); }
2519 : { driver.PopCondition(); }
2523 : { driver.SetCondition(CYDriver::XMLContentCondition); }
2527 : { driver.SetCondition(CYDriver::XMLTagCondition); }
2530 /* Virtual Tokens {{{ */
2537 /* 8.1 Context Keywords {{{ */
2539 : "namespace" { $$ = CYNew CYIdentifier("namespace"); }
2540 | "xml" { $$ = CYNew CYIdentifier("xml"); }
2543 /* 8.3 XML Initializer Input Elements {{{ */
2545 : XMLComment { $$ = $1; }
2546 | XMLCDATA { $$ = $1; }
2547 | XMLPI { $$ = $1; }
2551 /* 11.1 Primary Expressions {{{ */
2553 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
2554 | XMLInitilizer { $$ = $1; }
2555 | XMLListInitilizer { $$ = $1; }
2559 : AttributeIdentifier { $$ = $1; }
2560 | QualifiedIdentifier { $$ = $1; }
2561 | WildcardIdentifier { $$ = $1; }
2564 /* 11.1.1 Attribute Identifiers {{{ */
2566 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
2570 : PropertySelector { $$ = $1; }
2571 | "[" Expression "]" { $$ = CYNew CYSelector($2); }
2575 : Identifier { $$ = CYNew CYSelector($1); }
2576 | WildcardIdentifier { $$ = $1; }
2579 /* 11.1.2 Qualified Identifiers {{{ */
2580 QualifiedIdentifier_
2581 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
2582 | QualifiedIdentifier { $$ = $1; }
2586 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
2589 /* 11.1.3 Wildcard Identifiers {{{ */
2591 : "*" { $$ = CYNew CYWildcard(); }
2594 /* 11.1.4 XML Initializer {{{ */
2596 : XMLMarkup { $$ = $1; }
2597 | XMLElement { $$ = $1; }
2601 : "<" LexPushInOff XMLTagContent LexPop "/>" LexPopIn
2602 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop ">" LexPopIn
2606 : LexPushXMLTag XMLTagName XMLAttributes
2610 : "{" LexPushRegExp Expression LexPop "}"
2619 : XMLAttributes_ XMLAttribute
2624 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
2625 | XMLAttributes_ XMLWhitespaceOpt
2634 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
2638 : XMLExpression XMLElementContentOpt
2639 | XMLMarkup XMLElementContentOpt
2640 | XMLText XMLElementContentOpt
2641 | XMLElement XMLElementContentOpt
2644 XMLElementContentOpt
2649 /* 11.1.5 XMLList Initializer {{{ */
2651 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop "</>" LexPopIn { $$ = CYNew CYXMLList($4); }
2655 /* 11.2 Left-Hand-Side Expressions {{{ */
2657 : Identifier { $$ = $1; }
2658 | PropertyIdentifier { $$ = $1; }
2662 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
2663 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
2664 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
2667 /* 12.1 The default xml namespace Statement {{{ */
2668 /* XXX: DefaultXMLNamespaceStatement
2669 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
2673 : DefaultXMLNamespaceStatement { $$ = $1; }
2678 /* JavaScript FTL: Array Comprehensions {{{ */
2680 : AssignmentExpression[expression] ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2684 : "for" "each" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2687 /* JavaScript FTL: for each {{{ */
2689 : "for" "each" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
2693 /* JavaScript FTW: Array Comprehensions {{{ */
2695 : ArrayComprehension
2699 : "[" Comprehension[comprehension] "]" { $$ = $comprehension; }
2703 : LexOf ComprehensionFor[comprehension] ComprehensionTail[next] AssignmentExpression[expression] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2708 | ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2709 | ComprehensionIf[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2713 : "for" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForInComprehension($binding, $iterable); }
2714 | "for" "(" LexPushInOn LexBind ForBinding[binding] "of" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2718 : "if" "(" AssignmentExpression[test] ")" { $$ = CYNew CYIfComprehension($test); }
2721 /* JavaScript FTW: Named Arguments {{{ */
2723 : LexOf WordNoUnary[tag] ":" AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument($tag, $value, $next); }
2726 /* JavaScript FTW: Subscript Access {{{ */
2728 : "." "[" AssignmentExpression[property] "]" { $$ = CYNew CYSubscriptMember(NULL, $property); }
2732 /* JavaScript FTW: Java "Anonymous Inner Classes" {{{ */
2734 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYExtend(NULL, $properties); }
2738 /* JavaScript FTW: Ruby Blocks {{{ */
2739 RubyProcParameterList_
2740 : "," RubyProcParameterList[parameters] { $$ = $parameters; }
2744 RubyProcParameterList
2745 : BindingIdentifier[identifier] RubyProcParameterList_[next] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier), $next); }
2746 | LexOf { $$ = NULL; }
2750 : "|" RubyProcParameterList[parameters] "|" { $$ = $parameters; }
2751 | "||" { $$ = NULL; }
2754 RubyProcParametersOpt
2755 : RubyProcParameters[pass] { $$ = $pass; }
2760 : ";{" RubyProcParametersOpt[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyBlock(NULL, CYNew CYRubyProc($parameters, $code)); }
2764 : "{" RubyProcParameters[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyProc($parameters, $code); }
2768 : AccessExpression[pass] LexNewLineOrOpt { $$ = $pass; }
2769 | BracedExpression_[lhs] { if (!$lhs->IsNew()) CYMAP(OpenBrace_, OpenBrace); } BracedParameter[rhs] LexNewLineOrOpt { $rhs->SetLeft($lhs); $$ = $rhs; }
2773 : BracedExpression_[pass] "\n" { $$ = $pass; }
2774 | BracedExpression_[pass] { $$ = $pass; }
2777 /* JavaScript FTW: Ruby Scopes {{{ */
2779 : "::" "[" Expression[property] "]" { $$ = CYNew CYResolveMember(NULL, $property); }
2780 | "::" IdentifierName[property] { $$ = CYNew CYResolveMember(NULL, CYNew CYString($property)); }
2781 | "::" AutoComplete { driver.mode_ = CYDriver::AutoResolve; YYACCEPT; }
2784 /* JavaScript FTW: Ruby Symbols {{{ */
2786 : ":" Word[name] { $$ = CYNew CYSymbol($name->Word()); }
2792 bool CYDriver::Parse(CYMark mark) {
2794 CYLocal<CYPool> local(&pool_);
2795 cy::parser parser(*this);
2797 parser.set_debug_level(debug_);
2799 return parser.parse() != 0;
2802 void CYDriver::Warning(const cy::parser::location_type &location, const char *message) {
2806 CYDriver::Error error;
2807 error.warning_ = true;
2808 error.location_ = location;
2809 error.message_ = message;
2810 errors_.push_back(error);
2813 void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
2814 CYDriver::Error error;
2815 error.warning_ = false;
2816 error.location_ = location;
2817 error.message_ = message;
2818 driver.errors_.push_back(error);