1 /* Cycript - The Truly Universal Scripting Language
2 * Copyright (C) 2009-2016 Jay Freeman (saurik)
5 /* GNU Affero General Public License, Version 3 {{{ */
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #define YYSTACKEXPANDABLE 1
31 #define CYNew new(driver.pool_)
34 #include "ObjectiveC/Syntax.hpp"
38 #include "E4X/Syntax.hpp"
41 #include "Highlight.hpp"
44 %union { bool bool_; }
46 %union { CYMember *access_; }
47 %union { CYArgument *argument_; }
48 %union { CYAssignment *assignment_; }
49 %union { CYBinding *binding_; }
50 %union { CYBindings *bindings_; }
51 %union { CYBoolean *boolean_; }
52 %union { CYBraced *braced_; }
53 %union { CYClause *clause_; }
54 %union { cy::Syntax::Catch *catch_; }
55 %union { CYClassTail *classTail_; }
56 %union { CYComprehension *comprehension_; }
57 %union { CYElement *element_; }
58 %union { CYEnumConstant *constant_; }
59 %union { CYExpression *expression_; }
60 %union { CYFalse *false_; }
61 %union { CYVariable *variable_; }
62 %union { CYFinally *finally_; }
63 %union { CYForInitializer *for_; }
64 %union { CYForInInitializer *forin_; }
65 %union { CYFunctionParameter *functionParameter_; }
66 %union { CYIdentifier *identifier_; }
67 %union { CYImportSpecifier *import_; }
68 %union { CYInfix *infix_; }
69 %union { CYLiteral *literal_; }
70 %union { CYMethod *method_; }
71 %union { CYModule *module_; }
72 %union { CYNull *null_; }
73 %union { CYNumber *number_; }
74 %union { CYParenthetical *parenthetical_; }
75 %union { CYProperty *property_; }
76 %union { CYPropertyName *propertyName_; }
77 %union { CYTypeSigning signing_; }
78 %union { CYSpan *span_; }
79 %union { CYStatement *statement_; }
80 %union { CYString *string_; }
81 %union { CYTarget *target_; }
82 %union { CYThis *this_; }
83 %union { CYTrue *true_; }
84 %union { CYWord *word_; }
87 %union { CYTypeIntegral *integral_; }
88 %union { CYTypeStructField *structField_; }
89 %union { CYTypeModifier *modifier_; }
90 %union { CYTypeSpecifier *specifier_; }
91 %union { CYTypedFormal *typedFormal_; }
92 %union { CYTypedLocation *typedLocation_; }
93 %union { CYTypedName *typedName_; }
94 %union { CYTypedParameter *typedParameter_; }
95 %union { CYType *typedThing_; }
99 %union { CYObjCKeyValue *keyValue_; }
100 %union { CYImplementationField *implementationField_; }
101 %union { CYMessage *message_; }
102 %union { CYMessageParameter *messageParameter_; }
103 %union { CYProtocol *protocol_; }
104 %union { CYSelectorPart *selector_; }
108 %union { CYAttribute *attribute_; }
109 %union { CYPropertyIdentifier *propertyIdentifier_; }
110 %union { CYSelector *selector_; }
116 cy::parser::semantic_type semantic_;
117 hi::Value highlight_;
120 int cylex(YYSTYPE *, CYLocation *, void *);
128 typedef cy::parser::token tk;
130 _finline int cylex_(cy::parser::semantic_type *semantic, CYLocation *location, CYDriver &driver) {
131 driver.newline_ = false;
134 int token(cylex(&data, location, driver.scanner_));
135 *semantic = data.semantic_;
139 case tk::OpenBracket:
141 driver.in_.push(false);
145 if (driver.in_.top())
150 case tk::CloseBracket:
157 if (driver.yield_.top())
158 token = tk::_yield__;
162 driver.newline_ = true;
170 #define yylex_(semantic, location, driver) ({ \
172 if (driver.hold_ == cy::parser::empty_symbol) \
173 type = yytranslate_(cylex_(semantic, location, driver)); \
175 type = driver.hold_; \
176 driver.hold_ = cy::parser::empty_symbol; \
180 #define CYLEX() do if (yyla.empty()) { \
181 YYCDEBUG << "Mapping a token: "; \
182 yyla.type = yylex_(&yyla.value, &yyla.location, driver); \
183 YY_SYMBOL_PRINT("Next token is", yyla); \
186 #define CYMAP(to, from) do { \
188 if (yyla.type == yytranslate_(token::from)) \
189 yyla.type = yytranslate_(token::to); \
192 #define CYHLD(location, token) do { \
193 if (driver.hold_ != empty_symbol) \
194 CYERR(location, "unexpected hold"); \
195 driver.hold_ = yyla.type; \
196 yyla.type = yytranslate_(token); \
199 #define CYERR(location, message) do { \
200 error(location, message); \
204 #define CYEOK() do { \
206 driver.errors_.pop_back(); \
209 #define CYNOT(location) \
210 CYERR(location, "unimplemented feature")
212 #define CYMPT(location) do { \
213 if (!yyla.empty() && yyla.type_get() != yyeof_) \
214 CYERR(location, "unexpected lookahead"); \
224 @$.begin.filename = @$.end.filename = &driver.filename_;
226 switch (driver.mark_) {
228 driver.hold_ = yytranslate_(token::MarkScript);
231 driver.hold_ = yytranslate_(token::MarkModule);
233 case CYMarkExpression:
234 driver.hold_ = yytranslate_(token::MarkExpression);
242 %define api.location.type { CYLocation }
249 %param { CYDriver &driver }
251 /* Token Declarations {{{ */
257 %token XMLAttributeValue
259 %token XMLTagCharacters
265 %token LeftRight "<>"
266 %token LeftSlashRight "</>"
268 %token SlashRight "/>"
269 %token LeftSlash "</"
271 %token PeriodPeriod ".."
274 @begin E4X ObjectiveC
279 %token AmpersandAmpersand "&&"
280 %token AmpersandEqual "&="
282 %token CarrotEqual "^="
284 %token EqualEqual "=="
285 %token EqualEqualEqual "==="
286 %token EqualRight "=>"
287 %token Exclamation "!"
288 %token ExclamationEqual "!="
289 %token ExclamationEqualEqual "!=="
291 %token HyphenEqual "-="
292 %token HyphenHyphen "--"
293 %token HyphenRight "->"
295 %token LeftEqual "<="
297 %token LeftLeftEqual "<<="
299 %token PercentEqual "%="
301 %token PeriodPeriodPeriod "..."
303 %token PipeEqual "|="
306 %token PlusEqual "+="
308 %token QuestionPeriod "?."
310 %token RightEqual ">="
311 %token RightRight ">>"
312 %token RightRightEqual ">>="
313 %token RightRightRight ">>>"
314 %token RightRightRightEqual ">>>="
316 %token SlashEqual "/="
318 %token StarEqual "*="
322 %token ColonColon "::"
333 %token CloseParen ")"
336 %token OpenBrace_ ";{"
337 %token OpenBrace_let "let {"
338 %token CloseBrace "}"
340 %token OpenBracket "["
341 %token OpenBracket_let "let ["
342 %token CloseBracket "]"
344 %token At_error_ "@error"
347 %token At_class_ "@class"
351 %token _typedef_ "typedef"
352 %token _unsigned_ "unsigned"
353 %token _signed_ "signed"
354 %token _struct_ "struct"
355 %token _extern_ "extern"
359 %token At_encode_ "@encode"
363 %token At_implementation_ "@implementation"
364 %token At_import_ "@import"
365 %token At_end_ "@end"
366 %token At_selector_ "@selector"
367 %token At_null_ "@null"
368 %token At_YES_ "@YES"
370 %token At_true_ "@true"
371 %token At_false_ "@false"
376 %token _false_ "false"
381 %token _break_ "break"
383 %token _catch_ "catch"
384 %token _class_ "class"
385 %token _class__ ";class"
386 %token _const_ "const"
387 %token _continue_ "continue"
388 %token _debugger_ "debugger"
389 %token _default_ "default"
390 %token _delete_ "delete"
394 %token _export_ "export"
395 %token _extends_ "extends"
396 %token _finally_ "finally"
398 %token _function_ "function"
399 %token _function__ ";function"
401 %token _import_ "import"
404 %token _Infinity_ "Infinity"
405 %token _instanceof_ "instanceof"
407 %token _return_ "return"
408 %token _super_ "super"
409 %token _switch_ "switch"
410 %token _target_ "target"
412 %token _throw_ "throw"
414 %token _typeof_ "typeof"
417 %token _while_ "while"
420 %token _abstract_ "abstract"
421 %token _await_ "await"
422 %token _boolean_ "boolean"
425 %token _constructor_ "constructor"
426 %token _double_ "double"
428 %token _final_ "final"
429 %token _float_ "float"
433 %token _implements_ "implements"
435 %token ___int128_ "__int128"
436 %token _interface_ "interface"
440 %token _native_ "native"
441 %token _package_ "package"
442 %token _private_ "private"
443 %token _protected_ "protected"
444 %token ___proto___ "__proto__"
445 %token _prototype_ "prototype"
446 %token _public_ "public"
448 %token _short_ "short"
449 %token _static_ "static"
450 %token _synchronized_ "synchronized"
451 %token _throws_ "throws"
452 %token _transient_ "transient"
453 %token _typeid_ "typeid"
454 %token _volatile_ "volatile"
455 %token _yield_ "yield"
456 %token _yield__ "!yield"
458 %token _undefined_ "undefined"
474 %token _namespace_ "namespace"
479 %token YieldStar "yield *"
481 %token <identifier_> Identifier_
482 %token <number_> NumericLiteral
483 %token <string_> StringLiteral
484 %token <literal_> RegularExpressionLiteral_
486 %token <string_> NoSubstitutionTemplate
487 %token <string_> TemplateHead
488 %token <string_> TemplateMiddle
489 %token <string_> TemplateTail
491 %type <target_> AccessExpression
492 %type <expression_> AdditiveExpression
493 %type <argument_> ArgumentList_
494 %type <argument_> ArgumentList
495 %type <argument_> ArgumentListOpt
496 %type <argument_> Arguments
497 %type <target_> ArrayComprehension
498 %type <element_> ArrayElement
499 %type <literal_> ArrayLiteral
500 %type <expression_> ArrowFunction
501 %type <functionParameter_> ArrowParameters
502 %type <expression_> AssignmentExpression
503 %type <identifier_> BindingIdentifier
504 %type <identifier_> BindingIdentifierOpt
505 %type <bindings_> BindingList_
506 %type <bindings_> BindingList
507 %type <expression_> BitwiseANDExpression
508 %type <statement_> Block
509 %type <statement_> BlockStatement
510 %type <boolean_> BooleanLiteral
511 %type <binding_> BindingElement
512 %type <expression_> BitwiseORExpression
513 %type <expression_> BitwiseXORExpression
514 %type <target_> BracedExpression_
515 %type <target_> BracedExpression
516 %type <statement_> BreakStatement
517 %type <statement_> BreakableStatement
518 %type <expression_> CallExpression_
519 %type <target_> CallExpression
520 %type <clause_> CaseBlock
521 %type <clause_> CaseClause
522 %type <clause_> CaseClausesOpt
524 %type <identifier_> CatchParameter
525 %type <statement_> ClassDeclaration
526 %type <target_> ClassExpression
527 %type <classTail_> ClassHeritage
528 %type <classTail_> ClassHeritageOpt
529 %type <classTail_> ClassTail
530 %type <target_> Comprehension
531 %type <comprehension_> ComprehensionFor
532 %type <comprehension_> ComprehensionIf
533 %type <comprehension_> ComprehensionTail
534 %type <propertyName_> ComputedPropertyName
535 %type <expression_> ConditionalExpression
536 %type <statement_> ContinueStatement
537 %type <statement_> ConciseBody
538 %type <parenthetical_> CoverParenthesizedExpressionAndArrowParameterList
539 %type <statement_> DebuggerStatement
540 %type <statement_> Declaration_
541 %type <statement_> Declaration
542 %type <clause_> DefaultClause
543 %type <element_> ElementList_
544 %type <element_> ElementList
545 %type <element_> ElementListOpt
546 %type <statement_> ElseStatementOpt
547 %type <for_> EmptyStatement
548 %type <expression_> EqualityExpression
549 %type <expression_> Expression
550 %type <expression_> ExpressionOpt
551 %type <for_> ExpressionStatement_
552 %type <statement_> ExpressionStatement
553 %type <finally_> Finally
554 %type <binding_> ForBinding
555 %type <forin_> ForDeclaration
556 %type <forin_> ForInStatementInitializer
557 %type <for_> ForStatementInitializer
558 %type <binding_> FormalParameter
559 %type <functionParameter_> FormalParameterList_
560 %type <functionParameter_> FormalParameterList
561 %type <functionParameter_> FormalParameters
562 %type <string_> FromClause
563 %type <statement_> FunctionBody
564 %type <statement_> FunctionDeclaration
565 %type <target_> FunctionExpression
566 %type <statement_> FunctionStatementList
567 %type <statement_> GeneratorBody
568 %type <statement_> GeneratorDeclaration
569 %type <target_> GeneratorExpression
570 %type <method_> GeneratorMethod
571 %type <statement_> HoistableDeclaration
572 %type <identifier_> Identifier
573 %type <identifier_> IdentifierNoOf
574 %type <identifier_> IdentifierTypeNoOf
575 %type <word_> IdentifierName
576 %type <variable_> IdentifierReference
577 %type <statement_> IfStatement
578 %type <import_> ImportClause
579 %type <statement_> ImportDeclaration
580 %type <import_> ImportSpecifier
581 %type <identifier_> ImportedBinding
582 %type <import_> ImportedDefaultBinding
583 %type <import_> ImportsList_
584 %type <import_> ImportsList
585 %type <import_> ImportsListOpt
586 %type <expression_> Initializer
587 %type <expression_> InitializerOpt
588 %type <statement_> IterationStatement
589 %type <identifier_> LabelIdentifier
590 %type <statement_> LabelledItem
591 %type <statement_> LabelledStatement
592 %type <assignment_> LeftHandSideAssignment
593 %type <target_> LeftHandSideExpression
594 %type <bool_> LetOrConst
595 %type <binding_> LexicalBinding
596 %type <for_> LexicalDeclaration_
597 %type <statement_> LexicalDeclaration
598 %type <literal_> Literal
599 %type <propertyName_> LiteralPropertyName
600 %type <expression_> LogicalANDExpression
601 %type <expression_> LogicalORExpression
602 %type <access_> MemberAccess
603 %type <target_> MemberExpression
604 %type <method_> MethodDefinition
605 %type <statement_> ModuleBody
606 %type <statement_> ModuleBodyOpt
607 %type <statement_> ModuleItem
608 %type <statement_> ModuleItemList
609 %type <statement_> ModuleItemListOpt
610 %type <module_> ModulePath
611 %type <string_> ModuleSpecifier
612 %type <expression_> MultiplicativeExpression
613 %type <import_> NameSpaceImport
614 %type <import_> NamedImports
615 %type <target_> NewExpression
616 %type <null_> NullLiteral
617 %type <literal_> ObjectLiteral
618 %type <expression_> PostfixExpression
619 %type <target_> PrimaryExpression
620 %type <propertyName_> PropertyName
621 %type <property_> PropertyDefinition
622 %type <property_> PropertyDefinitionList_
623 %type <property_> PropertyDefinitionList
624 %type <property_> PropertyDefinitionListOpt
625 %type <functionParameter_> PropertySetParameterList
626 %type <literal_> RegularExpressionLiteral
627 %type <bool_> RegularExpressionSlash
628 %type <expression_> RelationalExpression
629 %type <statement_> ReturnStatement
630 %type <braced_> BracedParameter
631 %type <functionParameter_> RubyProcParameterList_
632 %type <functionParameter_> RubyProcParameterList
633 %type <functionParameter_> RubyProcParameters
634 %type <functionParameter_> RubyProcParametersOpt
635 %type <statement_> Script
636 %type <statement_> ScriptBody
637 %type <statement_> ScriptBodyOpt
638 %type <expression_> ShiftExpression
639 %type <binding_> SingleNameBinding
640 %type <statement_> Statement__
641 %type <statement_> Statement_
642 %type <statement_> Statement
643 %type <statement_> StatementList
644 %type <statement_> StatementListOpt
645 %type <statement_> StatementListItem
646 %type <functionParameter_> StrictFormalParameters
647 %type <target_> SuperCall
648 %type <target_> SuperProperty
649 %type <statement_> SwitchStatement
650 %type <target_> TemplateLiteral
651 %type <span_> TemplateSpans
652 %type <statement_> ThrowStatement
653 %type <statement_> TryStatement
654 %type <expression_> UnaryExpression_
655 %type <expression_> UnaryExpression
656 %type <binding_> VariableDeclaration
657 %type <bindings_> VariableDeclarationList_
658 %type <bindings_> VariableDeclarationList
659 %type <for_> VariableStatement_
660 %type <statement_> VariableStatement
661 %type <statement_> WithStatement
663 %type <word_> WordNoUnary
665 %type <word_> WordOpt
667 %type <expression_> YieldExpression
670 %type <constant_> EnumConstantListOpt_
671 %type <constant_> EnumConstantListOpt
672 %type <statement_> ExternC
673 %type <statement_> ExternCStatement
674 %type <statement_> ExternCStatementListOpt
675 %type <identifier_> IdentifierType
676 %type <identifier_> IdentifierTypeOpt
677 %type <target_> IndirectExpression
678 %type <number_> IntegerNumber
679 %type <integral_> IntegerType
680 %type <integral_> IntegerTypeOpt
681 %type <typedName_> PrefixedType
682 %type <specifier_> PrimitiveReference
683 %type <specifier_> PrimitiveType
684 %type <structField_> StructFieldListOpt
685 %type <typedName_> SuffixedType
686 %type <typedName_> SuffixedTypeOpt
687 %type <statement_> TypeDefinition
688 %type <typedName_> TypeSignifier
689 %type <typedName_> TypeSignifierNone
690 %type <typedName_> TypeSignifierOpt
691 %type <signing_> TypeSigning
692 %type <modifier_> ParameterTail
693 %type <modifier_> TypeQualifierLeft
694 %type <modifier_> TypeQualifierLeftOpt
695 %type <typedName_> TypeQualifierRight
696 %type <typedName_> TypeQualifierRightOpt
697 %type <typedName_> TypedIdentifierDefinition
698 %type <typedThing_> TypedIdentifierEncoding
699 %type <typedName_> TypedIdentifierField
700 %type <typedName_> TypedIdentifierMaybe
701 %type <typedLocation_> TypedIdentifierNo
702 %type <typedName_> TypedIdentifierTagged
703 %type <typedName_> TypedIdentifierYes
704 %type <typedFormal_> TypedParameterList_
705 %type <typedFormal_> TypedParameterList
706 %type <typedFormal_> TypedParameterListOpt
707 %type <typedParameter_> TypedParameters
711 %type <expression_> AssignmentExpressionClassic
712 %type <expression_> BoxableExpression
713 %type <statement_> CategoryStatement
714 %type <expression_> ClassSuperOpt
715 %type <expression_> ConditionalExpressionClassic
716 %type <message_> ClassMessageDeclaration
717 %type <message_> ClassMessageDeclarationListOpt
718 %type <protocol_> ClassProtocolListOpt
719 %type <protocol_> ClassProtocols
720 %type <protocol_> ClassProtocolsOpt
721 %type <implementationField_> ImplementationFieldListOpt
722 %type <statement_> ImplementationStatement
723 %type <keyValue_> KeyValuePairList_
724 %type <keyValue_> KeyValuePairList
725 %type <keyValue_> KeyValuePairListOpt
726 %type <target_> MessageExpression
727 %type <messageParameter_> MessageParameter
728 %type <messageParameter_> MessageParameters
729 %type <messageParameter_> MessageParameterList
730 %type <messageParameter_> MessageParameterListOpt
731 %type <bool_> MessageScope
732 %type <argument_> SelectorCall_
733 %type <argument_> SelectorCall
734 %type <selector_> SelectorExpression_
735 %type <selector_> SelectorExpression
736 %type <selector_> SelectorExpressionOpt
737 %type <argument_> SelectorList
738 %type <word_> SelectorWordOpt
739 %type <typedThing_> TypeOpt
740 %type <argument_> VariadicCall
744 %type <propertyIdentifier_> PropertyIdentifier_
745 %type <selector_> PropertySelector_
746 %type <selector_> PropertySelector
747 %type <identifier_> QualifiedIdentifier_
748 %type <identifier_> QualifiedIdentifier
749 %type <identifier_> WildcardIdentifier
750 %type <identifier_> XMLComment
751 %type <identifier_> XMLCDATA
752 %type <identifier_> XMLElement
753 %type <identifier_> XMLElementContent
754 %type <identifier_> XMLMarkup
755 %type <identifier_> XMLPI
757 %type <attribute_> AttributeIdentifier
758 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
759 %type <expression_> PropertyIdentifier
760 %type <expression_> XMLListInitilizer
761 %type <expression_> XMLInitilizer
764 /* Token Priorities {{{ */
775 %token MarkExpression
782 | MarkExpression Expression[expression] { driver.context_ = $expression; }
785 /* Lexer State {{{ */
786 LexPushInOn: { driver.in_.push(true); };
787 LexPushInOff: { driver.in_.push(false); };
788 LexPopIn: { driver.in_.pop(); };
790 LexPushReturnOn: { driver.return_.push(true); };
791 LexPopReturn: { driver.return_.pop(); };
792 Return: "return"[return] { if (!driver.return_.top()) CYERR(@return, "invalid return"); };
794 LexPushSuperOn: { driver.super_.push(true); };
795 LexPushSuperOff: { driver.super_.push(false); };
796 LexPopSuper: { driver.super_.pop(); };
797 Super: "super"[super] { if (!driver.super_.top()) CYERR(@super, "invalid super"); };
799 LexPushYieldOn: { driver.yield_.push(true); };
800 LexPushYieldOff: { driver.yield_.push(false); };
801 LexPopYield: { driver.yield_.pop(); };
804 : { CYLEX(); if (driver.newline_) { CYHLD(@$, tk::NewLine); } }
808 : { CYLEX(); CYHLD(@$, driver.newline_ ? tk::NewLine : tk::__); }
812 : { CYMAP(YieldStar, Star); }
816 : { CYMAP(OpenBrace_, OpenBrace); }
820 : { CYMAP(_class__, _class_); }
824 : { CYMAP(_function__, _function_); }
828 : LexNoBrace LexNoClass LexNoFunction
831 /* Virtual Tokens {{{ */
837 /* 11.6 Names and Keywords {{{ */
839 : Word[pass] { $$ = $pass; }
840 | "for" { $$ = CYNew CYWord("for"); }
841 | "in" { $$ = CYNew CYWord("in"); }
842 | "instanceof" { $$ = CYNew CYWord("instanceof"); }
846 : IdentifierNoOf[pass] { $$ = $pass; }
847 | "break" { $$ = CYNew CYWord("break"); }
848 | "case" { $$ = CYNew CYWord("case"); }
849 | "catch" { $$ = CYNew CYWord("catch"); }
850 | "class" LexOf { $$ = CYNew CYWord("class"); }
851 | ";class" { $$ = CYNew CYWord("class"); }
852 | "const" { $$ = CYNew CYWord("const"); }
853 | "continue" { $$ = CYNew CYWord("continue"); }
854 | "debugger" { $$ = CYNew CYWord("debugger"); }
855 | "default" { $$ = CYNew CYWord("default"); }
856 | "do" { $$ = CYNew CYWord("do"); }
857 | "else" { $$ = CYNew CYWord("else"); }
858 | "enum" { $$ = CYNew CYWord("enum"); }
859 | "export" { $$ = CYNew CYWord("export"); }
860 | "extends" { $$ = CYNew CYWord("extends"); }
861 | "false" { $$ = CYNew CYWord("false"); }
862 | "finally" { $$ = CYNew CYWord("finally"); }
863 | "function" LexOf { $$ = CYNew CYWord("function"); }
864 | "if" { $$ = CYNew CYWord("if"); }
865 | "import" { $$ = CYNew CYWord("import"); }
866 | "!in" { $$ = CYNew CYWord("in"); }
867 | "!of" { $$ = CYNew CYWord("of"); }
868 | "null" { $$ = CYNew CYWord("null"); }
869 | "return" { $$ = CYNew CYWord("return"); }
870 | "super" { $$ = CYNew CYWord("super"); }
871 | "switch" { $$ = CYNew CYWord("switch"); }
872 | "this" { $$ = CYNew CYWord("this"); }
873 | "throw" { $$ = CYNew CYWord("throw"); }
874 | "true" { $$ = CYNew CYWord("true"); }
875 | "try" { $$ = CYNew CYWord("try"); }
876 | "var" { $$ = CYNew CYWord("var"); }
877 | "while" { $$ = CYNew CYWord("while"); }
878 | "with" { $$ = CYNew CYWord("with"); }
882 : WordNoUnary[pass] { $$ = $pass; }
883 | "delete" { $$ = CYNew CYWord("delete"); }
884 | "typeof" { $$ = CYNew CYWord("typeof"); }
885 | "void" { $$ = CYNew CYWord("void"); }
886 | "yield" { $$ = CYNew CYIdentifier("yield"); }
891 : Word[pass] { $$ = $pass; }
896 /* 11.8.1 Null Literals {{{ */
898 : "null" { $$ = CYNew CYNull(); }
901 /* 11.8.2 Boolean Literals {{{ */
903 : "true" { $$ = CYNew CYTrue(); }
904 | "false" { $$ = CYNew CYFalse(); }
907 /* 11.8.5 Regular Expression Literals {{{ */
908 RegularExpressionSlash
909 : "/" { $$ = false; }
910 | "/=" { $$ = true; }
913 RegularExpressionLiteral
914 : RegularExpressionSlash[equals] { CYMPT(@$); driver.SetRegEx($equals); } RegularExpressionLiteral_[pass] { $$ = $pass; }
918 /* 11.9 Automatic Semicolon Insertion {{{ */
920 : { driver.Warning(@$, "warning, automatic semi-colon insertion required"); }
929 : LexNewLineOrNot "\n"
935 : LexNewLineOrNot "\n" StrictSemi
936 | NewLineNot LexOf Terminator
942 | error { if (yyla.type_get() != yyeof_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
948 | error { if (yyla.type_get() != yyeof_ && yyla.type != yytranslate_(token::CloseBrace) && !driver.newline_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
953 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
957 /* 12.1 Identifiers {{{ */
959 : Identifier[pass] { $$ = CYNew CYVariable($pass); }
960 | "yield" { $$ = CYNew CYVariable(CYNew CYIdentifier("yield")); }
964 : LexOf IdentifierNoOf[pass] { $$ = $pass; }
965 | LexOf "!of" { $$ = CYNew CYIdentifier("of"); }
966 | LexOf "yield" { $$ = CYNew CYIdentifier("yield"); }
970 : BindingIdentifier[pass] { $$ = $pass; }
971 | LexOf { $$ = NULL; }
975 : Identifier[pass] { $$ = $pass; }
976 | "yield" { $$ = CYNew CYIdentifier("yield"); }
980 : Identifier_[pass] { $$ = $pass; }
981 | "abstract" { $$ = CYNew CYIdentifier("abstract"); }
982 | "as" { $$ = CYNew CYIdentifier("as"); }
983 | "await" { $$ = CYNew CYIdentifier("await"); }
984 | "boolean" { $$ = CYNew CYIdentifier("boolean"); }
985 | "byte" { $$ = CYNew CYIdentifier("byte"); }
986 | "constructor" { $$ = CYNew CYIdentifier("constructor"); }
987 | "each" { $$ = CYNew CYIdentifier("each"); }
988 | "eval" { $$ = CYNew CYIdentifier("eval"); }
989 | "final" { $$ = CYNew CYIdentifier("final"); }
990 | "from" { $$ = CYNew CYIdentifier("from"); }
991 | "get" { $$ = CYNew CYIdentifier("get"); }
992 | "goto" { $$ = CYNew CYIdentifier("goto"); }
993 | "implements" { $$ = CYNew CYIdentifier("implements"); }
994 | "Infinity" { $$ = CYNew CYIdentifier("Infinity"); }
995 | "interface" { $$ = CYNew CYIdentifier("interface"); }
996 | "let" { $$ = CYNew CYIdentifier("let"); }
997 | "!let" LexBind LexOf { $$ = CYNew CYIdentifier("let"); }
998 | "native" { $$ = CYNew CYIdentifier("native"); }
999 | "package" { $$ = CYNew CYIdentifier("package"); }
1000 | "private" { $$ = CYNew CYIdentifier("private"); }
1001 | "protected" { $$ = CYNew CYIdentifier("protected"); }
1002 | "__proto__" { $$ = CYNew CYIdentifier("__proto__"); }
1003 | "prototype" { $$ = CYNew CYIdentifier("prototype"); }
1004 | "public" { $$ = CYNew CYIdentifier("public"); }
1005 | "set" { $$ = CYNew CYIdentifier("set"); }
1006 | "synchronized" { $$ = CYNew CYIdentifier("synchronized"); }
1007 | "target" { $$ = CYNew CYIdentifier("target"); }
1008 | "throws" { $$ = CYNew CYIdentifier("throws"); }
1009 | "transient" { $$ = CYNew CYIdentifier("transient"); }
1010 | "typeid" { $$ = CYNew CYIdentifier("typeid"); }
1011 | "undefined" { $$ = CYNew CYIdentifier("undefined"); }
1013 | "bool" { $$ = CYNew CYIdentifier("bool"); }
1014 | "BOOL" { $$ = CYNew CYIdentifier("BOOL"); }
1015 | "id" { $$ = CYNew CYIdentifier("id"); }
1016 | "SEL" { $$ = CYNew CYIdentifier("SEL"); }
1022 : IdentifierTypeNoOf[pass] { $$ = $pass; }
1023 | "of" { $$ = CYNew CYIdentifier("of"); }
1027 : IdentifierType[pass] { $$ = $pass; }
1033 : IdentifierTypeNoOf
1034 | "char" { $$ = CYNew CYIdentifier("char"); }
1035 | "double" { $$ = CYNew CYIdentifier("double"); }
1036 | "float" { $$ = CYNew CYIdentifier("float"); }
1037 | "int" { $$ = CYNew CYIdentifier("int"); }
1038 | "__int128" { $$ = CYNew CYIdentifier("__int128"); }
1039 | "long" { $$ = CYNew CYIdentifier("long"); }
1040 | "short" { $$ = CYNew CYIdentifier("short"); }
1041 | "static" { $$ = CYNew CYIdentifier("static"); }
1042 | "volatile" { $$ = CYNew CYIdentifier("volatile"); }
1044 | "signed" { $$ = CYNew CYIdentifier("signed"); }
1045 | "unsigned" { $$ = CYNew CYIdentifier("unsigned"); }
1048 | "nil" { $$ = CYNew CYIdentifier("nil"); }
1049 | "NO" { $$ = CYNew CYIdentifier("NO"); }
1050 | "NULL" { $$ = CYNew CYIdentifier("NULL"); }
1051 | "YES" { $$ = CYNew CYIdentifier("YES"); }
1056 : IdentifierNoOf[pass] { $$ = $pass; }
1057 | "of" { $$ = CYNew CYIdentifier("of"); }
1058 | "!of" { $$ = CYNew CYIdentifier("of"); }
1061 /* 12.2 Primary Expression {{{ */
1063 : "this" { $$ = CYNew CYThis(); }
1064 | IdentifierReference[pass] { $$ = $pass; }
1065 | Literal[pass] { $$ = $pass; }
1066 | ArrayLiteral[pass] { $$ = $pass; }
1067 | ObjectLiteral[pass] { $$ = $pass; }
1068 | FunctionExpression[pass] { $$ = $pass; }
1069 | ClassExpression[pass] { $$ = $pass; }
1070 | GeneratorExpression[pass] { $$ = $pass; }
1071 | RegularExpressionLiteral[pass] { $$ = $pass; }
1072 | TemplateLiteral[pass] { $$ = $pass; }
1073 | CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) CYERR(@cover, "invalid parenthetical"); $$ = $cover; }
1074 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
1077 CoverParenthesizedExpressionAndArrowParameterList
1078 : "(" Expression[expression] ")" { $$ = CYNew CYParenthetical($expression); }
1079 | "(" LexOf ")" { $$ = NULL; }
1080 | "(" LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1081 | "(" Expression "," LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1084 /* 12.2.4 Literals {{{ */
1086 : NullLiteral[pass] { $$ = $pass; }
1087 | BooleanLiteral[pass] { $$ = $pass; }
1088 | NumericLiteral[pass] { $$ = $pass; }
1089 | StringLiteral[pass] { $$ = $pass; }
1092 /* 12.2.5 Array Initializer {{{ */
1094 : "[" ElementListOpt[elements] "]" { $$ = CYNew CYArray($elements); }
1098 : AssignmentExpression[value] { $$ = CYNew CYElementValue($value); }
1099 | LexOf "..." AssignmentExpression[values] { $$ = CYNew CYElementSpread($values); }
1103 : "," ElementListOpt[elements] { $$ = $elements; }
1108 : ArrayElement[element] ElementList_[next] { $$ = $element; $$->SetNext($next); }
1109 | LexOf "," ElementListOpt[next] { $$ = CYNew CYElementValue(NULL, $next); }
1113 : ElementList[pass] { $$ = $pass; }
1114 | LexOf { $$ = NULL; }
1117 /* 12.2.6 Object Initializer {{{ */
1119 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYObject($properties); }
1122 PropertyDefinitionList_
1123 : "," PropertyDefinitionListOpt[properties] { $$ = $properties; }
1127 PropertyDefinitionList
1128 : PropertyDefinition[property] PropertyDefinitionList_[next] { $property->SetNext($next); $$ = $property; }
1131 PropertyDefinitionListOpt
1132 : PropertyDefinitionList[properties] { $$ = $properties; }
1137 : IdentifierReference[value] { $$ = CYNew CYPropertyValue($value->name_, $value); }
1138 | CoverInitializedName[name] { CYNOT(@$); }
1139 | PropertyName[name] ":" AssignmentExpression[value] { $$ = CYNew CYPropertyValue($name, $value); }
1140 | MethodDefinition[pass] { $$ = $pass; }
1144 : LiteralPropertyName[pass] { $$ = $pass; }
1145 | ComputedPropertyName[pass] { $$ = $pass; }
1149 : IdentifierName[pass] { $$ = $pass; }
1150 | StringLiteral[pass] { $$ = $pass; }
1151 | NumericLiteral[pass] { $$ = $pass; }
1154 ComputedPropertyName
1155 : "[" AssignmentExpression[expression] "]" { $$ = CYNew CYComputed($expression); }
1158 CoverInitializedName
1159 : IdentifierReference Initializer
1163 : "=" AssignmentExpression[initializer] { $$ = $initializer; }
1167 : Initializer[pass] { $$ = $pass; }
1171 /* 12.2.9 Template Literals {{{ */
1173 : NoSubstitutionTemplate[string] { $$ = CYNew CYTemplate($string, NULL); }
1174 | TemplateHead[string] LexPushInOff TemplateSpans[spans] { $$ = CYNew CYTemplate($string, $spans); }
1178 : Expression[value] TemplateMiddle[string] TemplateSpans[spans] { $$ = CYNew CYSpan($value, $string, $spans); }
1179 | Expression[value] TemplateTail[string] LexPopIn { $$ = CYNew CYSpan($value, $string, NULL); }
1183 /* 12.3 Left-Hand-Side Expressions {{{ */
1185 : "[" Expression[property] "]" { $$ = CYNew CYDirectMember(NULL, $property); }
1186 | "." IdentifierName[property] { $$ = CYNew CYDirectMember(NULL, CYNew CYString($property)); }
1187 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
1188 | TemplateLiteral { CYNOT(@$); }
1192 : PrimaryExpression[pass] { $$ = $pass; }
1193 | MemberExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1194 | SuperProperty[pass] { $$ = $pass; }
1195 | MetaProperty { CYNOT(@$); }
1196 | "new" MemberExpression[constructor] Arguments[arguments] { $$ = CYNew cy::Syntax::New($constructor, $arguments); }
1200 : Super "[" Expression[property] "]" { $$ = CYNew CYSuperAccess($property); }
1201 | Super "." IdentifierName[property] { $$ = CYNew CYSuperAccess(CYNew CYString($property)); }
1209 : "new" "." "target"
1213 : MemberExpression[pass] { $$ = $pass; }
1214 | "new" NewExpression[expression] { $$ = CYNew cy::Syntax::New($expression, NULL); }
1218 : MemberExpression[pass] { $$ = $pass; }
1219 | CallExpression[pass] { $$ = $pass; }
1223 : CallExpression_[function] Arguments[arguments] { if (!$function->Eval()) $$ = CYNew CYCall($function, $arguments); else $$ = CYNew CYEval($arguments); }
1224 | SuperCall[pass] { $$ = $pass; }
1225 | CallExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1229 : Super Arguments[arguments] { $$ = CYNew CYSuperCall($arguments); }
1233 : "(" ArgumentListOpt[arguments] ")" { $$ = $arguments; }
1237 : "," ArgumentList[arguments] { $$ = $arguments; }
1242 : AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
1243 | LexOf "..." AssignmentExpression { CYNOT(@$); }
1247 : ArgumentList[pass] { $$ = $pass; }
1248 | LexOf { $$ = NULL; }
1252 : NewExpression[pass] { $$ = $pass; }
1253 | CallExpression[pass] { $$ = $pass; }
1256 LeftHandSideExpression
1257 : BracedExpression[pass] { $$ = $pass; }
1259 | IndirectExpression[pass] { $$ = $pass; }
1263 /* 12.4 Postfix Expressions {{{ */
1265 : BracedExpression[pass] { $$ = $pass; }
1266 | AccessExpression[lhs] LexNewLineOrOpt "++" { $$ = CYNew CYPostIncrement($lhs); }
1267 | AccessExpression[lhs] LexNewLineOrOpt "--" { $$ = CYNew CYPostDecrement($lhs); }
1270 /* 12.5 Unary Operators {{{ */
1272 : "delete" UnaryExpression[rhs] { $$ = CYNew CYDelete($rhs); }
1273 | "void" UnaryExpression[rhs] { $$ = CYNew CYVoid($rhs); }
1274 | "typeof" UnaryExpression[rhs] { $$ = CYNew CYTypeOf($rhs); }
1275 | "++" UnaryExpression[rhs] { $$ = CYNew CYPreIncrement($rhs); }
1276 | "--" UnaryExpression[rhs] { $$ = CYNew CYPreDecrement($rhs); }
1277 | "+" UnaryExpression[rhs] { $$ = CYNew CYAffirm($rhs); }
1278 | "-" UnaryExpression[rhs] { $$ = CYNew CYNegate($rhs); }
1279 | "~" UnaryExpression[rhs] { $$ = CYNew CYBitwiseNot($rhs); }
1280 | "!" UnaryExpression[rhs] { $$ = CYNew CYLogicalNot($rhs); }
1284 : PostfixExpression[expression] { $$ = $expression; }
1285 | UnaryExpression_[pass] { $$ = $pass; }
1288 /* 12.6 Multiplicative Operators {{{ */
1289 MultiplicativeExpression
1290 : UnaryExpression[pass] { $$ = $pass; }
1291 | MultiplicativeExpression[lhs] "*" UnaryExpression[rhs] { $$ = CYNew CYMultiply($lhs, $rhs); }
1292 | MultiplicativeExpression[lhs] "/" UnaryExpression[rhs] { $$ = CYNew CYDivide($lhs, $rhs); }
1293 | MultiplicativeExpression[lhs] "%" UnaryExpression[rhs] { $$ = CYNew CYModulus($lhs, $rhs); }
1296 /* 12.7 Additive Operators {{{ */
1298 : MultiplicativeExpression[pass] { $$ = $pass; }
1299 | AdditiveExpression[lhs] "+" MultiplicativeExpression[rhs] { $$ = CYNew CYAdd($lhs, $rhs); }
1300 | AdditiveExpression[lhs] "-" MultiplicativeExpression[rhs] { $$ = CYNew CYSubtract($lhs, $rhs); }
1303 /* 12.8 Bitwise Shift Operators {{{ */
1305 : AdditiveExpression[pass] { $$ = $pass; }
1306 | ShiftExpression[lhs] "<<" AdditiveExpression[rhs] { $$ = CYNew CYShiftLeft($lhs, $rhs); }
1307 | ShiftExpression[lhs] ">>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightSigned($lhs, $rhs); }
1308 | ShiftExpression[lhs] ">>>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightUnsigned($lhs, $rhs); }
1311 /* 12.9 Relational Operators {{{ */
1312 RelationalExpression
1313 : ShiftExpression[pass] { $$ = $pass; }
1314 | RelationalExpression[lhs] "<" ShiftExpression[rhs] { $$ = CYNew CYLess($lhs, $rhs); }
1315 | RelationalExpression[lhs] ">" ShiftExpression[rhs] { $$ = CYNew CYGreater($lhs, $rhs); }
1316 | RelationalExpression[lhs] "<=" ShiftExpression[rhs] { $$ = CYNew CYLessOrEqual($lhs, $rhs); }
1317 | RelationalExpression[lhs] ">=" ShiftExpression[rhs] { $$ = CYNew CYGreaterOrEqual($lhs, $rhs); }
1318 | RelationalExpression[lhs] "instanceof" ShiftExpression[rhs] { $$ = CYNew CYInstanceOf($lhs, $rhs); }
1319 | RelationalExpression[lhs] "in" ShiftExpression[rhs] { $$ = CYNew CYIn($lhs, $rhs); }
1322 /* 12.10 Equality Operators {{{ */
1324 : RelationalExpression[pass] { $$ = $pass; }
1325 | EqualityExpression[lhs] "==" RelationalExpression[rhs] { $$ = CYNew CYEqual($lhs, $rhs); }
1326 | EqualityExpression[lhs] "!=" RelationalExpression[rhs] { $$ = CYNew CYNotEqual($lhs, $rhs); }
1327 | EqualityExpression[lhs] "===" RelationalExpression[rhs] { $$ = CYNew CYIdentical($lhs, $rhs); }
1328 | EqualityExpression[lhs] "!==" RelationalExpression[rhs] { $$ = CYNew CYNotIdentical($lhs, $rhs); }
1331 /* 12.11 Binary Bitwise Operators {{{ */
1332 BitwiseANDExpression
1333 : EqualityExpression[pass] { $$ = $pass; }
1334 | BitwiseANDExpression[lhs] "&" EqualityExpression[rhs] { $$ = CYNew CYBitwiseAnd($lhs, $rhs); }
1337 BitwiseXORExpression
1338 : BitwiseANDExpression[pass] { $$ = $pass; }
1339 | BitwiseXORExpression[lhs] "^" BitwiseANDExpression[rhs] { $$ = CYNew CYBitwiseXOr($lhs, $rhs); }
1343 : BitwiseXORExpression[pass] { $$ = $pass; }
1344 | BitwiseORExpression[lhs] "|" BitwiseXORExpression[rhs] { $$ = CYNew CYBitwiseOr($lhs, $rhs); }
1347 /* 12.12 Binary Logical Operators {{{ */
1348 LogicalANDExpression
1349 : BitwiseORExpression[pass] { $$ = $pass; }
1350 | LogicalANDExpression[lhs] "&&" BitwiseORExpression[rhs] { $$ = CYNew CYLogicalAnd($lhs, $rhs); }
1354 : LogicalANDExpression[pass] { $$ = $pass; }
1355 | LogicalORExpression[lhs] "||" LogicalANDExpression[rhs] { $$ = CYNew CYLogicalOr($lhs, $rhs); }
1358 /* 12.13 Conditional Operator ( ? : ) {{{ */
1360 ConditionalExpressionClassic
1361 : LogicalORExpression[pass] { $$ = $pass; }
1362 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpressionClassic[false] { $$ = CYNew CYCondition($test, $true, $false); }
1366 ConditionalExpression
1367 : LogicalORExpression[pass] { $$ = $pass; }
1368 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpression[false] { $$ = CYNew CYCondition($test, $true, $false); }
1371 /* 12.14 Assignment Operators {{{ */
1372 LeftHandSideAssignment
1373 : LeftHandSideExpression[lhs] "=" { $$ = CYNew CYAssign($lhs, NULL); }
1374 | LeftHandSideExpression[lhs] "*=" { $$ = CYNew CYMultiplyAssign($lhs, NULL); }
1375 | LeftHandSideExpression[lhs] "/=" { $$ = CYNew CYDivideAssign($lhs, NULL); }
1376 | LeftHandSideExpression[lhs] "%=" { $$ = CYNew CYModulusAssign($lhs, NULL); }
1377 | LeftHandSideExpression[lhs] "+=" { $$ = CYNew CYAddAssign($lhs, NULL); }
1378 | LeftHandSideExpression[lhs] "-=" { $$ = CYNew CYSubtractAssign($lhs, NULL); }
1379 | LeftHandSideExpression[lhs] "<<=" { $$ = CYNew CYShiftLeftAssign($lhs, NULL); }
1380 | LeftHandSideExpression[lhs] ">>=" { $$ = CYNew CYShiftRightSignedAssign($lhs, NULL); }
1381 | LeftHandSideExpression[lhs] ">>>=" { $$ = CYNew CYShiftRightUnsignedAssign($lhs, NULL); }
1382 | LeftHandSideExpression[lhs] "&=" { $$ = CYNew CYBitwiseAndAssign($lhs, NULL); }
1383 | LeftHandSideExpression[lhs] "^=" { $$ = CYNew CYBitwiseXOrAssign($lhs, NULL); }
1384 | LeftHandSideExpression[lhs] "|=" { $$ = CYNew CYBitwiseOrAssign($lhs, NULL); }
1388 AssignmentExpressionClassic
1389 : LexOf ConditionalExpressionClassic[pass] { $$ = $pass; }
1390 | LexOf LeftHandSideAssignment[assignment] AssignmentExpressionClassic[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1394 AssignmentExpression
1395 : LexOf ConditionalExpression[pass] { $$ = $pass; }
1396 | LexOf YieldExpression[pass] { $$ = $pass; }
1397 | ArrowFunction[pass] { $$ = $pass; }
1398 | LexOf LeftHandSideAssignment[assignment] AssignmentExpression[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1401 /* 12.15 Comma Operator ( , ) {{{ */
1403 : AssignmentExpression[pass] { $$ = $pass; }
1404 | Expression[expression] "," AssignmentExpression[next] { $$ = CYNew CYCompound($expression, $next); }
1408 : Expression[pass] { $$ = $pass; }
1409 | LexOf { $$ = NULL; }
1413 /* 13 Statements and Declarations {{{ */
1415 : BlockStatement[pass] { $$ = $pass; }
1416 | VariableStatement[pass] { $$ = $pass; }
1417 | EmptyStatement[pass] { $$ = $pass; }
1418 | IfStatement[pass] { $$ = $pass; }
1419 | BreakableStatement[pass] { $$ = $pass; }
1420 | ContinueStatement[pass] { $$ = $pass; }
1421 | BreakStatement[pass] { $$ = $pass; }
1422 | ReturnStatement[pass] { $$ = $pass; }
1423 | WithStatement[pass] { $$ = $pass; }
1424 | LabelledStatement[pass] { $$ = $pass; }
1425 | ThrowStatement[pass] { $$ = $pass; }
1426 | TryStatement[pass] { $$ = $pass; }
1427 | DebuggerStatement[pass] { $$ = $pass; }
1431 : LexOf Statement__[pass] { $$ = $pass; }
1432 | ExpressionStatement[pass] { $$ = $pass; }
1436 : LexSetStatement LexLet Statement_[pass] { $$ = $pass; }
1440 : HoistableDeclaration[pass] { $$ = $pass; }
1441 | ClassDeclaration[pass] { $$ = $pass; }
1445 : LexSetStatement LexLet LexOf Declaration_[pass] { $$ = $pass; }
1446 | LexSetStatement LexicalDeclaration[pass] { $$ = $pass; }
1449 HoistableDeclaration
1450 : FunctionDeclaration[pass] { $$ = $pass; }
1451 | GeneratorDeclaration[pass] { $$ = $pass; }
1455 : IterationStatement[pass] { $$ = $pass; }
1456 | SwitchStatement[pass] { $$ = $pass; }
1459 /* 13.2 Block {{{ */
1461 : ";{" StatementListOpt[code] "}" { $$ = CYNew CYBlock($code); }
1465 : "{" StatementListOpt[code] "}" { $$ = $code; }
1469 : StatementListItem[statement] StatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1473 : StatementList[pass] { $$ = $pass; }
1474 | LexSetStatement LexLet LexOf { $$ = NULL; }
1478 : Statement[pass] { $$ = $pass; }
1479 | Declaration[pass] { $$ = $pass; }
1482 /* 13.3 Let and Const Declarations {{{ */
1484 : LetOrConst[constant] BindingList[bindings] { $$ = CYNew CYLexical($constant, $bindings); }
1488 : LexicalDeclaration_[statement] Terminator { $$ = $statement; }
1492 : { CYMAP(_let__, _let_); }
1496 : { CYMAP(_of__, _of_); }
1500 : { CYMAP(OpenBrace_let, OpenBrace); CYMAP(OpenBracket_let, OpenBracket); }
1504 : LexLet LexOf "!let" LexBind LexOf { $$ = false; }
1505 | LexLet LexOf "const" { $$ = true; }
1509 : "," LexBind BindingList[bindings] { $$ = $bindings; }
1514 : LexicalBinding[binding] BindingList_[next] { $$ = CYNew CYBindings($binding, $next); }
1518 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1519 | LexOf BindingPattern Initializer { CYNOT(@$); }
1522 /* 13.3.2 Variable Statement {{{ */
1524 : Var_ VariableDeclarationList[bindings] { $$ = CYNew CYVar($bindings); }
1528 : VariableStatement_[statement] Terminator { $$ = $statement; }
1531 VariableDeclarationList_
1532 : "," VariableDeclarationList[bindings] { $$ = $bindings; }
1536 VariableDeclarationList
1537 : LexBind VariableDeclaration[binding] VariableDeclarationList_[next] { $$ = CYNew CYBindings($binding, $next); }
1541 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1542 | LexOf BindingPattern Initializer { CYNOT(@$); }
1545 /* 13.3.3 Destructuring Binding Patterns {{{ */
1547 : ObjectBindingPattern
1548 | ArrayBindingPattern
1551 ObjectBindingPattern
1552 : "let {" BindingPropertyListOpt "}"
1556 : "let [" BindingElementListOpt "]"
1559 BindingPropertyList_
1560 : "," BindingPropertyListOpt
1565 : BindingProperty BindingPropertyList_
1568 BindingPropertyListOpt
1569 : BindingPropertyList
1574 : BindingElementOpt[element] "," BindingElementListOpt[next]
1575 | BindingRestElement[element]
1576 | BindingElement[element]
1579 BindingElementListOpt
1580 : BindingElementList[pass]
1586 | LexOf PropertyName ":" BindingElement
1590 : LexBind SingleNameBinding[pass] { $$ = $pass; }
1591 | LexBind LexOf BindingPattern InitializerOpt[initializer] { CYNOT(@$); }
1595 : BindingElement[pass]
1600 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1604 : LexBind LexOf "..." BindingIdentifier
1607 /* 13.4 Empty Statement {{{ */
1609 : ";" { $$ = CYNew CYEmpty(); }
1612 /* 13.5 Expression Statement {{{ */
1613 ExpressionStatement_
1614 : Expression[expression] { $$ = CYNew CYExpress($[expression]); }
1617 : ExpressionStatement_[statement] Terminator { $$ = $statement; }
1620 /* 13.6 The if Statement {{{ */
1622 : "else" Statement[false] { $$ = $false; }
1623 | %prec "if" { $$ = NULL; }
1627 : "if" "(" Expression[test] ")" Statement[true] ElseStatementOpt[false] { $$ = CYNew CYIf($test, $true, $false); }
1630 /* 13.7 Iteration Statements {{{ */
1632 : "do" Statement[code] "while" "(" Expression[test] ")" TerminatorOpt { $$ = CYNew CYDoWhile($test, $code); }
1633 | "while" "(" Expression[test] ")" Statement[code] { $$ = CYNew CYWhile($test, $code); }
1634 | "for" "(" LexPushInOn ForStatementInitializer[initializer] LexPopIn ExpressionOpt[test] ";" ExpressionOpt[increment] ")" Statement[code] { $$ = CYNew CYFor($initializer, $test, $increment, $code); }
1635 | "for" "(" LexPushInOn LexLet LexOf Var_ LexBind BindingIdentifier[identifier] Initializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForInitialized(CYNew CYBinding($identifier, $initializer), $iterable, $code); }
1636 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForIn($initializer, $iterable, $code); }
1637 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "of" LexPopIn AssignmentExpression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
1640 ForStatementInitializer
1641 : LexLet LexOf EmptyStatement[pass] { $$ = $pass; }
1642 | LexLet ExpressionStatement_[initializer] ";" { $$ = $initializer; }
1643 | LexLet LexOf VariableStatement_[initializer] ";" { $$ = $initializer; }
1644 | LexicalDeclaration_[initializer] ";" { $$ = $initializer; }
1647 ForInStatementInitializer
1648 : LexLet LexOf BracedExpression[pass] { $$ = $pass; }
1650 | LexLet LexOf IndirectExpression[pass] { $$ = $pass; }
1652 | LexLet LexOf Var_ LexBind ForBinding[binding] { $$ = CYNew CYForVariable($binding); }
1653 | ForDeclaration[pass] { $$ = $pass; }
1657 : LetOrConst[constant] ForBinding[binding] { $$ = CYNew CYForLexical($constant, $binding); }
1661 : BindingIdentifier[identifier] { $$ = CYNew CYBinding($identifier, NULL); }
1662 | LexOf BindingPattern { CYNOT(@$); }
1665 /* 13.8 The continue Statement {{{ */
1667 : "continue" TerminatorSoft { $$ = CYNew CYContinue(NULL); }
1668 | "continue" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYContinue($label); }
1671 /* 13.9 The break Statement {{{ */
1673 : "break" TerminatorSoft { $$ = CYNew CYBreak(NULL); }
1674 | "break" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYBreak($label); }
1677 /* 13.10 The return Statement {{{ */
1679 : Return TerminatorSoft { $$ = CYNew CYReturn(NULL); }
1680 | Return NewLineNot Expression[value] Terminator { $$ = CYNew CYReturn($value); }
1683 /* 13.11 The with Statement {{{ */
1685 : "with" "(" Expression[scope] ")" Statement[code] { $$ = CYNew CYWith($scope, $code); }
1688 /* 13.12 The switch Statement {{{ */
1690 : "switch" "(" Expression[value] ")" CaseBlock[clauses] { $$ = CYNew CYSwitch($value, $clauses); }
1694 : "{" CaseClausesOpt[clauses] "}" { $$ = $clauses; }
1698 : "case" Expression[value] ":" StatementListOpt[code] { $$ = CYNew CYClause($value, $code); }
1702 : CaseClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1703 | DefaultClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1707 // XXX: the standard makes certain you can only have one of these
1709 : "default" ":" StatementListOpt[code] { $$ = CYNew CYClause(NULL, $code); }
1712 /* 13.13 Labelled Statements {{{ */
1714 : LabelIdentifier[name] ":" LabelledItem[statement] { $$ = CYNew CYLabel($name, $statement); }
1718 : Statement[pass] { $$ = $pass; }
1719 | LexSetStatement LexLet LexOf FunctionDeclaration[pass] { $$ = $pass; }
1722 /* 13.14 The throw Statement {{{ */
1724 : "throw"[throw] TerminatorSoft { CYERR(@throw, "throw without exception"); }
1725 | "throw" NewLineNot Expression[value] Terminator { $$ = CYNew cy::Syntax::Throw($value); }
1728 /* 13.15 The try Statement {{{ */
1730 : "try" Block[code] Catch[catch] { $$ = CYNew cy::Syntax::Try($code, $catch, NULL); }
1731 | "try" Block[code] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, NULL, $finally); }
1732 | "try" Block[code] Catch[catch] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, $catch, $finally); }
1736 : "catch" "(" LexBind CatchParameter[name] ")" Block[code] { $$ = CYNew cy::Syntax::Catch($name, $code); }
1740 : "finally" Block[code] { $$ = CYNew CYFinally($code); }
1744 : BindingIdentifier[pass] { $$ = $pass; }
1745 | LexOf BindingPattern { CYNOT(@$); }
1748 /* 13.16 The debugger Statement {{{ */
1750 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1754 /* 14.1 Function Definitions {{{ */
1756 : ";function" BindingIdentifier[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionStatement($name, $parameters, $code); }
1760 : "function" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionExpression($name, $parameters, $code); }
1763 StrictFormalParameters
1764 : FormalParameters[pass] { $$ = $pass; }
1768 : LexBind LexOf { $$ = NULL; }
1769 | FormalParameterList
1772 FormalParameterList_
1773 : "," FormalParameterList[parameters] { $$ = $parameters; }
1778 : FunctionRestParameter { CYNOT(@$); }
1779 | FormalParameter[binding] FormalParameterList_[next] { $$ = CYNew CYFunctionParameter($binding, $next); }
1782 FunctionRestParameter
1783 : BindingRestElement
1787 : BindingElement[pass] { $$ = $pass; }
1791 : LexPushYieldOff FunctionStatementList[code] LexPopYield { $$ = $code; }
1794 FunctionStatementList
1795 : LexPushReturnOn StatementListOpt[code] LexPopReturn { $$ = $code; }
1798 /* 14.2 Arrow Function Definitions {{{ */
1800 : ArrowParameters[parameters] LexNewLineOrOpt "=>" LexNoBrace ConciseBody[code] { $$ = CYNew CYFatArrow($parameters, $code); }
1804 : BindingIdentifier[identifier] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier)); }
1805 | LexOf CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) $$ = NULL; else { $$ = $cover->expression_->Parameter(); if ($$ == NULL) CYERR(@cover, "invalid parameter list"); } }
1809 : AssignmentExpression[expression] { $$ = CYNew CYReturn($expression); }
1810 | LexOf ";{" FunctionBody[code] "}" { $$ = $code; }
1813 /* 14.3 Method Definitions {{{ */
1815 : PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyMethod($name, $parameters, $code); }
1816 | GeneratorMethod[pass] { $$ = $pass; }
1817 | "get" PropertyName[name] "(" ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyGetter($name, $code); }
1818 | "set" PropertyName[name] "(" PropertySetParameterList[parameter] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertySetter($name, $parameter, $code); }
1821 PropertySetParameterList
1822 : FormalParameter[binding] { $$ = CYNew CYFunctionParameter($binding); }
1825 /* 14.4 Generator Function Definitions {{{ */
1827 : "*" PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorMethod($name, $parameters, $code); */ }
1830 GeneratorDeclaration
1831 : ";function" LexOf "*" BindingIdentifier[name] "(" FormalParameters[code] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorStatement($name, $parameters, $code); */ }
1835 : "function" LexOf "*" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorExpression($name, $parameters, $code); */ }
1839 : LexPushYieldOn FunctionStatementList[code] LexPopYield { $$ = $code; }
1843 : "!yield" LexNewLineOrNot "\n" LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ }
1844 | "!yield" LexNewLineOrNot "" LexNoStar LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ } %prec "!yield"
1845 | "!yield" LexNewLineOrNot "" LexNoStar AssignmentExpression[value] { CYNOT(@$); /* $$ = CYNew CYYieldValue($value); */ }
1846 | "!yield" LexNewLineOrNot "" LexNoStar LexOf "yield *" AssignmentExpression[generator] { CYNOT(@$); /* $$ = CYNew CYYieldGenerator($generator); */ }
1849 /* 14.5 Class Definitions {{{ */
1851 : ";class" BindingIdentifier[name] ClassTail[tail] { $$ = CYNew CYClassStatement($name, $tail); }
1855 : "class" BindingIdentifierOpt[name] ClassTail[tail] { $$ = CYNew CYClassExpression($name, $tail); }
1859 : ClassHeritageOpt[tail] { driver.class_.push($tail); } "{" LexPushSuperOn ClassBodyOpt "}" LexPopSuper { driver.class_.pop(); $$ = $tail; }
1863 : "extends" AccessExpression[extends] { $$ = CYNew CYClassTail($extends); }
1867 : ClassHeritage[pass] { $$ = $pass; }
1868 | { $$ = CYNew CYClassTail(NULL); }
1881 : ClassElementListOpt ClassElement
1890 : MethodDefinition[method] { if (CYFunctionExpression *constructor = $method->Constructor()) driver.class_.top()->constructor_ = constructor; else driver.class_.top()->instance_->*$method; }
1891 | "static" MethodDefinition[method] { driver.class_.top()->static_->*$method; }
1896 /* 15.1 Scripts {{{ */
1898 : ScriptBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1902 : StatementList[pass] { $$ = $pass; }
1906 : ScriptBody[pass] { $$ = $pass; }
1907 | LexSetStatement LexLet LexOf { $$ = NULL; }
1910 /* 15.2 Modules {{{ */
1912 : ModuleBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1916 : ModuleItemList[pass] { $$ = $pass; }
1920 : ModuleBody[pass] { $$ = $pass; }
1921 | LexSetStatement LexLet LexOf { $$ = NULL; }
1925 : ModuleItem[statement] ModuleItemListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1929 : ModuleItemList[pass] { $$ = $pass; }
1930 | LexSetStatement LexLet LexOf { $$ = NULL; }
1934 : LexSetStatement LexLet LexOf ImportDeclaration[pass] { $$ = $pass; }
1935 | LexSetStatement LexLet LexOf ExportDeclaration { CYNOT(@$); }
1936 | StatementListItem[pass] { $$ = $pass; }
1939 /* 15.2.2 Imports {{{ */
1941 : "import" ImportClause[specifiers] FromClause[module] Terminator { $$ = CYNew CYImportDeclaration($specifiers, $module); }
1942 | "import" LexOf ModuleSpecifier[module] Terminator { $$ = CYNew CYImportDeclaration(NULL, $module); }
1946 : ImportedDefaultBinding[default] { $$ = $default; }
1947 | LexOf NameSpaceImport[pass] { $$ = $pass; }
1948 | LexOf NamedImports[pass] { $$ = $pass; }
1949 | ImportedDefaultBinding[default] "," NameSpaceImport[next] { $$ = $default; CYSetLast($$) = $next; }
1950 | ImportedDefaultBinding[default] "," NamedImports[next] { $$ = $default; CYSetLast($$) = $next; }
1953 ImportedDefaultBinding
1954 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(CYNew CYIdentifier("default"), $binding); }
1958 : "*" "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(NULL, $binding); }
1962 : "{" ImportsListOpt[pass] "}" { $$ = $pass; }
1966 : "from" ModuleSpecifier[pass] { $$ = $pass; }
1970 : "," ImportsListOpt[pass] { $$ = $pass; }
1975 : ImportSpecifier[import] ImportsList_[next] { $$ = $import; CYSetLast($$) = $next; }
1979 : ImportsList[pass] { $$ = $pass; }
1980 | LexOf { $$ = NULL; }
1984 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($binding, $binding); }
1985 | LexOf IdentifierName[name] "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($name, $binding); }
1989 : StringLiteral[pass] { $$ = $pass; }
1993 : BindingIdentifier[pass] { $$ = $pass; }
1996 /* 15.2.3 Exports {{{ */
1998 : "*" FromClause Terminator
1999 | ExportClause FromClause Terminator
2000 | ExportClause Terminator
2002 | "default" LexSetStatement LexOf HoistableDeclaration
2003 | "default" LexSetStatement LexOf ClassDeclaration
2004 | "default" LexSetStatement AssignmentExpression Terminator
2008 : "export" LexSetStatement LexLet LexOf ExportDeclaration_
2009 | "export" Declaration
2013 : ";{" ExportsListOpt "}"
2017 : "," ExportsListOpt
2022 : ExportSpecifier ExportsList_
2032 | IdentifierName "as" IdentifierName
2037 /* Cycript (C): Type Encoding {{{ */
2039 : IdentifierType[name] { $$ = CYNew CYTypedName(@name, $name); }
2040 | StringLiteral[name] { $$ = CYNew CYTypedName(@name, $name); }
2041 | NumericLiteral[name] { $$ = CYNew CYTypedName(@name, $name); }
2042 | "(" "*" TypeQualifierRightOpt[typed] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2046 : { $$ = CYNew CYTypedName(@$); }
2050 : TypeSignifier[pass] { $$ = $pass; }
2051 | TypeSignifierNone[pass] { $$ = $pass; }
2055 : TypedParameterListOpt[formal] ")" { $$ = CYNew CYTypeFunctionWith($formal->variadic_, $formal->parameters_); }
2059 : SuffixedTypeOpt[typed] "[" AssignmentExpression[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
2060 | "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameters[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
2061 | TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2062 | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedName(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2066 : SuffixedType[pass] { $$ = $pass; }
2067 | TypeSignifierOpt[pass] { $$ = $pass; }
2071 : "*" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2075 : "const" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeConstant(); }
2076 | "volatile" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeVolatile(); }
2079 TypeQualifierLeftOpt
2080 : TypeQualifierLeft[pass] { $$ = $pass; }
2085 : SuffixedType[pass] { $$ = $pass; }
2086 | PrefixedType[pass] { $$ = $pass; }
2087 | "const" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
2088 | "volatile" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
2091 TypeQualifierRightOpt
2092 : TypeQualifierRight[pass] { $$ = $pass; }
2093 | TypeSignifierOpt[pass] { $$ = $pass; }
2097 : "int" { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2098 | "unsigned" IntegerTypeOpt[integral] { $$ = $integral->Unsigned(); if ($$ == NULL) CYERR(@1, "incompatible unsigned"); }
2099 | "signed" IntegerTypeOpt[integral] { $$ = $integral->Signed(); if ($$ == NULL) CYERR(@1, "incompatible signed"); }
2100 | "long" IntegerTypeOpt[integral] { $$ = $integral->Long(); if ($$ == NULL) CYERR(@1, "incompatible long"); }
2101 | "short" IntegerTypeOpt[integral] { $$ = $integral->Short(); if ($$ == NULL) CYERR(@1, "incompatible short"); }
2105 : IntegerType[pass] { $$ = $pass; }
2106 | { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2110 : TypedIdentifierField[typed] ";" StructFieldListOpt[next] { $$ = CYNew CYTypeStructField($typed, $typed->name_, $next); }
2115 : NumericLiteral[pass] { $$ = $pass; }
2116 | "-" NumericLiteral[positive] { $$ = $positive; $$->value_ = -$$->value_; }
2119 EnumConstantListOpt_
2120 : "," EnumConstantListOpt[pass] { $$ = $pass; }
2125 : IdentifierType[name] "=" IntegerNumber[value] EnumConstantListOpt_[next] { $$ = CYNew CYEnumConstant($name, $value, $next); }
2130 : { $$ = CYTypeNeutral; }
2131 | "signed" { $$ = CYTypeSigned; }
2132 | "unsigned" { $$ = CYTypeUnsigned; }
2136 : IdentifierType[name] { $$ = CYNew CYTypeVariable($name); }
2137 | IntegerType[pass] { $$ = $pass; }
2138 | TypeSigning[signing] "char" { $$ = CYNew CYTypeCharacter($signing); }
2139 | TypeSigning[signing] "__int128" { $$ = CYNew CYTypeInt128($signing); }
2140 | "float" { $$ = CYNew CYTypeFloating(0); }
2141 | "double" { $$ = CYNew CYTypeFloating(1); }
2142 | "long" "double" { $$ = CYNew CYTypeFloating(2); }
2143 | "void" { $$ = CYNew CYTypeVoid(); }
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 : TypeQualifierLeftOpt[modifier] PrimitiveReference[specifier] TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = $specifier; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2159 : TypedIdentifierMaybe[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2163 : TypedIdentifierMaybe[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2166 TypedIdentifierTagged
2167 : TypeQualifierLeftOpt[modifier] "struct" "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeStruct(NULL, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2168 | TypeQualifierLeftOpt[modifier] "enum" ":" PrimitiveType[specifier] "{" EnumConstantListOpt[constants] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeEnum(NULL, $specifier, $constants); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2171 TypedIdentifierField
2172 : TypedIdentifierYes[pass] { $$ = $pass; }
2173 | TypedIdentifierTagged[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2176 TypedIdentifierEncoding
2177 : TypedIdentifierNo[pass] { $$ = $pass; }
2178 | TypedIdentifierTagged[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2181 TypedIdentifierDefinition
2182 : TypedIdentifierYes[pass] { $$ = $pass; }
2183 | TypeQualifierLeftOpt[modifier] "struct" IdentifierTypeOpt[name] "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; $$->specifier_ = CYNew CYTypeStruct($name, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2187 : "@encode" "(" TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYEncodedType($typed); }
2193 /* Cycript (Objective-C): @class Declaration {{{ */
2195 /* XXX: why the hell did I choose MemberExpression? */
2196 : ":" MemberExpression[extends] { $$ = $extends; }
2200 ImplementationFieldListOpt
2201 : TypedIdentifierField[typed] ";" ImplementationFieldListOpt[next] { $$ = CYNew CYImplementationField($typed, $typed->name_, $next); }
2206 : "+" { $$ = false; }
2207 | "-" { $$ = true; }
2211 : "(" TypedIdentifierNo[type] ")" { $$ = $type; }
2212 | { $$ = CYNew CYType(CYNew CYTypeVariable("id")); }
2216 : Word[tag] ":" TypeOpt[type] BindingIdentifier[identifier] { $$ = CYNew CYMessageParameter($tag, $type, $identifier); }
2219 MessageParameterList
2220 : MessageParameter[parameter] MessageParameterListOpt[next] { $parameter->SetNext($next); $$ = $parameter; }
2223 MessageParameterListOpt
2224 : MessageParameterList[pass] { $$ = $pass; }
2225 | TypedParameterList_[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); /*XXX*/ if ($formal->parameters_ != NULL) CYERR(@$, "temporarily unsupported"); $$ = NULL; }
2229 : MessageParameterList[pass] { $$ = $pass; }
2230 | Word[tag] { $$ = CYNew CYMessageParameter($tag); }
2233 ClassMessageDeclaration
2234 : MessageScope[instance] TypeOpt[type] MessageParameters[parameters] "{" LexPushSuperOn FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYMessage($instance, $type, $parameters, $code); }
2237 ClassMessageDeclarationListOpt
2238 : ClassMessageDeclarationListOpt[next] ClassMessageDeclaration[message] { $message->SetNext($next); $$ = $message; }
2242 // XXX: this should be AssignmentExpressionNoRight
2244 : ShiftExpression[name] ClassProtocolsOpt[next] { $$ = CYNew CYProtocol($name, $next); }
2248 : "," ClassProtocols[protocols] { $$ = $protocols; }
2252 ClassProtocolListOpt
2253 : "<" ClassProtocols[protocols] ">" { $$ = $protocols; }
2257 ImplementationStatement
2258 : "@implementation" Identifier[name] ClassSuperOpt[extends] ClassProtocolListOpt[protocols] "{" ImplementationFieldListOpt[fields] "}" ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYImplementation($name, $extends, $protocols, $fields, $messages); }
2266 : "@implementation" Identifier[name] CategoryName ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYCategory($name, $messages); }
2270 : ImplementationStatement[pass] { $$ = $pass; }
2271 | CategoryStatement[pass] { $$ = $pass; }
2274 /* Cycript (Objective-C): Send Message {{{ */
2276 : "," AssignmentExpressionClassic[value] VariadicCall[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
2281 : WordOpt[name] { driver.contexts_.back().words_.push_back($name); } { $$ = $name; }
2282 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
2286 : SelectorCall[pass] { $$ = $pass; }
2287 | VariadicCall[pass] { $$ = $pass; }
2291 : SelectorWordOpt[name] ":" AssignmentExpressionClassic[value] SelectorCall_[next] { $$ = CYNew CYArgument($name ?: CYNew CYWord(""), $value, $next); }
2295 : SelectorCall[pass] { $$ = $pass; }
2296 | Word[name] { $$ = CYNew CYArgument($name, NULL); }
2300 : "[" AssignmentExpressionClassic[self] { driver.contexts_.push_back($self); } SelectorList[arguments] "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($self, $arguments); }
2301 | "[" LexOf "super" { driver.context_ = NULL; } SelectorList[arguments] "]" { $$ = CYNew CYSendSuper($arguments); }
2305 : WordOpt[name] ":" SelectorExpressionOpt[next] { $$ = CYNew CYSelectorPart($name, true, $next); }
2309 : SelectorExpression_[pass] { $$ = $pass; }
2310 | Word[name] { $$ = CYNew CYSelectorPart($name, false, NULL); }
2313 SelectorExpressionOpt
2314 : SelectorExpression_[pass] { $$ = $pass; }
2319 : MessageExpression[pass] { $$ = $pass; }
2320 | "@selector" "(" SelectorExpression[parts] ")" { $$ = CYNew CYSelector($parts); }
2325 /* Cycript: @import Directive {{{ */
2327 : ModulePath[next] "." Word[part] { $$ = CYNew CYModule($part, $next); }
2328 | Word[part] { $$ = CYNew CYModule($part); }
2332 : "@import" ModulePath[path] { $$ = CYNew CYImport($path); }
2337 /* Cycript (Objective-C): Boxed Expressions {{{ */
2339 : NullLiteral[pass] { $$ = $pass; }
2340 | BooleanLiteral[pass] { $$ = $pass; }
2341 | NumericLiteral[pass] { $$ = $pass; }
2342 | StringLiteral[pass] { $$ = $pass; }
2343 | CoverParenthesizedExpressionAndArrowParameterList[pass] { $$ = $pass; }
2344 | "YES" { $$ = CYNew CYTrue(); }
2345 | "NO" { $$ = CYNew CYFalse(); }
2349 : "," KeyValuePairListOpt[next] { $$ = $next; }
2353 : AssignmentExpression[key] ":" AssignmentExpression[value] KeyValuePairList_[next] { $$ = CYNew CYObjCKeyValue($key, $value, $next); }
2357 : KeyValuePairList[pass] { $$ = $pass; }
2358 | LexOf { $$ = NULL; }
2362 : "@" BoxableExpression[expression] { $$ = CYNew CYBox($expression); }
2363 | "@" "[" ElementListOpt[elements] "]" { $$ = CYNew CYObjCArray($elements); }
2364 | "@" "{" KeyValuePairListOpt[pairs] "}" { $$ = CYNew CYObjCDictionary($pairs); }
2366 | "@YES" { $$ = CYNew CYBox(CYNew CYTrue()); }
2367 | "@NO" { $$ = CYNew CYBox(CYNew CYFalse()); }
2368 | "@true" { $$ = CYNew CYBox(CYNew CYTrue()); }
2369 | "@false" { $$ = CYNew CYBox(CYNew CYFalse()); }
2370 | "@null" { $$ = CYNew CYBox(CYNew CYNull()); }
2373 /* Cycript (Objective-C): Block Expressions {{{ */
2375 : "^" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { if (CYTypeFunctionWith *function = $type->Function()) $$ = CYNew CYObjCBlock($type, function->parameters_, $code); else CYERR($type->location_, "expected parameters"); }
2378 /* Cycript (Objective-C): Instance Literals {{{ */
2380 : "#" NumericLiteral[address] { $$ = CYNew CYInstanceLiteral($address); }
2386 /* Cycript (C): Pointer Indirection/Addressing {{{ */
2388 : IndirectExpression[pass] { $$ = $pass; }
2392 : "*" UnaryExpression[rhs] { $$ = CYNew CYIndirect($rhs); }
2396 : "&" UnaryExpression[rhs] { $$ = CYNew CYAddressOf($rhs); }
2400 : "->" "[" Expression[property] "]" { $$ = CYNew CYIndirectMember(NULL, $property); }
2401 | "->" IdentifierName[property] { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($property)); }
2402 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
2405 /* Cycript (C): Lambda Expressions {{{ */
2407 : "," TypedParameterList[parameters] { $$ = $parameters; }
2408 | { $$ = CYNew CYTypedFormal(false); }
2412 : TypedIdentifierMaybe[typed] TypedParameterList_[formal] { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = $formal; $$->parameters_ = CYNew CYTypedParameter($typed, identifier, $$->parameters_); }
2413 | "..." { $$ = CYNew CYTypedFormal(true); }
2416 TypedParameterListOpt
2417 : TypedParameterList[pass] { $$ = $pass; }
2418 | { $$ = CYNew CYTypedFormal(false); }
2422 : TypedParameterListOpt[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); $$ = $formal->parameters_; }
2426 : "[" LexOf "&" "]" "(" TypedParameters[parameters] ")" "->" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { $$ = CYNew CYLambda($type, $parameters, $code); }
2429 /* Cycript (C): Structure Definitions {{{ */
2431 : "struct" NewLineOpt { $$ = CYNew CYIdentifier("struct"); }
2435 : "struct" NewLineNot IdentifierType[name] "{" StructFieldListOpt[fields] "}" { $$ = CYNew CYStructDefinition($name, CYNew CYStructTail($fields)); }
2439 : "(" LexOf "struct" NewLineOpt IdentifierType[name] TypeQualifierRightOpt[typed] ")" { $typed->specifier_ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); $$ = CYNew CYTypeExpression($typed); }
2440 | "(" LexOf "struct" NewLineOpt AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2443 /* Cycript (C): Type Definitions {{{ */
2445 : "typedef" NewLineOpt { $$ = CYNew CYIdentifier("typedef"); }
2449 : "typedef" NewLineNot TypedIdentifierDefinition[typed] TerminatorHard { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = CYNew CYTypeDefinition($typed, identifier); }
2453 : TypeDefinition[pass] { $$ = $pass; }
2457 : "(" LexOf "typedef" NewLineOpt TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYTypeExpression($typed); }
2460 /* Cycript (C): extern "C" {{{ */
2462 : "extern" NewLineOpt { $$ = CYNew CYIdentifier("extern"); }
2466 : TypedIdentifierField[typed] TerminatorHard { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = CYNew CYExternalDefinition(CYNew CYString("C"), $typed, identifier); }
2467 | TypeDefinition[pass] { $$ = $pass; }
2470 ExternCStatementListOpt
2471 : ExternCStatement[statement] ExternCStatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
2476 : "{" ExternCStatementListOpt[pass] "}" { $$ = $pass; }
2477 | ExternCStatement[pass] { $$ = $pass; }
2481 : StringLiteral[abi] { if (strcmp($abi->Value(), "C") != 0) CYERR(@abi, "unknown extern binding"); }
2485 : "extern" NewLineNot ABI[abi] ExternC[pass] { $$ = $pass; }
2489 : "(" LexOf "extern" NewLineOpt ABI[abi] TypedIdentifierField[typed] ")" { $$ = CYNew CYExternalExpression(CYNew CYString("C"), $typed, $typed->name_); }
2495 /* Lexer State {{{ */
2497 : { driver.PushCondition(CYDriver::RegExpCondition); }
2501 : { driver.PushCondition(CYDriver::XMLContentCondition); }
2505 : { driver.PushCondition(CYDriver::XMLTagCondition); }
2509 : { driver.PopCondition(); }
2513 : { driver.SetCondition(CYDriver::XMLContentCondition); }
2517 : { driver.SetCondition(CYDriver::XMLTagCondition); }
2520 /* Virtual Tokens {{{ */
2527 /* 8.1 Context Keywords {{{ */
2529 : "namespace" { $$ = CYNew CYIdentifier("namespace"); }
2530 | "xml" { $$ = CYNew CYIdentifier("xml"); }
2533 /* 8.3 XML Initializer Input Elements {{{ */
2535 : XMLComment { $$ = $1; }
2536 | XMLCDATA { $$ = $1; }
2537 | XMLPI { $$ = $1; }
2541 /* 11.1 Primary Expressions {{{ */
2543 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
2544 | XMLInitilizer { $$ = $1; }
2545 | XMLListInitilizer { $$ = $1; }
2549 : AttributeIdentifier { $$ = $1; }
2550 | QualifiedIdentifier { $$ = $1; }
2551 | WildcardIdentifier { $$ = $1; }
2554 /* 11.1.1 Attribute Identifiers {{{ */
2556 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
2560 : PropertySelector { $$ = $1; }
2561 | "[" Expression "]" { $$ = CYNew CYSelector($2); }
2565 : Identifier { $$ = CYNew CYSelector($1); }
2566 | WildcardIdentifier { $$ = $1; }
2569 /* 11.1.2 Qualified Identifiers {{{ */
2570 QualifiedIdentifier_
2571 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
2572 | QualifiedIdentifier { $$ = $1; }
2576 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
2579 /* 11.1.3 Wildcard Identifiers {{{ */
2581 : "*" { $$ = CYNew CYWildcard(); }
2584 /* 11.1.4 XML Initializer {{{ */
2586 : XMLMarkup { $$ = $1; }
2587 | XMLElement { $$ = $1; }
2591 : "<" LexPushInOff XMLTagContent LexPop "/>" LexPopIn
2592 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop ">" LexPopIn
2596 : LexPushXMLTag XMLTagName XMLAttributes
2600 : "{" LexPushRegExp Expression LexPop "}"
2609 : XMLAttributes_ XMLAttribute
2614 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
2615 | XMLAttributes_ XMLWhitespaceOpt
2624 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
2628 : XMLExpression XMLElementContentOpt
2629 | XMLMarkup XMLElementContentOpt
2630 | XMLText XMLElementContentOpt
2631 | XMLElement XMLElementContentOpt
2634 XMLElementContentOpt
2639 /* 11.1.5 XMLList Initializer {{{ */
2641 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop "</>" LexPopIn { $$ = CYNew CYXMLList($4); }
2645 /* 11.2 Left-Hand-Side Expressions {{{ */
2647 : Identifier { $$ = $1; }
2648 | PropertyIdentifier { $$ = $1; }
2652 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
2653 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
2654 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
2657 /* 12.1 The default xml namespace Statement {{{ */
2658 /* XXX: DefaultXMLNamespaceStatement
2659 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
2663 : DefaultXMLNamespaceStatement { $$ = $1; }
2668 /* JavaScript FTL: Array Comprehensions {{{ */
2670 : AssignmentExpression[expression] ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2674 : "for" "each" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2677 /* JavaScript FTL: for each {{{ */
2679 : "for" "each" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
2683 /* JavaScript FTW: Array Comprehensions {{{ */
2685 : ArrayComprehension
2689 : "[" Comprehension[comprehension] "]" { $$ = $comprehension; }
2693 : LexOf ComprehensionFor[comprehension] ComprehensionTail[next] AssignmentExpression[expression] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2698 | ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2699 | ComprehensionIf[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2703 : "for" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForInComprehension($binding, $iterable); }
2704 | "for" "(" LexPushInOn LexBind ForBinding[binding] "of" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2708 : "if" "(" AssignmentExpression[test] ")" { $$ = CYNew CYIfComprehension($test); }
2711 /* JavaScript FTW: Named Arguments {{{ */
2713 : LexOf WordNoUnary[tag] ":" AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument($tag, $value, $next); }
2716 /* JavaScript FTW: Subscript Access {{{ */
2718 : "." "[" AssignmentExpression[property] "]" { $$ = CYNew CYSubscriptMember(NULL, $property); }
2721 /* JavaScript FTW: Undefined Monad {{{ */
2723 : "?." IdentifierName[property] { $$ = CYNew CYAttemptMember(NULL, CYNew CYString($property)); }
2724 | "?." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
2728 /* JavaScript FTW: Java "Anonymous Inner Classes" {{{ */
2730 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYExtend(NULL, $properties); }
2734 /* JavaScript FTW: Ruby Blocks {{{ */
2735 RubyProcParameterList_
2736 : "," RubyProcParameterList[parameters] { $$ = $parameters; }
2740 RubyProcParameterList
2741 : BindingIdentifier[identifier] RubyProcParameterList_[next] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier), $next); }
2742 | LexOf { $$ = NULL; }
2746 : "|" RubyProcParameterList[parameters] "|" { $$ = $parameters; }
2747 | "||" { $$ = NULL; }
2750 RubyProcParametersOpt
2751 : RubyProcParameters[pass] { $$ = $pass; }
2756 : ";{" RubyProcParametersOpt[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyBlock(NULL, CYNew CYRubyProc($parameters, $code)); }
2760 : "{" RubyProcParameters[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyProc($parameters, $code); }
2764 : AccessExpression[pass] LexNewLineOrOpt { $$ = $pass; }
2765 | BracedExpression_[lhs] { if (!$lhs->IsNew()) CYMAP(OpenBrace_, OpenBrace); } BracedParameter[rhs] LexNewLineOrOpt { $rhs->SetLeft($lhs); $$ = $rhs; }
2769 : BracedExpression_[pass] "\n" { $$ = $pass; }
2770 | BracedExpression_[pass] { $$ = $pass; }
2773 /* JavaScript FTW: Ruby Scopes {{{ */
2775 : "::" "[" Expression[property] "]" { $$ = CYNew CYResolveMember(NULL, $property); }
2776 | "::" IdentifierName[property] { $$ = CYNew CYResolveMember(NULL, CYNew CYString($property)); }
2777 | "::" AutoComplete { driver.mode_ = CYDriver::AutoResolve; YYACCEPT; }
2780 /* JavaScript FTW: Ruby Symbols {{{ */
2782 : ":" Word[name] { $$ = CYNew CYSymbol($name->Word()); }
2788 bool CYDriver::Parse(CYMark mark) {
2790 CYLocal<CYPool> local(&pool_);
2791 cy::parser parser(*this);
2793 parser.set_debug_level(debug_);
2795 return parser.parse() != 0;
2798 void CYDriver::Warning(const cy::parser::location_type &location, const char *message) {
2802 CYDriver::Error error;
2803 error.warning_ = true;
2804 error.location_ = location;
2805 error.message_ = message;
2806 errors_.push_back(error);
2809 void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
2810 CYDriver::Error error;
2811 error.warning_ = false;
2812 error.location_ = location;
2813 error.message_ = message;
2814 driver.errors_.push_back(error);