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);
237 %define api.location.type { CYLocation }
244 %param { CYDriver &driver }
246 /* Token Declarations {{{ */
252 %token XMLAttributeValue
254 %token XMLTagCharacters
260 %token LeftRight "<>"
261 %token LeftSlashRight "</>"
263 %token SlashRight "/>"
264 %token LeftSlash "</"
266 %token PeriodPeriod ".."
269 @begin E4X ObjectiveC
274 %token AmpersandAmpersand "&&"
275 %token AmpersandEqual "&="
277 %token CarrotEqual "^="
279 %token EqualEqual "=="
280 %token EqualEqualEqual "==="
281 %token EqualRight "=>"
282 %token Exclamation "!"
283 %token ExclamationEqual "!="
284 %token ExclamationEqualEqual "!=="
286 %token HyphenEqual "-="
287 %token HyphenHyphen "--"
288 %token HyphenRight "->"
290 %token LeftEqual "<="
292 %token LeftLeftEqual "<<="
294 %token PercentEqual "%="
296 %token PeriodPeriodPeriod "..."
298 %token PipeEqual "|="
301 %token PlusEqual "+="
304 %token RightEqual ">="
305 %token RightRight ">>"
306 %token RightRightEqual ">>="
307 %token RightRightRight ">>>"
308 %token RightRightRightEqual ">>>="
310 %token SlashEqual "/="
312 %token StarEqual "*="
316 %token ColonColon "::"
327 %token CloseParen ")"
330 %token OpenBrace_ ";{"
331 %token OpenBrace_let "let {"
332 %token CloseBrace "}"
334 %token OpenBracket "["
335 %token OpenBracket_let "let ["
336 %token CloseBracket "]"
338 %token At_error_ "@error"
341 %token At_class_ "@class"
345 %token _typedef_ "typedef"
346 %token _unsigned_ "unsigned"
347 %token _signed_ "signed"
348 %token _struct_ "struct"
349 %token _extern_ "extern"
353 %token At_encode_ "@encode"
357 %token At_implementation_ "@implementation"
358 %token At_import_ "@import"
359 %token At_end_ "@end"
360 %token At_selector_ "@selector"
361 %token At_null_ "@null"
362 %token At_YES_ "@YES"
364 %token At_true_ "@true"
365 %token At_false_ "@false"
370 %token _false_ "false"
375 %token _break_ "break"
377 %token _catch_ "catch"
378 %token _class_ "class"
379 %token _class__ ";class"
380 %token _const_ "const"
381 %token _continue_ "continue"
382 %token _debugger_ "debugger"
383 %token _default_ "default"
384 %token _delete_ "delete"
388 %token _export_ "export"
389 %token _extends_ "extends"
390 %token _finally_ "finally"
392 %token _function_ "function"
393 %token _function__ ";function"
395 %token _import_ "import"
398 %token _Infinity_ "Infinity"
399 %token _instanceof_ "instanceof"
401 %token _return_ "return"
402 %token _super_ "super"
403 %token _switch_ "switch"
404 %token _target_ "target"
406 %token _throw_ "throw"
408 %token _typeof_ "typeof"
411 %token _while_ "while"
414 %token _abstract_ "abstract"
415 %token _await_ "await"
416 %token _boolean_ "boolean"
419 %token _constructor_ "constructor"
420 %token _double_ "double"
422 %token _final_ "final"
423 %token _float_ "float"
427 %token _implements_ "implements"
429 %token ___int128_ "__int128"
430 %token _interface_ "interface"
434 %token _native_ "native"
435 %token _package_ "package"
436 %token _private_ "private"
437 %token _protected_ "protected"
438 %token ___proto___ "__proto__"
439 %token _prototype_ "prototype"
440 %token _public_ "public"
441 %token ___restrict_ "__restrict"
442 %token _restrict_ "restrict"
444 %token _short_ "short"
445 %token _static_ "static"
446 %token _synchronized_ "synchronized"
447 %token _throws_ "throws"
448 %token _transient_ "transient"
449 %token _typeid_ "typeid"
450 %token _volatile_ "volatile"
451 %token _yield_ "yield"
452 %token _yield__ "!yield"
454 %token _undefined_ "undefined"
470 %token _namespace_ "namespace"
475 %token YieldStar "yield *"
477 %token <identifier_> Identifier_
478 %token <number_> NumericLiteral
479 %token <string_> StringLiteral
480 %token <literal_> RegularExpressionLiteral_
482 %token <string_> NoSubstitutionTemplate
483 %token <string_> TemplateHead
484 %token <string_> TemplateMiddle
485 %token <string_> TemplateTail
487 %type <target_> AccessExpression
488 %type <expression_> AdditiveExpression
489 %type <argument_> ArgumentList_
490 %type <argument_> ArgumentList
491 %type <argument_> ArgumentListOpt
492 %type <argument_> Arguments
493 %type <target_> ArrayComprehension
494 %type <element_> ArrayElement
495 %type <literal_> ArrayLiteral
496 %type <expression_> ArrowFunction
497 %type <functionParameter_> ArrowParameters
498 %type <expression_> AssignmentExpression
499 %type <identifier_> BindingIdentifier
500 %type <identifier_> BindingIdentifierOpt
501 %type <bindings_> BindingList_
502 %type <bindings_> BindingList
503 %type <expression_> BitwiseANDExpression
504 %type <statement_> Block
505 %type <statement_> BlockStatement
506 %type <boolean_> BooleanLiteral
507 %type <binding_> BindingElement
508 %type <expression_> BitwiseORExpression
509 %type <expression_> BitwiseXORExpression
510 %type <target_> BracedExpression_
511 %type <target_> BracedExpression
512 %type <statement_> BreakStatement
513 %type <statement_> BreakableStatement
514 %type <expression_> CallExpression_
515 %type <target_> CallExpression
516 %type <clause_> CaseBlock
517 %type <clause_> CaseClause
518 %type <clause_> CaseClausesOpt
520 %type <identifier_> CatchParameter
521 %type <statement_> ClassDeclaration
522 %type <target_> ClassExpression
523 %type <classTail_> ClassHeritage
524 %type <classTail_> ClassHeritageOpt
525 %type <classTail_> ClassTail
526 %type <target_> Comprehension
527 %type <comprehension_> ComprehensionFor
528 %type <comprehension_> ComprehensionIf
529 %type <comprehension_> ComprehensionTail
530 %type <propertyName_> ComputedPropertyName
531 %type <expression_> ConditionalExpression
532 %type <statement_> ContinueStatement
533 %type <statement_> ConciseBody
534 %type <parenthetical_> CoverParenthesizedExpressionAndArrowParameterList
535 %type <statement_> DebuggerStatement
536 %type <statement_> Declaration_
537 %type <statement_> Declaration
538 %type <clause_> DefaultClause
539 %type <element_> ElementList_
540 %type <element_> ElementList
541 %type <element_> ElementListOpt
542 %type <statement_> ElseStatementOpt
543 %type <for_> EmptyStatement
544 %type <expression_> EqualityExpression
545 %type <expression_> Expression
546 %type <expression_> ExpressionOpt
547 %type <for_> ExpressionStatement_
548 %type <statement_> ExpressionStatement
549 %type <statement_> ExternC
550 %type <statement_> ExternCStatement
551 %type <statement_> ExternCStatementListOpt
552 %type <finally_> Finally
553 %type <binding_> ForBinding
554 %type <forin_> ForDeclaration
555 %type <forin_> ForInStatementInitializer
556 %type <for_> ForStatementInitializer
557 %type <binding_> FormalParameter
558 %type <functionParameter_> FormalParameterList_
559 %type <functionParameter_> FormalParameterList
560 %type <functionParameter_> FormalParameters
561 %type <string_> FromClause
562 %type <statement_> FunctionBody
563 %type <statement_> FunctionDeclaration
564 %type <target_> FunctionExpression
565 %type <statement_> FunctionStatementList
566 %type <statement_> GeneratorBody
567 %type <statement_> GeneratorDeclaration
568 %type <target_> GeneratorExpression
569 %type <method_> GeneratorMethod
570 %type <statement_> HoistableDeclaration
571 %type <identifier_> Identifier
572 %type <identifier_> IdentifierNoOf
573 %type <identifier_> IdentifierType
574 %type <identifier_> IdentifierTypeNoOf
575 %type <identifier_> IdentifierTypeOpt
576 %type <word_> IdentifierName
577 %type <variable_> IdentifierReference
578 %type <statement_> IfStatement
579 %type <import_> ImportClause
580 %type <statement_> ImportDeclaration
581 %type <import_> ImportSpecifier
582 %type <identifier_> ImportedBinding
583 %type <import_> ImportedDefaultBinding
584 %type <import_> ImportsList_
585 %type <import_> ImportsList
586 %type <import_> ImportsListOpt
587 %type <target_> IndirectExpression
588 %type <expression_> Initializer
589 %type <expression_> InitializerOpt
590 %type <statement_> IterationStatement
591 %type <identifier_> LabelIdentifier
592 %type <statement_> LabelledItem
593 %type <statement_> LabelledStatement
594 %type <assignment_> LeftHandSideAssignment
595 %type <target_> LeftHandSideExpression
596 %type <bool_> LetOrConst
597 %type <binding_> LexicalBinding
598 %type <for_> LexicalDeclaration_
599 %type <statement_> LexicalDeclaration
600 %type <literal_> Literal
601 %type <propertyName_> LiteralPropertyName
602 %type <expression_> LogicalANDExpression
603 %type <expression_> LogicalORExpression
604 %type <access_> MemberAccess
605 %type <target_> MemberExpression
606 %type <method_> MethodDefinition
607 %type <statement_> ModuleBody
608 %type <statement_> ModuleBodyOpt
609 %type <statement_> ModuleItem
610 %type <statement_> ModuleItemList
611 %type <statement_> ModuleItemListOpt
612 %type <module_> ModulePath
613 %type <string_> ModuleSpecifier
614 %type <expression_> MultiplicativeExpression
615 %type <import_> NameSpaceImport
616 %type <import_> NamedImports
617 %type <target_> NewExpression
618 %type <null_> NullLiteral
619 %type <literal_> ObjectLiteral
620 %type <expression_> PostfixExpression
621 %type <target_> PrimaryExpression
622 %type <propertyName_> PropertyName
623 %type <property_> PropertyDefinition
624 %type <property_> PropertyDefinitionList_
625 %type <property_> PropertyDefinitionList
626 %type <property_> PropertyDefinitionListOpt
627 %type <functionParameter_> PropertySetParameterList
628 %type <literal_> RegularExpressionLiteral
629 %type <bool_> RegularExpressionSlash
630 %type <expression_> RelationalExpression
631 %type <statement_> ReturnStatement
632 %type <braced_> BracedParameter
633 %type <functionParameter_> RubyProcParameterList_
634 %type <functionParameter_> RubyProcParameterList
635 %type <functionParameter_> RubyProcParameters
636 %type <functionParameter_> RubyProcParametersOpt
637 %type <statement_> Script
638 %type <statement_> ScriptBody
639 %type <statement_> ScriptBodyOpt
640 %type <expression_> ShiftExpression
641 %type <binding_> SingleNameBinding
642 %type <statement_> Statement__
643 %type <statement_> Statement_
644 %type <statement_> Statement
645 %type <statement_> StatementList
646 %type <statement_> StatementListOpt
647 %type <statement_> StatementListItem
648 %type <functionParameter_> StrictFormalParameters
649 %type <target_> SuperCall
650 %type <target_> SuperProperty
651 %type <statement_> SwitchStatement
652 %type <target_> TemplateLiteral
653 %type <span_> TemplateSpans
654 %type <statement_> ThrowStatement
655 %type <statement_> TryStatement
656 %type <statement_> TypeDefinition
657 %type <expression_> UnaryExpression_
658 %type <expression_> UnaryExpression
659 %type <binding_> VariableDeclaration
660 %type <bindings_> VariableDeclarationList_
661 %type <bindings_> VariableDeclarationList
662 %type <for_> VariableStatement_
663 %type <statement_> VariableStatement
664 %type <statement_> WithStatement
666 %type <word_> WordNoUnary
668 %type <word_> WordOpt
670 %type <expression_> YieldExpression
673 %type <constant_> EnumConstantListOpt_
674 %type <constant_> EnumConstantListOpt
675 %type <number_> IntegerNumber
676 %type <integral_> IntegerType
677 %type <integral_> IntegerTypeOpt
678 %type <typedIdentifier_> PrefixedType
679 %type <specifier_> PrimitiveReference
680 %type <specifier_> PrimitiveType
681 %type <structField_> StructFieldListOpt
682 %type <typedIdentifier_> SuffixedType
683 %type <typedIdentifier_> SuffixedTypeOpt
684 %type <typedIdentifier_> TypeSignifier
685 %type <typedIdentifier_> TypeSignifierNone
686 %type <typedIdentifier_> TypeSignifierOpt
687 %type <signing_> TypeSigning
688 %type <modifier_> ParameterTail
689 %type <modifier_> TypeQualifierLeft
690 %type <modifier_> TypeQualifierLeftOpt
691 %type <typedIdentifier_> TypeQualifierRight
692 %type <typedIdentifier_> TypeQualifierRightOpt
693 %type <typedIdentifier_> TypedIdentifierDefinition
694 %type <typedIdentifier_> TypedIdentifierEncoding
695 %type <typedIdentifier_> TypedIdentifierField
696 %type <typedIdentifier_> TypedIdentifierMaybe
697 %type <typedIdentifier_> TypedIdentifierNo
698 %type <typedIdentifier_> TypedIdentifierTagged
699 %type <typedIdentifier_> TypedIdentifierYes
700 %type <typedFormal_> TypedParameterList_
701 %type <typedFormal_> TypedParameterList
702 %type <typedFormal_> TypedParameterListOpt
703 %type <typedParameter_> TypedParameters
707 %type <expression_> AssignmentExpressionClassic
708 %type <expression_> BoxableExpression
709 %type <statement_> CategoryStatement
710 %type <expression_> ClassSuperOpt
711 %type <expression_> ConditionalExpressionClassic
712 %type <message_> ClassMessageDeclaration
713 %type <message_> ClassMessageDeclarationListOpt
714 %type <protocol_> ClassProtocolListOpt
715 %type <protocol_> ClassProtocols
716 %type <protocol_> ClassProtocolsOpt
717 %type <implementationField_> ImplementationFieldListOpt
718 %type <statement_> ImplementationStatement
719 %type <keyValue_> KeyValuePairList_
720 %type <keyValue_> KeyValuePairList
721 %type <keyValue_> KeyValuePairListOpt
722 %type <target_> MessageExpression
723 %type <messageParameter_> MessageParameter
724 %type <messageParameter_> MessageParameters
725 %type <messageParameter_> MessageParameterList
726 %type <messageParameter_> MessageParameterListOpt
727 %type <bool_> MessageScope
728 %type <argument_> SelectorCall_
729 %type <argument_> SelectorCall
730 %type <selector_> SelectorExpression_
731 %type <selector_> SelectorExpression
732 %type <selector_> SelectorExpressionOpt
733 %type <argument_> SelectorList
734 %type <word_> SelectorWordOpt
735 %type <typedIdentifier_> TypeOpt
736 %type <argument_> VariadicCall
740 %type <propertyIdentifier_> PropertyIdentifier_
741 %type <selector_> PropertySelector_
742 %type <selector_> PropertySelector
743 %type <identifier_> QualifiedIdentifier_
744 %type <identifier_> QualifiedIdentifier
745 %type <identifier_> WildcardIdentifier
746 %type <identifier_> XMLComment
747 %type <identifier_> XMLCDATA
748 %type <identifier_> XMLElement
749 %type <identifier_> XMLElementContent
750 %type <identifier_> XMLMarkup
751 %type <identifier_> XMLPI
753 %type <attribute_> AttributeIdentifier
754 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
755 %type <expression_> PropertyIdentifier
756 %type <expression_> XMLListInitilizer
757 %type <expression_> XMLInitilizer
760 /* Token Priorities {{{ */
779 /* Lexer State {{{ */
780 LexPushInOn: { driver.in_.push(true); };
781 LexPushInOff: { driver.in_.push(false); };
782 LexPopIn: { driver.in_.pop(); };
784 LexPushReturnOn: { driver.return_.push(true); };
785 LexPopReturn: { driver.return_.pop(); };
786 Return: "return"[return] { if (!driver.return_.top()) CYERR(@return, "invalid return"); };
788 LexPushSuperOn: { driver.super_.push(true); };
789 LexPushSuperOff: { driver.super_.push(false); };
790 LexPopSuper: { driver.super_.pop(); };
791 Super: "super"[super] { if (!driver.super_.top()) CYERR(@super, "invalid super"); };
793 LexPushYieldOn: { driver.yield_.push(true); };
794 LexPushYieldOff: { driver.yield_.push(false); };
795 LexPopYield: { driver.yield_.pop(); };
798 : { CYLEX(); if (driver.newline_) { CYHLD(@$, tk::NewLine); } }
802 : { CYLEX(); CYHLD(@$, driver.newline_ ? tk::NewLine : tk::__); }
806 : { CYMAP(YieldStar, Star); }
810 : { CYMAP(OpenBrace_, OpenBrace); }
814 : { CYMAP(_class__, _class_); }
818 : { CYMAP(_function__, _function_); }
822 : LexNoBrace LexNoClass LexNoFunction
825 /* Virtual Tokens {{{ */
831 /* 11.6 Names and Keywords {{{ */
833 : Word[pass] { $$ = $pass; }
834 | "for" { $$ = CYNew CYWord("for"); }
835 | "in" { $$ = CYNew CYWord("in"); }
836 | "instanceof" { $$ = CYNew CYWord("instanceof"); }
840 : IdentifierNoOf[pass] { $$ = $pass; }
841 | "break" { $$ = CYNew CYWord("break"); }
842 | "case" { $$ = CYNew CYWord("case"); }
843 | "catch" { $$ = CYNew CYWord("catch"); }
844 | "class" LexOf { $$ = CYNew CYWord("class"); }
845 | ";class" { $$ = CYNew CYWord("class"); }
846 | "const" { $$ = CYNew CYWord("const"); }
847 | "continue" { $$ = CYNew CYWord("continue"); }
848 | "debugger" { $$ = CYNew CYWord("debugger"); }
849 | "default" { $$ = CYNew CYWord("default"); }
850 | "do" { $$ = CYNew CYWord("do"); }
851 | "else" { $$ = CYNew CYWord("else"); }
852 | "enum" { $$ = CYNew CYWord("enum"); }
853 | "export" { $$ = CYNew CYWord("export"); }
854 | "extends" { $$ = CYNew CYWord("extends"); }
855 | "false" { $$ = CYNew CYWord("false"); }
856 | "finally" { $$ = CYNew CYWord("finally"); }
857 | "function" LexOf { $$ = CYNew CYWord("function"); }
858 | "if" { $$ = CYNew CYWord("if"); }
859 | "import" { $$ = CYNew CYWord("import"); }
860 | "!in" { $$ = CYNew CYWord("in"); }
861 | "!of" { $$ = CYNew CYWord("of"); }
862 | "null" { $$ = CYNew CYWord("null"); }
863 | "return" { $$ = CYNew CYWord("return"); }
864 | "super" { $$ = CYNew CYWord("super"); }
865 | "switch" { $$ = CYNew CYWord("switch"); }
866 | "this" { $$ = CYNew CYWord("this"); }
867 | "throw" { $$ = CYNew CYWord("throw"); }
868 | "true" { $$ = CYNew CYWord("true"); }
869 | "try" { $$ = CYNew CYWord("try"); }
870 | "var" { $$ = CYNew CYWord("var"); }
871 | "while" { $$ = CYNew CYWord("while"); }
872 | "with" { $$ = CYNew CYWord("with"); }
876 : WordNoUnary[pass] { $$ = $pass; }
877 | "delete" { $$ = CYNew CYWord("delete"); }
878 | "typeof" { $$ = CYNew CYWord("typeof"); }
879 | "void" { $$ = CYNew CYWord("void"); }
880 | "yield" { $$ = CYNew CYIdentifier("yield"); }
885 : Word[pass] { $$ = $pass; }
890 /* 11.8.1 Null Literals {{{ */
892 : "null" { $$ = CYNew CYNull(); }
895 /* 11.8.2 Boolean Literals {{{ */
897 : "true" { $$ = CYNew CYTrue(); }
898 | "false" { $$ = CYNew CYFalse(); }
901 /* 11.8.5 Regular Expression Literals {{{ */
902 RegularExpressionSlash
903 : "/" { $$ = false; }
904 | "/=" { $$ = true; }
907 RegularExpressionLiteral
908 : RegularExpressionSlash[equals] { CYMPT(@$); driver.SetRegEx($equals); } RegularExpressionLiteral_[pass] { $$ = $pass; }
912 /* 11.9 Automatic Semicolon Insertion {{{ */
914 : { driver.Warning(@$, "warning, automatic semi-colon insertion required"); }
922 : LexNewLineOrNot "\n"
927 : LexNewLineOrNot "\n" StrictSemi
928 | NewLineNot LexOf Terminator
933 | error { if (yyla.type_get() != yyeof_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
938 | error { if (yyla.type_get() != yyeof_ && yyla.type != yytranslate_(token::CloseBrace) && !driver.newline_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
943 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
947 /* 12.1 Identifiers {{{ */
949 : Identifier[pass] { $$ = CYNew CYVariable($pass); }
950 | "yield" { $$ = CYNew CYVariable(CYNew CYIdentifier("yield")); }
954 : LexOf IdentifierNoOf[pass] { $$ = $pass; }
955 | LexOf "!of" { $$ = CYNew CYIdentifier("of"); }
956 | LexOf "yield" { $$ = CYNew CYIdentifier("yield"); }
960 : BindingIdentifier[pass] { $$ = $pass; }
961 | LexOf { $$ = NULL; }
965 : Identifier[pass] { $$ = $pass; }
966 | "yield" { $$ = CYNew CYIdentifier("yield"); }
970 : Identifier_[pass] { $$ = $pass; }
971 | "abstract" { $$ = CYNew CYIdentifier("abstract"); }
972 | "as" { $$ = CYNew CYIdentifier("as"); }
973 | "await" { $$ = CYNew CYIdentifier("await"); }
974 | "boolean" { $$ = CYNew CYIdentifier("boolean"); }
975 | "byte" { $$ = CYNew CYIdentifier("byte"); }
976 | "constructor" { $$ = CYNew CYIdentifier("constructor"); }
977 | "double" { $$ = CYNew CYIdentifier("double"); }
978 | "each" { $$ = CYNew CYIdentifier("each"); }
979 | "eval" { $$ = CYNew CYIdentifier("eval"); }
980 | "final" { $$ = CYNew CYIdentifier("final"); }
981 | "float" { $$ = CYNew CYIdentifier("float"); }
982 | "from" { $$ = CYNew CYIdentifier("from"); }
983 | "get" { $$ = CYNew CYIdentifier("get"); }
984 | "goto" { $$ = CYNew CYIdentifier("goto"); }
985 | "implements" { $$ = CYNew CYIdentifier("implements"); }
986 | "Infinity" { $$ = CYNew CYIdentifier("Infinity"); }
987 | "interface" { $$ = CYNew CYIdentifier("interface"); }
988 | "let" { $$ = CYNew CYIdentifier("let"); }
989 | "!let" LexBind LexOf { $$ = CYNew CYIdentifier("let"); }
990 | "native" { $$ = CYNew CYIdentifier("native"); }
991 | "package" { $$ = CYNew CYIdentifier("package"); }
992 | "private" { $$ = CYNew CYIdentifier("private"); }
993 | "protected" { $$ = CYNew CYIdentifier("protected"); }
994 | "__proto__" { $$ = CYNew CYIdentifier("__proto__"); }
995 | "prototype" { $$ = CYNew CYIdentifier("prototype"); }
996 | "public" { $$ = CYNew CYIdentifier("public"); }
997 | "set" { $$ = CYNew CYIdentifier("set"); }
998 | "synchronized" { $$ = CYNew CYIdentifier("synchronized"); }
999 | "target" { $$ = CYNew CYIdentifier("target"); }
1000 | "throws" { $$ = CYNew CYIdentifier("throws"); }
1001 | "transient" { $$ = CYNew CYIdentifier("transient"); }
1002 | "typeid" { $$ = CYNew CYIdentifier("typeid"); }
1003 | "undefined" { $$ = CYNew CYIdentifier("undefined"); }
1005 | "bool" { $$ = CYNew CYIdentifier("bool"); }
1006 | "BOOL" { $$ = CYNew CYIdentifier("BOOL"); }
1007 | "id" { $$ = CYNew CYIdentifier("id"); }
1008 | "SEL" { $$ = CYNew CYIdentifier("SEL"); }
1013 : IdentifierTypeNoOf[pass] { $$ = $pass; }
1014 | "of" { $$ = CYNew CYIdentifier("of"); }
1018 : IdentifierType[pass] { $$ = $pass; }
1023 : IdentifierTypeNoOf
1024 | "char" { $$ = CYNew CYIdentifier("char"); }
1025 | "int" { $$ = CYNew CYIdentifier("int"); }
1026 | "__int128" { $$ = CYNew CYIdentifier("__int128"); }
1027 | "long" { $$ = CYNew CYIdentifier("long"); }
1028 | "__restrict" { $$ = CYNew CYIdentifier("__restrict"); }
1029 | "restrict" { $$ = CYNew CYIdentifier("restrict"); }
1030 | "short" { $$ = CYNew CYIdentifier("short"); }
1031 | "static" { $$ = CYNew CYIdentifier("static"); }
1032 | "volatile" { $$ = CYNew CYIdentifier("volatile"); }
1034 | "signed" { $$ = CYNew CYIdentifier("signed"); }
1035 | "unsigned" { $$ = CYNew CYIdentifier("unsigned"); }
1038 | "nil" { $$ = CYNew CYIdentifier("nil"); }
1039 | "NO" { $$ = CYNew CYIdentifier("NO"); }
1040 | "NULL" { $$ = CYNew CYIdentifier("NULL"); }
1041 | "YES" { $$ = CYNew CYIdentifier("YES"); }
1046 : IdentifierNoOf[pass] { $$ = $pass; }
1047 | "of" { $$ = CYNew CYIdentifier("of"); }
1048 | "!of" { $$ = CYNew CYIdentifier("of"); }
1051 /* 12.2 Primary Expression {{{ */
1053 : "this" { $$ = CYNew CYThis(); }
1054 | IdentifierReference[pass] { $$ = $pass; }
1055 | Literal[pass] { $$ = $pass; }
1056 | ArrayLiteral[pass] { $$ = $pass; }
1057 | ObjectLiteral[pass] { $$ = $pass; }
1058 | FunctionExpression[pass] { $$ = $pass; }
1059 | ClassExpression[pass] { $$ = $pass; }
1060 | GeneratorExpression[pass] { $$ = $pass; }
1061 | RegularExpressionLiteral[pass] { $$ = $pass; }
1062 | TemplateLiteral[pass] { $$ = $pass; }
1063 | CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) CYERR(@cover, "invalid parenthetical"); $$ = $cover; }
1064 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
1067 CoverParenthesizedExpressionAndArrowParameterList
1068 : "(" Expression[expression] ")" { $$ = CYNew CYParenthetical($expression); }
1069 | "(" LexOf ")" { $$ = NULL; }
1070 | "(" LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1071 | "(" Expression "," LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1074 /* 12.2.4 Literals {{{ */
1076 : NullLiteral[pass] { $$ = $pass; }
1077 | BooleanLiteral[pass] { $$ = $pass; }
1078 | NumericLiteral[pass] { $$ = $pass; }
1079 | StringLiteral[pass] { $$ = $pass; }
1082 /* 12.2.5 Array Initializer {{{ */
1084 : "[" ElementListOpt[elements] "]" { $$ = CYNew CYArray($elements); }
1088 : AssignmentExpression[value] { $$ = CYNew CYElementValue($value); }
1089 | LexOf "..." AssignmentExpression[values] { $$ = CYNew CYElementSpread($values); }
1093 : "," ElementListOpt[elements] { $$ = $elements; }
1098 : ArrayElement[element] ElementList_[next] { $$ = $element; $$->SetNext($next); }
1099 | LexOf "," ElementListOpt[next] { $$ = CYNew CYElementValue(NULL, $next); }
1103 : ElementList[pass] { $$ = $pass; }
1104 | LexOf { $$ = NULL; }
1107 /* 12.2.6 Object Initializer {{{ */
1109 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYObject($properties); }
1112 PropertyDefinitionList_
1113 : "," PropertyDefinitionListOpt[properties] { $$ = $properties; }
1117 PropertyDefinitionList
1118 : PropertyDefinition[property] PropertyDefinitionList_[next] { $property->SetNext($next); $$ = $property; }
1121 PropertyDefinitionListOpt
1122 : PropertyDefinitionList[properties] { $$ = $properties; }
1127 : IdentifierReference[value] { $$ = CYNew CYPropertyValue($value->name_, $value); }
1128 | CoverInitializedName[name] { CYNOT(@$); }
1129 | PropertyName[name] ":" AssignmentExpression[value] { $$ = CYNew CYPropertyValue($name, $value); }
1130 | MethodDefinition[pass] { $$ = $pass; }
1134 : LiteralPropertyName[pass] { $$ = $pass; }
1135 | ComputedPropertyName[pass] { $$ = $pass; }
1139 : IdentifierName[pass] { $$ = $pass; }
1140 | StringLiteral[pass] { $$ = $pass; }
1141 | NumericLiteral[pass] { $$ = $pass; }
1144 ComputedPropertyName
1145 : "[" AssignmentExpression[expression] "]" { $$ = CYNew CYComputed($expression); }
1148 CoverInitializedName
1149 : IdentifierReference Initializer
1153 : "=" AssignmentExpression[initializer] { $$ = $initializer; }
1157 : Initializer[pass] { $$ = $pass; }
1161 /* 12.2.9 Template Literals {{{ */
1163 : NoSubstitutionTemplate[string] { $$ = CYNew CYTemplate($string, NULL); }
1164 | TemplateHead[string] LexPushInOff TemplateSpans[spans] { $$ = CYNew CYTemplate($string, $spans); }
1168 : Expression[value] TemplateMiddle[string] TemplateSpans[spans] { $$ = CYNew CYSpan($value, $string, $spans); }
1169 | Expression[value] TemplateTail[string] LexPopIn { $$ = CYNew CYSpan($value, $string, NULL); }
1173 /* 12.3 Left-Hand-Side Expressions {{{ */
1175 : "[" Expression[property] "]" { $$ = CYNew CYDirectMember(NULL, $property); }
1176 | "." IdentifierName[property] { $$ = CYNew CYDirectMember(NULL, CYNew CYString($property)); }
1177 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
1178 | TemplateLiteral { CYNOT(@$); }
1182 : PrimaryExpression[pass] { $$ = $pass; }
1183 | MemberExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1184 | SuperProperty[pass] { $$ = $pass; }
1185 | MetaProperty { CYNOT(@$); }
1186 | "new" MemberExpression[constructor] Arguments[arguments] { $$ = CYNew cy::Syntax::New($constructor, $arguments); }
1190 : Super "[" Expression[property] "]" { $$ = CYNew CYSuperAccess($property); }
1191 | Super "." IdentifierName[property] { $$ = CYNew CYSuperAccess(CYNew CYString($property)); }
1199 : "new" "." "target"
1203 : MemberExpression[pass] { $$ = $pass; }
1204 | "new" NewExpression[expression] { $$ = CYNew cy::Syntax::New($expression, NULL); }
1208 : MemberExpression[pass] { $$ = $pass; }
1209 | CallExpression[pass] { $$ = $pass; }
1213 : CallExpression_[function] Arguments[arguments] { if (!$function->Eval()) $$ = CYNew CYCall($function, $arguments); else $$ = CYNew CYEval($arguments); }
1214 | SuperCall[pass] { $$ = $pass; }
1215 | CallExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1219 : Super Arguments[arguments] { $$ = CYNew CYSuperCall($arguments); }
1223 : "(" ArgumentListOpt[arguments] ")" { $$ = $arguments; }
1227 : "," ArgumentList[arguments] { $$ = $arguments; }
1232 : AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
1233 | LexOf "..." AssignmentExpression { CYNOT(@$); }
1237 : ArgumentList[pass] { $$ = $pass; }
1238 | LexOf { $$ = NULL; }
1242 : NewExpression[pass] { $$ = $pass; }
1243 | CallExpression[pass] { $$ = $pass; }
1246 LeftHandSideExpression
1247 : BracedExpression[pass] { $$ = $pass; }
1248 | IndirectExpression[pass] { $$ = $pass; }
1251 /* 12.4 Postfix Expressions {{{ */
1253 : BracedExpression[pass] { $$ = $pass; }
1254 | AccessExpression[lhs] LexNewLineOrOpt "++" { $$ = CYNew CYPostIncrement($lhs); }
1255 | AccessExpression[lhs] LexNewLineOrOpt "--" { $$ = CYNew CYPostDecrement($lhs); }
1258 /* 12.5 Unary Operators {{{ */
1260 : "delete" UnaryExpression[rhs] { $$ = CYNew CYDelete($rhs); }
1261 | "void" UnaryExpression[rhs] { $$ = CYNew CYVoid($rhs); }
1262 | "typeof" UnaryExpression[rhs] { $$ = CYNew CYTypeOf($rhs); }
1263 | "++" UnaryExpression[rhs] { $$ = CYNew CYPreIncrement($rhs); }
1264 | "--" UnaryExpression[rhs] { $$ = CYNew CYPreDecrement($rhs); }
1265 | "+" UnaryExpression[rhs] { $$ = CYNew CYAffirm($rhs); }
1266 | "-" UnaryExpression[rhs] { $$ = CYNew CYNegate($rhs); }
1267 | "~" UnaryExpression[rhs] { $$ = CYNew CYBitwiseNot($rhs); }
1268 | "!" UnaryExpression[rhs] { $$ = CYNew CYLogicalNot($rhs); }
1272 : PostfixExpression[expression] { $$ = $expression; }
1273 | UnaryExpression_[pass] { $$ = $pass; }
1276 /* 12.6 Multiplicative Operators {{{ */
1277 MultiplicativeExpression
1278 : UnaryExpression[pass] { $$ = $pass; }
1279 | MultiplicativeExpression[lhs] "*" UnaryExpression[rhs] { $$ = CYNew CYMultiply($lhs, $rhs); }
1280 | MultiplicativeExpression[lhs] "/" UnaryExpression[rhs] { $$ = CYNew CYDivide($lhs, $rhs); }
1281 | MultiplicativeExpression[lhs] "%" UnaryExpression[rhs] { $$ = CYNew CYModulus($lhs, $rhs); }
1284 /* 12.7 Additive Operators {{{ */
1286 : MultiplicativeExpression[pass] { $$ = $pass; }
1287 | AdditiveExpression[lhs] "+" MultiplicativeExpression[rhs] { $$ = CYNew CYAdd($lhs, $rhs); }
1288 | AdditiveExpression[lhs] "-" MultiplicativeExpression[rhs] { $$ = CYNew CYSubtract($lhs, $rhs); }
1291 /* 12.8 Bitwise Shift Operators {{{ */
1293 : AdditiveExpression[pass] { $$ = $pass; }
1294 | ShiftExpression[lhs] "<<" AdditiveExpression[rhs] { $$ = CYNew CYShiftLeft($lhs, $rhs); }
1295 | ShiftExpression[lhs] ">>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightSigned($lhs, $rhs); }
1296 | ShiftExpression[lhs] ">>>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightUnsigned($lhs, $rhs); }
1299 /* 12.9 Relational Operators {{{ */
1300 RelationalExpression
1301 : ShiftExpression[pass] { $$ = $pass; }
1302 | RelationalExpression[lhs] "<" ShiftExpression[rhs] { $$ = CYNew CYLess($lhs, $rhs); }
1303 | RelationalExpression[lhs] ">" ShiftExpression[rhs] { $$ = CYNew CYGreater($lhs, $rhs); }
1304 | RelationalExpression[lhs] "<=" ShiftExpression[rhs] { $$ = CYNew CYLessOrEqual($lhs, $rhs); }
1305 | RelationalExpression[lhs] ">=" ShiftExpression[rhs] { $$ = CYNew CYGreaterOrEqual($lhs, $rhs); }
1306 | RelationalExpression[lhs] "instanceof" ShiftExpression[rhs] { $$ = CYNew CYInstanceOf($lhs, $rhs); }
1307 | RelationalExpression[lhs] "in" ShiftExpression[rhs] { $$ = CYNew CYIn($lhs, $rhs); }
1310 /* 12.10 Equality Operators {{{ */
1312 : RelationalExpression[pass] { $$ = $pass; }
1313 | EqualityExpression[lhs] "==" RelationalExpression[rhs] { $$ = CYNew CYEqual($lhs, $rhs); }
1314 | EqualityExpression[lhs] "!=" RelationalExpression[rhs] { $$ = CYNew CYNotEqual($lhs, $rhs); }
1315 | EqualityExpression[lhs] "===" RelationalExpression[rhs] { $$ = CYNew CYIdentical($lhs, $rhs); }
1316 | EqualityExpression[lhs] "!==" RelationalExpression[rhs] { $$ = CYNew CYNotIdentical($lhs, $rhs); }
1319 /* 12.11 Binary Bitwise Operators {{{ */
1320 BitwiseANDExpression
1321 : EqualityExpression[pass] { $$ = $pass; }
1322 | BitwiseANDExpression[lhs] "&" EqualityExpression[rhs] { $$ = CYNew CYBitwiseAnd($lhs, $rhs); }
1325 BitwiseXORExpression
1326 : BitwiseANDExpression[pass] { $$ = $pass; }
1327 | BitwiseXORExpression[lhs] "^" BitwiseANDExpression[rhs] { $$ = CYNew CYBitwiseXOr($lhs, $rhs); }
1331 : BitwiseXORExpression[pass] { $$ = $pass; }
1332 | BitwiseORExpression[lhs] "|" BitwiseXORExpression[rhs] { $$ = CYNew CYBitwiseOr($lhs, $rhs); }
1335 /* 12.12 Binary Logical Operators {{{ */
1336 LogicalANDExpression
1337 : BitwiseORExpression[pass] { $$ = $pass; }
1338 | LogicalANDExpression[lhs] "&&" BitwiseORExpression[rhs] { $$ = CYNew CYLogicalAnd($lhs, $rhs); }
1342 : LogicalANDExpression[pass] { $$ = $pass; }
1343 | LogicalORExpression[lhs] "||" LogicalANDExpression[rhs] { $$ = CYNew CYLogicalOr($lhs, $rhs); }
1346 /* 12.13 Conditional Operator ( ? : ) {{{ */
1348 ConditionalExpressionClassic
1349 : LogicalORExpression[pass] { $$ = $pass; }
1350 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpressionClassic[false] { $$ = CYNew CYCondition($test, $true, $false); }
1354 ConditionalExpression
1355 : LogicalORExpression[pass] { $$ = $pass; }
1356 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpression[false] { $$ = CYNew CYCondition($test, $true, $false); }
1359 /* 12.14 Assignment Operators {{{ */
1360 LeftHandSideAssignment
1361 : LeftHandSideExpression[lhs] "=" { $$ = CYNew CYAssign($lhs, NULL); }
1362 | LeftHandSideExpression[lhs] "*=" { $$ = CYNew CYMultiplyAssign($lhs, NULL); }
1363 | LeftHandSideExpression[lhs] "/=" { $$ = CYNew CYDivideAssign($lhs, NULL); }
1364 | LeftHandSideExpression[lhs] "%=" { $$ = CYNew CYModulusAssign($lhs, NULL); }
1365 | LeftHandSideExpression[lhs] "+=" { $$ = CYNew CYAddAssign($lhs, NULL); }
1366 | LeftHandSideExpression[lhs] "-=" { $$ = CYNew CYSubtractAssign($lhs, NULL); }
1367 | LeftHandSideExpression[lhs] "<<=" { $$ = CYNew CYShiftLeftAssign($lhs, NULL); }
1368 | LeftHandSideExpression[lhs] ">>=" { $$ = CYNew CYShiftRightSignedAssign($lhs, NULL); }
1369 | LeftHandSideExpression[lhs] ">>>=" { $$ = CYNew CYShiftRightUnsignedAssign($lhs, NULL); }
1370 | LeftHandSideExpression[lhs] "&=" { $$ = CYNew CYBitwiseAndAssign($lhs, NULL); }
1371 | LeftHandSideExpression[lhs] "^=" { $$ = CYNew CYBitwiseXOrAssign($lhs, NULL); }
1372 | LeftHandSideExpression[lhs] "|=" { $$ = CYNew CYBitwiseOrAssign($lhs, NULL); }
1376 AssignmentExpressionClassic
1377 : LexOf ConditionalExpressionClassic[pass] { $$ = $pass; }
1378 | LexOf LeftHandSideAssignment[assignment] AssignmentExpressionClassic[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1382 AssignmentExpression
1383 : LexOf ConditionalExpression[pass] { $$ = $pass; }
1384 | LexOf YieldExpression[pass] { $$ = $pass; }
1385 | ArrowFunction[pass] { $$ = $pass; }
1386 | LexOf LeftHandSideAssignment[assignment] AssignmentExpression[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1389 /* 12.15 Comma Operator ( , ) {{{ */
1391 : AssignmentExpression[pass] { $$ = $pass; }
1392 | Expression[expression] "," AssignmentExpression[next] { $$ = CYNew CYCompound($expression, $next); }
1396 : Expression[pass] { $$ = $pass; }
1397 | LexOf { $$ = NULL; }
1401 /* 13 Statements and Declarations {{{ */
1403 : BlockStatement[pass] { $$ = $pass; }
1404 | VariableStatement[pass] { $$ = $pass; }
1405 | EmptyStatement[pass] { $$ = $pass; }
1406 | IfStatement[pass] { $$ = $pass; }
1407 | BreakableStatement[pass] { $$ = $pass; }
1408 | ContinueStatement[pass] { $$ = $pass; }
1409 | BreakStatement[pass] { $$ = $pass; }
1410 | ReturnStatement[pass] { $$ = $pass; }
1411 | WithStatement[pass] { $$ = $pass; }
1412 | LabelledStatement[pass] { $$ = $pass; }
1413 | ThrowStatement[pass] { $$ = $pass; }
1414 | TryStatement[pass] { $$ = $pass; }
1415 | DebuggerStatement[pass] { $$ = $pass; }
1419 : LexOf Statement__[pass] { $$ = $pass; }
1420 | ExpressionStatement[pass] { $$ = $pass; }
1424 : LexSetStatement LexLet Statement_[pass] { $$ = $pass; }
1428 : HoistableDeclaration[pass] { $$ = $pass; }
1429 | ClassDeclaration[pass] { $$ = $pass; }
1433 : LexSetStatement LexLet LexOf Declaration_[pass] { $$ = $pass; }
1434 | LexSetStatement LexicalDeclaration[pass] { $$ = $pass; }
1437 HoistableDeclaration
1438 : FunctionDeclaration[pass] { $$ = $pass; }
1439 | GeneratorDeclaration[pass] { $$ = $pass; }
1443 : IterationStatement[pass] { $$ = $pass; }
1444 | SwitchStatement[pass] { $$ = $pass; }
1447 /* 13.2 Block {{{ */
1449 : ";{" StatementListOpt[code] "}" { $$ = CYNew CYBlock($code); }
1453 : "{" StatementListOpt[code] "}" { $$ = $code; }
1457 : StatementListItem[statement] StatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1461 : StatementList[pass] { $$ = $pass; }
1462 | LexSetStatement LexLet LexOf { $$ = NULL; }
1466 : Statement[pass] { $$ = $pass; }
1467 | Declaration[pass] { $$ = $pass; }
1470 /* 13.3 Let and Const Declarations {{{ */
1472 : LetOrConst[constant] BindingList[bindings] { $$ = CYNew CYLexical($constant, $bindings); }
1476 : LexicalDeclaration_[statement] Terminator { $$ = $statement; }
1480 : { CYMAP(_let__, _let_); }
1484 : { CYMAP(_of__, _of_); }
1488 : { CYMAP(OpenBrace_let, OpenBrace); CYMAP(OpenBracket_let, OpenBracket); }
1492 : LexLet LexOf "!let" LexBind LexOf { $$ = false; }
1493 | LexLet LexOf "const" { $$ = true; }
1497 : "," LexBind BindingList[bindings] { $$ = $bindings; }
1502 : LexicalBinding[binding] BindingList_[next] { $$ = CYNew CYBindings($binding, $next); }
1506 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1507 | LexOf BindingPattern Initializer { CYNOT(@$); }
1510 /* 13.3.2 Variable Statement {{{ */
1512 : Var_ VariableDeclarationList[bindings] { $$ = CYNew CYVar($bindings); }
1516 : VariableStatement_[statement] Terminator { $$ = $statement; }
1519 VariableDeclarationList_
1520 : "," VariableDeclarationList[bindings] { $$ = $bindings; }
1524 VariableDeclarationList
1525 : LexBind VariableDeclaration[binding] VariableDeclarationList_[next] { $$ = CYNew CYBindings($binding, $next); }
1529 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1530 | LexOf BindingPattern Initializer { CYNOT(@$); }
1533 /* 13.3.3 Destructuring Binding Patterns {{{ */
1535 : ObjectBindingPattern
1536 | ArrayBindingPattern
1539 ObjectBindingPattern
1540 : "let {" BindingPropertyListOpt "}"
1544 : "let [" BindingElementListOpt "]"
1547 BindingPropertyList_
1548 : "," BindingPropertyListOpt
1553 : BindingProperty BindingPropertyList_
1556 BindingPropertyListOpt
1557 : BindingPropertyList
1562 : BindingElementOpt[element] "," BindingElementListOpt[next]
1563 | BindingRestElement[element]
1564 | BindingElement[element]
1567 BindingElementListOpt
1568 : BindingElementList[pass]
1574 | LexOf PropertyName ":" BindingElement
1578 : LexBind SingleNameBinding[pass] { $$ = $pass; }
1579 | LexBind LexOf BindingPattern InitializerOpt[initializer] { CYNOT(@$); }
1583 : BindingElement[pass]
1588 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1592 : LexBind LexOf "..." BindingIdentifier
1595 /* 13.4 Empty Statement {{{ */
1597 : ";" { $$ = CYNew CYEmpty(); }
1600 /* 13.5 Expression Statement {{{ */
1601 ExpressionStatement_
1602 : Expression[expression] { $$ = CYNew CYExpress($[expression]); }
1605 : ExpressionStatement_[statement] Terminator { $$ = $statement; }
1608 /* 13.6 The if Statement {{{ */
1610 : "else" Statement[false] { $$ = $false; }
1611 | %prec "if" { $$ = NULL; }
1615 : "if" "(" Expression[test] ")" Statement[true] ElseStatementOpt[false] { $$ = CYNew CYIf($test, $true, $false); }
1618 /* 13.7 Iteration Statements {{{ */
1620 : "do" Statement[code] "while" "(" Expression[test] ")" TerminatorOpt { $$ = CYNew CYDoWhile($test, $code); }
1621 | "while" "(" Expression[test] ")" Statement[code] { $$ = CYNew CYWhile($test, $code); }
1622 | "for" "(" LexPushInOn ForStatementInitializer[initializer] LexPopIn ExpressionOpt[test] ";" ExpressionOpt[increment] ")" Statement[code] { $$ = CYNew CYFor($initializer, $test, $increment, $code); }
1623 | "for" "(" LexPushInOn LexLet LexOf Var_ LexBind BindingIdentifier[identifier] Initializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForInitialized(CYNew CYBinding($identifier, $initializer), $iterable, $code); }
1624 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForIn($initializer, $iterable, $code); }
1625 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "of" LexPopIn AssignmentExpression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
1628 ForStatementInitializer
1629 : LexLet LexOf EmptyStatement[pass] { $$ = $pass; }
1630 | LexLet ExpressionStatement_[initializer] ";" { $$ = $initializer; }
1631 | LexLet LexOf VariableStatement_[initializer] ";" { $$ = $initializer; }
1632 | LexicalDeclaration_[initializer] ";" { $$ = $initializer; }
1635 ForInStatementInitializer
1636 : LexLet LexOf BracedExpression[pass] { $$ = $pass; }
1637 | LexLet LexOf IndirectExpression[pass] { $$ = $pass; }
1638 | LexLet LexOf Var_ LexBind ForBinding[binding] { $$ = CYNew CYForVariable($binding); }
1639 | ForDeclaration[pass] { $$ = $pass; }
1643 : LetOrConst[constant] ForBinding[binding] { $$ = CYNew CYForLexical($constant, $binding); }
1647 : BindingIdentifier[identifier] { $$ = CYNew CYBinding($identifier, NULL); }
1648 | LexOf BindingPattern { CYNOT(@$); }
1651 /* 13.8 The continue Statement {{{ */
1653 : "continue" TerminatorSoft { $$ = CYNew CYContinue(NULL); }
1654 | "continue" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYContinue($label); }
1657 /* 13.9 The break Statement {{{ */
1659 : "break" TerminatorSoft { $$ = CYNew CYBreak(NULL); }
1660 | "break" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYBreak($label); }
1663 /* 13.10 The return Statement {{{ */
1665 : Return TerminatorSoft { $$ = CYNew CYReturn(NULL); }
1666 | Return NewLineNot Expression[value] Terminator { $$ = CYNew CYReturn($value); }
1669 /* 13.11 The with Statement {{{ */
1671 : "with" "(" Expression[scope] ")" Statement[code] { $$ = CYNew CYWith($scope, $code); }
1674 /* 13.12 The switch Statement {{{ */
1676 : "switch" "(" Expression[value] ")" CaseBlock[clauses] { $$ = CYNew CYSwitch($value, $clauses); }
1680 : "{" CaseClausesOpt[clauses] "}" { $$ = $clauses; }
1684 : "case" Expression[value] ":" StatementListOpt[code] { $$ = CYNew CYClause($value, $code); }
1688 : CaseClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1689 | DefaultClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1693 // XXX: the standard makes certain you can only have one of these
1695 : "default" ":" StatementListOpt[code] { $$ = CYNew CYClause(NULL, $code); }
1698 /* 13.13 Labelled Statements {{{ */
1700 : LabelIdentifier[name] ":" LabelledItem[statement] { $$ = CYNew CYLabel($name, $statement); }
1704 : Statement[pass] { $$ = $pass; }
1705 | LexSetStatement LexLet LexOf FunctionDeclaration[pass] { $$ = $pass; }
1708 /* 13.14 The throw Statement {{{ */
1710 : "throw"[throw] TerminatorSoft { CYERR(@throw, "throw without exception"); }
1711 | "throw" NewLineNot Expression[value] Terminator { $$ = CYNew cy::Syntax::Throw($value); }
1714 /* 13.15 The try Statement {{{ */
1716 : "try" Block[code] Catch[catch] { $$ = CYNew cy::Syntax::Try($code, $catch, NULL); }
1717 | "try" Block[code] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, NULL, $finally); }
1718 | "try" Block[code] Catch[catch] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, $catch, $finally); }
1722 : "catch" "(" LexBind CatchParameter[name] ")" Block[code] { $$ = CYNew cy::Syntax::Catch($name, $code); }
1726 : "finally" Block[code] { $$ = CYNew CYFinally($code); }
1730 : BindingIdentifier[pass] { $$ = $pass; }
1731 | LexOf BindingPattern { CYNOT(@$); }
1734 /* 13.16 The debugger Statement {{{ */
1736 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1740 /* 14.1 Function Definitions {{{ */
1742 : ";function" BindingIdentifier[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionStatement($name, $parameters, $code); }
1746 : "function" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionExpression($name, $parameters, $code); }
1749 StrictFormalParameters
1750 : FormalParameters[pass] { $$ = $pass; }
1754 : LexBind LexOf { $$ = NULL; }
1755 | FormalParameterList
1758 FormalParameterList_
1759 : "," FormalParameterList[parameters] { $$ = $parameters; }
1764 : FunctionRestParameter { CYNOT(@$); }
1765 | FormalParameter[binding] FormalParameterList_[next] { $$ = CYNew CYFunctionParameter($binding, $next); }
1768 FunctionRestParameter
1769 : BindingRestElement
1773 : BindingElement[pass] { $$ = $pass; }
1777 : LexPushYieldOff FunctionStatementList[code] LexPopYield { $$ = $code; }
1780 FunctionStatementList
1781 : LexPushReturnOn StatementListOpt[code] LexPopReturn { $$ = $code; }
1784 /* 14.2 Arrow Function Definitions {{{ */
1786 : ArrowParameters[parameters] LexNewLineOrOpt "=>" LexNoBrace ConciseBody[code] { $$ = CYNew CYFatArrow($parameters, $code); }
1790 : BindingIdentifier[identifier] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier)); }
1791 | LexOf CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) $$ = NULL; else { $$ = $cover->expression_->Parameter(); if ($$ == NULL) CYERR(@cover, "invalid parameter list"); } }
1795 : AssignmentExpression[expression] { $$ = CYNew CYReturn($expression); }
1796 | LexOf ";{" FunctionBody[code] "}" { $$ = $code; }
1799 /* 14.3 Method Definitions {{{ */
1801 : PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyMethod($name, $parameters, $code); }
1802 | GeneratorMethod[pass] { $$ = $pass; }
1803 | "get" PropertyName[name] "(" ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyGetter($name, $code); }
1804 | "set" PropertyName[name] "(" PropertySetParameterList[parameter] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertySetter($name, $parameter, $code); }
1807 PropertySetParameterList
1808 : FormalParameter[binding] { $$ = CYNew CYFunctionParameter($binding); }
1811 /* 14.4 Generator Function Definitions {{{ */
1813 : "*" PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorMethod($name, $parameters, $code); */ }
1816 GeneratorDeclaration
1817 : ";function" LexOf "*" BindingIdentifier[name] "(" FormalParameters[code] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorStatement($name, $parameters, $code); */ }
1821 : "function" LexOf "*" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorExpression($name, $parameters, $code); */ }
1825 : LexPushYieldOn FunctionStatementList[code] LexPopYield { $$ = $code; }
1829 : "!yield" LexNewLineOrNot "\n" LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ }
1830 | "!yield" LexNewLineOrNot "" LexNoStar LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ } %prec "!yield"
1831 | "!yield" LexNewLineOrNot "" LexNoStar AssignmentExpression[value] { CYNOT(@$); /* $$ = CYNew CYYieldValue($value); */ }
1832 | "!yield" LexNewLineOrNot "" LexNoStar LexOf "yield *" AssignmentExpression[generator] { CYNOT(@$); /* $$ = CYNew CYYieldGenerator($generator); */ }
1835 /* 14.5 Class Definitions {{{ */
1837 : ";class" BindingIdentifier[name] ClassTail[tail] { $$ = CYNew CYClassStatement($name, $tail); }
1841 : "class" BindingIdentifierOpt[name] ClassTail[tail] { $$ = CYNew CYClassExpression($name, $tail); }
1845 : ClassHeritageOpt[tail] { driver.class_.push($tail); } "{" LexPushSuperOn ClassBodyOpt "}" LexPopSuper { driver.class_.pop(); $$ = $tail; }
1849 : "extends" AccessExpression[extends] { $$ = CYNew CYClassTail($extends); }
1853 : ClassHeritage[pass] { $$ = $pass; }
1854 | { $$ = CYNew CYClassTail(NULL); }
1867 : ClassElementListOpt ClassElement
1876 : MethodDefinition[method] { if (CYFunctionExpression *constructor = $method->Constructor()) driver.class_.top()->constructor_ = constructor; else driver.class_.top()->instance_->*$method; }
1877 | "static" MethodDefinition[method] { driver.class_.top()->static_->*$method; }
1882 /* 15.1 Scripts {{{ */
1884 : ScriptBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1888 : StatementList[pass] { $$ = $pass; }
1892 : ScriptBody[pass] { $$ = $pass; }
1893 | LexSetStatement LexLet LexOf { $$ = NULL; }
1896 /* 15.2 Modules {{{ */
1898 : ModuleBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1902 : ModuleItemList[pass] { $$ = $pass; }
1906 : ModuleBody[pass] { $$ = $pass; }
1907 | LexSetStatement LexLet LexOf { $$ = NULL; }
1911 : ModuleItem[statement] ModuleItemListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1915 : ModuleItemList[pass] { $$ = $pass; }
1916 | LexSetStatement LexLet LexOf { $$ = NULL; }
1920 : LexSetStatement LexLet LexOf ImportDeclaration[pass] { $$ = $pass; }
1921 | LexSetStatement LexLet LexOf ExportDeclaration { CYNOT(@$); }
1922 | StatementListItem[pass] { $$ = $pass; }
1925 /* 15.2.2 Imports {{{ */
1927 : "import" ImportClause[specifiers] FromClause[module] Terminator { $$ = CYNew CYImportDeclaration($specifiers, $module); }
1928 | "import" LexOf ModuleSpecifier[module] Terminator { $$ = CYNew CYImportDeclaration(NULL, $module); }
1932 : ImportedDefaultBinding[default] { $$ = $default; }
1933 | LexOf NameSpaceImport[pass] { $$ = $pass; }
1934 | LexOf NamedImports[pass] { $$ = $pass; }
1935 | ImportedDefaultBinding[default] "," NameSpaceImport[next] { $$ = $default; CYSetLast($$) = $next; }
1936 | ImportedDefaultBinding[default] "," NamedImports[next] { $$ = $default; CYSetLast($$) = $next; }
1939 ImportedDefaultBinding
1940 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(CYNew CYIdentifier("default"), $binding); }
1944 : "*" "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(NULL, $binding); }
1948 : "{" ImportsListOpt[pass] "}" { $$ = $pass; }
1952 : "from" ModuleSpecifier[pass] { $$ = $pass; }
1956 : "," ImportsListOpt[pass] { $$ = $pass; }
1961 : ImportSpecifier[import] ImportsList_[next] { $$ = $import; CYSetLast($$) = $next; }
1965 : ImportsList[pass] { $$ = $pass; }
1966 | LexOf { $$ = NULL; }
1970 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($binding, $binding); }
1971 | LexOf IdentifierName[name] "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($name, $binding); }
1975 : StringLiteral[pass] { $$ = $pass; }
1979 : BindingIdentifier[pass] { $$ = $pass; }
1982 /* 15.2.3 Exports {{{ */
1984 : "*" FromClause Terminator
1985 | ExportClause FromClause Terminator
1986 | ExportClause Terminator
1988 | "default" LexSetStatement LexOf HoistableDeclaration
1989 | "default" LexSetStatement LexOf ClassDeclaration
1990 | "default" LexSetStatement AssignmentExpression Terminator
1994 : "export" LexSetStatement LexLet LexOf ExportDeclaration_
1995 | "export" Declaration
1999 : ";{" ExportsListOpt "}"
2003 : "," ExportsListOpt
2008 : ExportSpecifier ExportsList_
2018 | IdentifierName "as" IdentifierName
2023 /* Cycript (C): Type Encoding {{{ */
2025 : IdentifierType[identifier] { $$ = CYNew CYTypedIdentifier(@identifier, $identifier); }
2026 | "(" "*" TypeQualifierRightOpt[typed] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2030 : { $$ = CYNew CYTypedIdentifier(@$); }
2034 : TypeSignifier[pass] { $$ = $pass; }
2035 | TypeSignifierNone[pass] { $$ = $pass; }
2052 ParameterModifierOpt
2058 : TypedParameterListOpt[formal] ")" ParameterModifierOpt { $$ = CYNew CYTypeFunctionWith($formal->variadic_, $formal->parameters_); }
2062 : SuffixedTypeOpt[typed] "[" RestrictOpt NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
2063 | "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameters[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
2064 | TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2065 | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedIdentifier(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2069 : SuffixedType[pass] { $$ = $pass; }
2070 | TypeSignifierOpt[pass] { $$ = $pass; }
2074 : "*" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2078 : "const" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeConstant(); }
2079 | "volatile" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeVolatile(); }
2082 TypeQualifierLeftOpt
2083 : TypeQualifierLeft[pass] { $$ = $pass; }
2088 : SuffixedType[pass] { $$ = $pass; }
2089 | PrefixedType[pass] { $$ = $pass; }
2090 | "const" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
2091 | "volatile" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
2092 | Restrict TypeQualifierRightOpt[typed] { $$ = $typed; }
2095 TypeQualifierRightOpt
2096 : TypeQualifierRight[pass] { $$ = $pass; }
2097 | TypeSignifierOpt[pass] { $$ = $pass; }
2101 : "int" { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2102 | "unsigned" IntegerTypeOpt[integral] { $$ = $integral->Unsigned(); if ($$ == NULL) CYERR(@1, "incompatible unsigned"); }
2103 | "signed" IntegerTypeOpt[integral] { $$ = $integral->Signed(); if ($$ == NULL) CYERR(@1, "incompatible signed"); }
2104 | "long" IntegerTypeOpt[integral] { $$ = $integral->Long(); if ($$ == NULL) CYERR(@1, "incompatible long"); }
2105 | "short" IntegerTypeOpt[integral] { $$ = $integral->Short(); if ($$ == NULL) CYERR(@1, "incompatible short"); }
2109 : IntegerType[pass] { $$ = $pass; }
2110 | { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2114 : TypedIdentifierField[typed] ";" StructFieldListOpt[next] { $$ = CYNew CYTypeStructField($typed, $next); }
2119 : NumericLiteral[pass] { $$ = $pass; }
2120 | "-" NumericLiteral[positive] { $$ = $positive; $$->value_ = -$$->value_; }
2123 EnumConstantListOpt_
2124 : "," EnumConstantListOpt[pass] { $$ = $pass; }
2129 : IdentifierType[name] "=" IntegerNumber[value] EnumConstantListOpt_[next] { $$ = CYNew CYEnumConstant($name, $value, $next); }
2134 : { $$ = CYTypeNeutral; }
2135 | "signed" { $$ = CYTypeSigned; }
2136 | "unsigned" { $$ = CYTypeUnsigned; }
2140 : IdentifierType[name] { $$ = CYNew CYTypeVariable($name); }
2141 | IntegerType[pass] { $$ = $pass; }
2142 | TypeSigning[signing] "char" { $$ = CYNew CYTypeCharacter($signing); }
2143 | TypeSigning[signing] "__int128" { $$ = CYNew CYTypeInt128($signing); }
2147 : PrimitiveType[pass] { $$ = $pass; }
2148 | "struct" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); }
2149 | "enum" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceEnum, $name); }
2150 | "struct" AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2151 | "enum" AutoComplete { driver.mode_ = CYDriver::AutoEnum; YYACCEPT; }
2154 TypedIdentifierMaybe
2155 : TypeQualifierLeft[modifier] "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2156 | "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2157 | TypeQualifierLeftOpt[modifier] PrimitiveReference[specifier] TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = $specifier; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2161 : TypedIdentifierMaybe[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2165 : TypedIdentifierMaybe[typed] { if ($typed->identifier_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2168 TypedIdentifierTagged
2169 : TypeQualifierLeftOpt[modifier] "struct" "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeStruct(NULL, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2170 | TypeQualifierLeftOpt[modifier] "enum" ":" PrimitiveType[specifier] "{" EnumConstantListOpt[constants] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeEnum(NULL, $specifier, $constants); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2173 TypedIdentifierField
2174 : TypedIdentifierYes[pass] { $$ = $pass; }
2175 | TypedIdentifierTagged[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2178 TypedIdentifierEncoding
2179 : TypedIdentifierNo[pass] { $$ = $pass; }
2180 | TypedIdentifierTagged[typed] { if ($typed->identifier_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2181 | "void" TypeSignifierNone[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2184 TypedIdentifierDefinition
2185 : TypedIdentifierYes[pass] { $$ = $pass; }
2186 | 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; }
2187 | "void" TypeSignifier[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2191 : "@encode" "(" TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYEncodedType($typed); }
2197 /* Cycript (Objective-C): @class Declaration {{{ */
2199 /* XXX: why the hell did I choose MemberExpression? */
2200 : ":" MemberExpression[extends] { $$ = $extends; }
2204 ImplementationFieldListOpt
2205 : TypedIdentifierField[typed] ";" ImplementationFieldListOpt[next] { $$ = CYNew CYImplementationField($typed, $next); }
2210 : "+" { $$ = false; }
2211 | "-" { $$ = true; }
2215 : "(" TypedIdentifierNo[type] ")" { $$ = $type; }
2216 | { $$ = CYNew CYTypedIdentifier(CYNew CYTypeVariable("id")); }
2220 : Word[tag] ":" TypeOpt[type] BindingIdentifier[identifier] { $type->identifier_ = $identifier; $$ = CYNew CYMessageParameter($tag, $type); }
2223 MessageParameterList
2224 : MessageParameter[parameter] MessageParameterListOpt[next] { $parameter->SetNext($next); $$ = $parameter; }
2227 MessageParameterListOpt
2228 : MessageParameterList[pass] { $$ = $pass; }
2229 | TypedParameterList_[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); /*XXX*/ if ($formal->parameters_ != NULL) CYERR(@$, "temporarily unsupported"); $$ = NULL; }
2233 : MessageParameterList[pass] { $$ = $pass; }
2234 | Word[tag] { $$ = CYNew CYMessageParameter($tag, NULL); }
2237 ClassMessageDeclaration
2238 : MessageScope[instance] TypeOpt[type] MessageParameters[parameters] "{" LexPushSuperOn FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYMessage($instance, $type, $parameters, $code); }
2241 ClassMessageDeclarationListOpt
2242 : ClassMessageDeclarationListOpt[next] ClassMessageDeclaration[message] { $message->SetNext($next); $$ = $message; }
2246 // XXX: this should be AssignmentExpressionNoRight
2248 : ShiftExpression[name] ClassProtocolsOpt[next] { $$ = CYNew CYProtocol($name, $next); }
2252 : "," ClassProtocols[protocols] { $$ = $protocols; }
2256 ClassProtocolListOpt
2257 : "<" ClassProtocols[protocols] ">" { $$ = $protocols; }
2261 ImplementationStatement
2262 : "@implementation" Identifier[name] ClassSuperOpt[extends] ClassProtocolListOpt[protocols] "{" ImplementationFieldListOpt[fields] "}" ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYImplementation($name, $extends, $protocols, $fields, $messages); }
2270 : "@implementation" Identifier[name] CategoryName ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYCategory($name, $messages); }
2274 : ImplementationStatement[pass] { $$ = $pass; }
2275 | CategoryStatement[pass] { $$ = $pass; }
2278 /* Cycript (Objective-C): Send Message {{{ */
2280 : "," AssignmentExpressionClassic[value] VariadicCall[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
2285 : WordOpt[name] { driver.contexts_.back().words_.push_back($name); } { $$ = $name; }
2286 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
2290 : SelectorCall[pass] { $$ = $pass; }
2291 | VariadicCall[pass] { $$ = $pass; }
2295 : SelectorWordOpt[name] ":" AssignmentExpressionClassic[value] SelectorCall_[next] { $$ = CYNew CYArgument($name ?: CYNew CYWord(""), $value, $next); }
2299 : SelectorCall[pass] { $$ = $pass; }
2300 | Word[name] { $$ = CYNew CYArgument($name, NULL); }
2304 : "[" AssignmentExpressionClassic[self] { driver.contexts_.push_back($self); } SelectorList[arguments] "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($self, $arguments); }
2305 | "[" LexOf "super" { driver.context_ = NULL; } SelectorList[arguments] "]" { $$ = CYNew CYSendSuper($arguments); }
2309 : WordOpt[name] ":" SelectorExpressionOpt[next] { $$ = CYNew CYSelectorPart($name, true, $next); }
2313 : SelectorExpression_[pass] { $$ = $pass; }
2314 | Word[name] { $$ = CYNew CYSelectorPart($name, false, NULL); }
2317 SelectorExpressionOpt
2318 : SelectorExpression_[pass] { $$ = $pass; }
2323 : MessageExpression[pass] { $$ = $pass; }
2324 | "@selector" "(" SelectorExpression[parts] ")" { $$ = CYNew CYSelector($parts); }
2329 /* Cycript: @import Directive {{{ */
2331 : ModulePath[next] "." Word[part] { $$ = CYNew CYModule($part, $next); }
2332 | Word[part] { $$ = CYNew CYModule($part); }
2336 : "@import" ModulePath[path] { $$ = CYNew CYImport($path); }
2341 /* Cycript (Objective-C): Boxed Expressions {{{ */
2343 : NullLiteral[pass] { $$ = $pass; }
2344 | BooleanLiteral[pass] { $$ = $pass; }
2345 | NumericLiteral[pass] { $$ = $pass; }
2346 | StringLiteral[pass] { $$ = $pass; }
2347 | CoverParenthesizedExpressionAndArrowParameterList[pass] { $$ = $pass; }
2348 | "YES" { $$ = CYNew CYTrue(); }
2349 | "NO" { $$ = CYNew CYFalse(); }
2353 : "," KeyValuePairListOpt[next] { $$ = $next; }
2357 : AssignmentExpression[key] ":" AssignmentExpression[value] KeyValuePairList_[next] { $$ = CYNew CYObjCKeyValue($key, $value, $next); }
2361 : KeyValuePairList[pass] { $$ = $pass; }
2362 | LexOf { $$ = NULL; }
2366 : "@" BoxableExpression[expression] { $$ = CYNew CYBox($expression); }
2367 | "@" "[" ElementListOpt[elements] "]" { $$ = CYNew CYObjCArray($elements); }
2368 | "@" "{" KeyValuePairListOpt[pairs] "}" { $$ = CYNew CYObjCDictionary($pairs); }
2370 | "@YES" { $$ = CYNew CYBox(CYNew CYTrue()); }
2371 | "@NO" { $$ = CYNew CYBox(CYNew CYFalse()); }
2372 | "@true" { $$ = CYNew CYBox(CYNew CYTrue()); }
2373 | "@false" { $$ = CYNew CYBox(CYNew CYFalse()); }
2374 | "@null" { $$ = CYNew CYBox(CYNew CYNull()); }
2377 /* Cycript (Objective-C): Block Expressions {{{ */
2379 : "^" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { if (CYTypeFunctionWith *function = $type->Function()) $$ = CYNew CYObjCBlock($type, function->parameters_, $code); else CYERR($type->location_, "expected parameters"); }
2382 /* Cycript (Objective-C): Instance Literals {{{ */
2384 : "#" NumericLiteral[address] { $$ = CYNew CYInstanceLiteral($address); }
2390 /* Cycript (C): Pointer Indirection/Addressing {{{ */
2392 : IndirectExpression[pass] { $$ = $pass; }
2396 : "*" UnaryExpression[rhs] { $$ = CYNew CYIndirect($rhs); }
2400 : "&" UnaryExpression[rhs] { $$ = CYNew CYAddressOf($rhs); }
2404 : "->" "[" Expression[property] "]" { $$ = CYNew CYIndirectMember(NULL, $property); }
2405 | "->" IdentifierName[property] { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($property)); }
2406 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
2409 /* Cycript (C): Lambda Expressions {{{ */
2411 : "," TypedParameterList[parameters] { $$ = $parameters; }
2412 | { $$ = CYNew CYTypedFormal(false); }
2416 : TypedIdentifierMaybe[typed] TypedParameterList_[formal] { $$ = $formal; $$->parameters_ = CYNew CYTypedParameter($typed, $$->parameters_); }
2417 | "..." { $$ = CYNew CYTypedFormal(true); }
2420 TypedParameterListOpt
2421 : TypedParameterList[pass] { $$ = $pass; }
2422 | "void" { $$ = CYNew CYTypedFormal(false); }
2423 | { $$ = CYNew CYTypedFormal(false); }
2427 : TypedParameterListOpt[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); $$ = $formal->parameters_; }
2431 : "[" LexOf "&" "]" "(" TypedParameters[parameters] ")" "->" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { $$ = CYNew CYLambda($type, $parameters, $code); }
2434 /* Cycript (C): Structure Definitions {{{ */
2436 : "struct" NewLineOpt { $$ = CYNew CYIdentifier("struct"); }
2440 : "struct" NewLineNot IdentifierType[name] "{" StructFieldListOpt[fields] "}" { $$ = CYNew CYStructDefinition($name, CYNew CYStructTail($fields)); }
2444 : "(" LexOf "struct" NewLineOpt IdentifierType[name] TypeQualifierRightOpt[typed] ")" { $typed->specifier_ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); $$ = CYNew CYTypeExpression($typed); }
2445 | "(" LexOf "struct" NewLineOpt AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2448 /* Cycript (C): Type Definitions {{{ */
2450 : "typedef" NewLineOpt { $$ = CYNew CYIdentifier("typedef"); }
2454 : "typedef" NewLineNot TypedIdentifierDefinition[typed] TerminatorHard { $$ = CYNew CYTypeDefinition($typed); }
2458 : TypeDefinition[pass] { $$ = $pass; }
2462 : "(" LexOf "typedef" NewLineOpt TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYTypeExpression($typed); }
2465 /* Cycript (C): extern "C" {{{ */
2467 : "extern" NewLineOpt { $$ = CYNew CYIdentifier("extern"); }
2471 : TypedIdentifierField[typed] TerminatorHard { $$ = CYNew CYExternalDefinition(CYNew CYString("C"), $typed); }
2472 | TypeDefinition[pass] { $$ = $pass; }
2475 ExternCStatementListOpt
2476 : ExternCStatement[statement] ExternCStatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
2481 : "{" ExternCStatementListOpt[pass] "}" { $$ = $pass; }
2482 | ExternCStatement[pass] { $$ = $pass; }
2486 : StringLiteral[abi] { if (strcmp($abi->Value(), "C") != 0) CYERR(@abi, "unknown extern binding"); }
2490 : "extern" NewLineNot ABI[abi] ExternC[pass] { $$ = $pass; }
2494 : "(" LexOf "extern" NewLineOpt ABI[abi] TypedIdentifierField[typed] ")" { $$ = CYNew CYExternalExpression(CYNew CYString("C"), $typed); }
2500 /* Lexer State {{{ */
2502 : { driver.PushCondition(CYDriver::RegExpCondition); }
2506 : { driver.PushCondition(CYDriver::XMLContentCondition); }
2510 : { driver.PushCondition(CYDriver::XMLTagCondition); }
2514 : { driver.PopCondition(); }
2518 : { driver.SetCondition(CYDriver::XMLContentCondition); }
2522 : { driver.SetCondition(CYDriver::XMLTagCondition); }
2525 /* Virtual Tokens {{{ */
2532 /* 8.1 Context Keywords {{{ */
2534 : "namespace" { $$ = CYNew CYIdentifier("namespace"); }
2535 | "xml" { $$ = CYNew CYIdentifier("xml"); }
2538 /* 8.3 XML Initializer Input Elements {{{ */
2540 : XMLComment { $$ = $1; }
2541 | XMLCDATA { $$ = $1; }
2542 | XMLPI { $$ = $1; }
2546 /* 11.1 Primary Expressions {{{ */
2548 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
2549 | XMLInitilizer { $$ = $1; }
2550 | XMLListInitilizer { $$ = $1; }
2554 : AttributeIdentifier { $$ = $1; }
2555 | QualifiedIdentifier { $$ = $1; }
2556 | WildcardIdentifier { $$ = $1; }
2559 /* 11.1.1 Attribute Identifiers {{{ */
2561 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
2565 : PropertySelector { $$ = $1; }
2566 | "[" Expression "]" { $$ = CYNew CYSelector($2); }
2570 : Identifier { $$ = CYNew CYSelector($1); }
2571 | WildcardIdentifier { $$ = $1; }
2574 /* 11.1.2 Qualified Identifiers {{{ */
2575 QualifiedIdentifier_
2576 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
2577 | QualifiedIdentifier { $$ = $1; }
2581 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
2584 /* 11.1.3 Wildcard Identifiers {{{ */
2586 : "*" { $$ = CYNew CYWildcard(); }
2589 /* 11.1.4 XML Initializer {{{ */
2591 : XMLMarkup { $$ = $1; }
2592 | XMLElement { $$ = $1; }
2596 : "<" LexPushInOff XMLTagContent LexPop "/>" LexPopIn
2597 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop ">" LexPopIn
2601 : LexPushXMLTag XMLTagName XMLAttributes
2605 : "{" LexPushRegExp Expression LexPop "}"
2614 : XMLAttributes_ XMLAttribute
2619 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
2620 | XMLAttributes_ XMLWhitespaceOpt
2629 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
2633 : XMLExpression XMLElementContentOpt
2634 | XMLMarkup XMLElementContentOpt
2635 | XMLText XMLElementContentOpt
2636 | XMLElement XMLElementContentOpt
2639 XMLElementContentOpt
2644 /* 11.1.5 XMLList Initializer {{{ */
2646 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop "</>" LexPopIn { $$ = CYNew CYXMLList($4); }
2650 /* 11.2 Left-Hand-Side Expressions {{{ */
2652 : Identifier { $$ = $1; }
2653 | PropertyIdentifier { $$ = $1; }
2657 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
2658 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
2659 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
2662 /* 12.1 The default xml namespace Statement {{{ */
2663 /* XXX: DefaultXMLNamespaceStatement
2664 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
2668 : DefaultXMLNamespaceStatement { $$ = $1; }
2673 /* JavaScript FTL: Array Comprehensions {{{ */
2675 : AssignmentExpression[expression] ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2679 : "for" "each" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2682 /* JavaScript FTL: for each {{{ */
2684 : "for" "each" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
2688 /* JavaScript FTW: Array Comprehensions {{{ */
2690 : ArrayComprehension
2694 : "[" Comprehension[comprehension] "]" { $$ = $comprehension; }
2698 : LexOf ComprehensionFor[comprehension] ComprehensionTail[next] AssignmentExpression[expression] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2703 | ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2704 | ComprehensionIf[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2708 : "for" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForInComprehension($binding, $iterable); }
2709 | "for" "(" LexPushInOn LexBind ForBinding[binding] "of" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2713 : "if" "(" AssignmentExpression[test] ")" { $$ = CYNew CYIfComprehension($test); }
2716 /* JavaScript FTW: Named Arguments {{{ */
2718 : LexOf WordNoUnary[tag] ":" AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument($tag, $value, $next); }
2721 /* JavaScript FTW: Subscript Access {{{ */
2723 : "." "[" AssignmentExpression[property] "]" { $$ = CYNew CYSubscriptMember(NULL, $property); }
2727 /* JavaScript FTW: Java "Anonymous Inner Classes" {{{ */
2729 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYExtend(NULL, $properties); }
2733 /* JavaScript FTW: Ruby Blocks {{{ */
2734 RubyProcParameterList_
2735 : "," RubyProcParameterList[parameters] { $$ = $parameters; }
2739 RubyProcParameterList
2740 : BindingIdentifier[identifier] RubyProcParameterList_[next] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier), $next); }
2741 | LexOf { $$ = NULL; }
2745 : "|" RubyProcParameterList[parameters] "|" { $$ = $parameters; }
2746 | "||" { $$ = NULL; }
2749 RubyProcParametersOpt
2750 : RubyProcParameters[pass] { $$ = $pass; }
2755 : ";{" RubyProcParametersOpt[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyBlock(NULL, CYNew CYRubyProc($parameters, $code)); }
2759 : "{" RubyProcParameters[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyProc($parameters, $code); }
2763 : AccessExpression[pass] LexNewLineOrOpt { $$ = $pass; }
2764 | BracedExpression_[lhs] { if (!$lhs->IsNew()) CYMAP(OpenBrace_, OpenBrace); } BracedParameter[rhs] LexNewLineOrOpt { $rhs->SetLeft($lhs); $$ = $rhs; }
2768 : BracedExpression_[pass] "\n" { $$ = $pass; }
2769 | BracedExpression_[pass] { $$ = $pass; }
2772 /* JavaScript FTW: Ruby Scopes {{{ */
2774 : "::" "[" Expression[property] "]" { $$ = CYNew CYResolveMember(NULL, $property); }
2775 | "::" IdentifierName[property] { $$ = CYNew CYResolveMember(NULL, CYNew CYString($property)); }
2776 | "::" AutoComplete { driver.mode_ = CYDriver::AutoResolve; YYACCEPT; }
2779 /* JavaScript FTW: Ruby Symbols {{{ */
2781 : ":" Word[name] { $$ = CYNew CYSymbol($name->Word()); }
2787 bool CYDriver::Parse(CYMark mark) {
2789 CYLocal<CYPool> local(&pool_);
2790 cy::parser parser(*this);
2792 parser.set_debug_level(debug_);
2794 return parser.parse() != 0;
2797 void CYDriver::Warning(const cy::parser::location_type &location, const char *message) {
2801 CYDriver::Error error;
2802 error.warning_ = true;
2803 error.location_ = location;
2804 error.message_ = message;
2805 errors_.push_back(error);
2808 void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
2809 CYDriver::Error error;
2810 error.warning_ = false;
2811 error.location_ = location;
2812 error.message_ = message;
2813 driver.errors_.push_back(error);