1 /* Cycript - The Truly Universal Scripting Language
2 * Copyright (C) 2009-2016 Jay Freeman (saurik)
5 /* GNU Affero General Public License, Version 3 {{{ */
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #define YYSTACKEXPANDABLE 1
31 #define CYNew new(driver.pool_)
34 #include "ObjectiveC/Syntax.hpp"
38 #include "E4X/Syntax.hpp"
41 #include "Highlight.hpp"
44 %union { bool bool_; }
46 %union { CYMember *access_; }
47 %union { CYArgument *argument_; }
48 %union { CYAssignment *assignment_; }
49 %union { CYBinding *binding_; }
50 %union { CYBindings *bindings_; }
51 %union { CYBoolean *boolean_; }
52 %union { CYBraced *braced_; }
53 %union { CYClause *clause_; }
54 %union { cy::Syntax::Catch *catch_; }
55 %union { CYClassTail *classTail_; }
56 %union { CYComprehension *comprehension_; }
57 %union { CYElement *element_; }
58 %union { CYEnumConstant *constant_; }
59 %union { CYExpression *expression_; }
60 %union { CYFalse *false_; }
61 %union { CYVariable *variable_; }
62 %union { CYFinally *finally_; }
63 %union { CYForInitializer *for_; }
64 %union { CYForInInitializer *forin_; }
65 %union { CYFunctionParameter *functionParameter_; }
66 %union { CYIdentifier *identifier_; }
67 %union { CYImportSpecifier *import_; }
68 %union { CYInfix *infix_; }
69 %union { CYLiteral *literal_; }
70 %union { CYMethod *method_; }
71 %union { CYModule *module_; }
72 %union { CYNull *null_; }
73 %union { CYNumber *number_; }
74 %union { CYParenthetical *parenthetical_; }
75 %union { CYProperty *property_; }
76 %union { CYPropertyName *propertyName_; }
77 %union { CYTypeSigning signing_; }
78 %union { CYSpan *span_; }
79 %union { CYStatement *statement_; }
80 %union { CYString *string_; }
81 %union { CYTarget *target_; }
82 %union { CYThis *this_; }
83 %union { CYTrue *true_; }
84 %union { CYWord *word_; }
87 %union { CYTypeIntegral *integral_; }
88 %union { CYTypeStructField *structField_; }
89 %union { CYTypeModifier *modifier_; }
90 %union { CYTypeSpecifier *specifier_; }
91 %union { CYTypedFormal *typedFormal_; }
92 %union { CYTypedLocation *typedLocation_; }
93 %union { CYTypedName *typedName_; }
94 %union { CYTypedParameter *typedParameter_; }
95 %union { CYType *typedThing_; }
99 %union { CYObjCKeyValue *keyValue_; }
100 %union { CYImplementationField *implementationField_; }
101 %union { CYMessage *message_; }
102 %union { CYMessageParameter *messageParameter_; }
103 %union { CYProtocol *protocol_; }
104 %union { CYSelectorPart *selector_; }
108 %union { CYAttribute *attribute_; }
109 %union { CYPropertyIdentifier *propertyIdentifier_; }
110 %union { CYSelector *selector_; }
116 cy::parser::semantic_type semantic_;
117 hi::Value highlight_;
120 int cylex(YYSTYPE *, CYLocation *, void *);
128 typedef cy::parser::token tk;
130 _finline int cylex_(cy::parser::semantic_type *semantic, CYLocation *location, CYDriver &driver) {
131 driver.newline_ = false;
134 int token(cylex(&data, location, driver.scanner_));
135 *semantic = data.semantic_;
139 case tk::OpenBracket:
141 driver.in_.push(false);
145 if (driver.in_.top())
150 case tk::CloseBracket:
157 if (driver.yield_.top())
158 token = tk::_yield__;
162 driver.newline_ = true;
170 #define yylex_(semantic, location, driver) ({ \
172 if (driver.hold_ == cy::parser::empty_symbol) \
173 type = yytranslate_(cylex_(semantic, location, driver)); \
175 type = driver.hold_; \
176 driver.hold_ = cy::parser::empty_symbol; \
180 #define CYLEX() do if (yyla.empty()) { \
181 YYCDEBUG << "Mapping a token: "; \
182 yyla.type = yylex_(&yyla.value, &yyla.location, driver); \
183 YY_SYMBOL_PRINT("Next token is", yyla); \
186 #define CYMAP(to, from) do { \
188 if (yyla.type == yytranslate_(token::from)) \
189 yyla.type = yytranslate_(token::to); \
192 #define CYHLD(location, token) do { \
193 if (driver.hold_ != empty_symbol) \
194 CYERR(location, "unexpected hold"); \
195 driver.hold_ = yyla.type; \
196 yyla.type = yytranslate_(token); \
199 #define CYERR(location, message) do { \
200 error(location, message); \
204 #define CYEOK() do { \
206 driver.errors_.pop_back(); \
209 #define CYNOT(location) \
210 CYERR(location, "unimplemented feature")
212 #define CYMPT(location) do { \
213 if (!yyla.empty() && yyla.type_get() != yyeof_) \
214 CYERR(location, "unexpected lookahead"); \
224 @$.begin.filename = @$.end.filename = &driver.filename_;
226 switch (driver.mark_) {
228 driver.hold_ = yytranslate_(token::MarkScript);
231 driver.hold_ = yytranslate_(token::MarkModule);
233 case CYMarkExpression:
234 driver.hold_ = yytranslate_(token::MarkExpression);
242 %define api.location.type { CYLocation }
249 %param { CYDriver &driver }
251 /* Token Declarations {{{ */
257 %token XMLAttributeValue
259 %token XMLTagCharacters
265 %token LeftRight "<>"
266 %token LeftSlashRight "</>"
268 %token SlashRight "/>"
269 %token LeftSlash "</"
271 %token PeriodPeriod ".."
274 @begin E4X ObjectiveC
279 %token AmpersandAmpersand "&&"
280 %token AmpersandEqual "&="
282 %token CarrotEqual "^="
284 %token EqualEqual "=="
285 %token EqualEqualEqual "==="
286 %token EqualRight "=>"
287 %token Exclamation "!"
288 %token ExclamationEqual "!="
289 %token ExclamationEqualEqual "!=="
291 %token HyphenEqual "-="
292 %token HyphenHyphen "--"
293 %token HyphenRight "->"
295 %token LeftEqual "<="
297 %token LeftLeftEqual "<<="
299 %token PercentEqual "%="
301 %token PeriodPeriodPeriod "..."
303 %token PipeEqual "|="
306 %token PlusEqual "+="
309 %token RightEqual ">="
310 %token RightRight ">>"
311 %token RightRightEqual ">>="
312 %token RightRightRight ">>>"
313 %token RightRightRightEqual ">>>="
315 %token SlashEqual "/="
317 %token StarEqual "*="
321 %token ColonColon "::"
332 %token CloseParen ")"
335 %token OpenBrace_ ";{"
336 %token OpenBrace_let "let {"
337 %token CloseBrace "}"
339 %token OpenBracket "["
340 %token OpenBracket_let "let ["
341 %token CloseBracket "]"
343 %token At_error_ "@error"
346 %token At_class_ "@class"
350 %token _typedef_ "typedef"
351 %token _unsigned_ "unsigned"
352 %token _signed_ "signed"
353 %token _struct_ "struct"
354 %token _extern_ "extern"
358 %token At_encode_ "@encode"
362 %token At_implementation_ "@implementation"
363 %token At_import_ "@import"
364 %token At_end_ "@end"
365 %token At_selector_ "@selector"
366 %token At_null_ "@null"
367 %token At_YES_ "@YES"
369 %token At_true_ "@true"
370 %token At_false_ "@false"
375 %token _false_ "false"
380 %token _break_ "break"
382 %token _catch_ "catch"
383 %token _class_ "class"
384 %token _class__ ";class"
385 %token _const_ "const"
386 %token _continue_ "continue"
387 %token _debugger_ "debugger"
388 %token _default_ "default"
389 %token _delete_ "delete"
393 %token _export_ "export"
394 %token _extends_ "extends"
395 %token _finally_ "finally"
397 %token _function_ "function"
398 %token _function__ ";function"
400 %token _import_ "import"
403 %token _Infinity_ "Infinity"
404 %token _instanceof_ "instanceof"
406 %token _return_ "return"
407 %token _super_ "super"
408 %token _switch_ "switch"
409 %token _target_ "target"
411 %token _throw_ "throw"
413 %token _typeof_ "typeof"
416 %token _while_ "while"
419 %token _abstract_ "abstract"
420 %token _await_ "await"
421 %token _boolean_ "boolean"
424 %token _constructor_ "constructor"
425 %token _double_ "double"
427 %token _final_ "final"
428 %token _float_ "float"
432 %token _implements_ "implements"
434 %token ___int128_ "__int128"
435 %token _interface_ "interface"
439 %token _native_ "native"
440 %token _package_ "package"
441 %token _private_ "private"
442 %token _protected_ "protected"
443 %token ___proto___ "__proto__"
444 %token _prototype_ "prototype"
445 %token _public_ "public"
447 %token _short_ "short"
448 %token _static_ "static"
449 %token _synchronized_ "synchronized"
450 %token _throws_ "throws"
451 %token _transient_ "transient"
452 %token _typeid_ "typeid"
453 %token _volatile_ "volatile"
454 %token _yield_ "yield"
455 %token _yield__ "!yield"
457 %token _undefined_ "undefined"
473 %token _namespace_ "namespace"
478 %token YieldStar "yield *"
480 %token <identifier_> Identifier_
481 %token <number_> NumericLiteral
482 %token <string_> StringLiteral
483 %token <literal_> RegularExpressionLiteral_
485 %token <string_> NoSubstitutionTemplate
486 %token <string_> TemplateHead
487 %token <string_> TemplateMiddle
488 %token <string_> TemplateTail
490 %type <target_> AccessExpression
491 %type <expression_> AdditiveExpression
492 %type <argument_> ArgumentList_
493 %type <argument_> ArgumentList
494 %type <argument_> ArgumentListOpt
495 %type <argument_> Arguments
496 %type <target_> ArrayComprehension
497 %type <element_> ArrayElement
498 %type <literal_> ArrayLiteral
499 %type <expression_> ArrowFunction
500 %type <functionParameter_> ArrowParameters
501 %type <expression_> AssignmentExpression
502 %type <identifier_> BindingIdentifier
503 %type <identifier_> BindingIdentifierOpt
504 %type <bindings_> BindingList_
505 %type <bindings_> BindingList
506 %type <expression_> BitwiseANDExpression
507 %type <statement_> Block
508 %type <statement_> BlockStatement
509 %type <boolean_> BooleanLiteral
510 %type <binding_> BindingElement
511 %type <expression_> BitwiseORExpression
512 %type <expression_> BitwiseXORExpression
513 %type <target_> BracedExpression_
514 %type <target_> BracedExpression
515 %type <statement_> BreakStatement
516 %type <statement_> BreakableStatement
517 %type <expression_> CallExpression_
518 %type <target_> CallExpression
519 %type <clause_> CaseBlock
520 %type <clause_> CaseClause
521 %type <clause_> CaseClausesOpt
523 %type <identifier_> CatchParameter
524 %type <statement_> ClassDeclaration
525 %type <target_> ClassExpression
526 %type <classTail_> ClassHeritage
527 %type <classTail_> ClassHeritageOpt
528 %type <classTail_> ClassTail
529 %type <target_> Comprehension
530 %type <comprehension_> ComprehensionFor
531 %type <comprehension_> ComprehensionIf
532 %type <comprehension_> ComprehensionTail
533 %type <propertyName_> ComputedPropertyName
534 %type <expression_> ConditionalExpression
535 %type <statement_> ContinueStatement
536 %type <statement_> ConciseBody
537 %type <parenthetical_> CoverParenthesizedExpressionAndArrowParameterList
538 %type <statement_> DebuggerStatement
539 %type <statement_> Declaration_
540 %type <statement_> Declaration
541 %type <clause_> DefaultClause
542 %type <element_> ElementList_
543 %type <element_> ElementList
544 %type <element_> ElementListOpt
545 %type <statement_> ElseStatementOpt
546 %type <for_> EmptyStatement
547 %type <expression_> EqualityExpression
548 %type <expression_> Expression
549 %type <expression_> ExpressionOpt
550 %type <for_> ExpressionStatement_
551 %type <statement_> ExpressionStatement
552 %type <statement_> ExternC
553 %type <statement_> ExternCStatement
554 %type <statement_> ExternCStatementListOpt
555 %type <finally_> Finally
556 %type <binding_> ForBinding
557 %type <forin_> ForDeclaration
558 %type <forin_> ForInStatementInitializer
559 %type <for_> ForStatementInitializer
560 %type <binding_> FormalParameter
561 %type <functionParameter_> FormalParameterList_
562 %type <functionParameter_> FormalParameterList
563 %type <functionParameter_> FormalParameters
564 %type <string_> FromClause
565 %type <statement_> FunctionBody
566 %type <statement_> FunctionDeclaration
567 %type <target_> FunctionExpression
568 %type <statement_> FunctionStatementList
569 %type <statement_> GeneratorBody
570 %type <statement_> GeneratorDeclaration
571 %type <target_> GeneratorExpression
572 %type <method_> GeneratorMethod
573 %type <statement_> HoistableDeclaration
574 %type <identifier_> Identifier
575 %type <identifier_> IdentifierNoOf
576 %type <identifier_> IdentifierType
577 %type <identifier_> IdentifierTypeNoOf
578 %type <identifier_> IdentifierTypeOpt
579 %type <word_> IdentifierName
580 %type <variable_> IdentifierReference
581 %type <statement_> IfStatement
582 %type <import_> ImportClause
583 %type <statement_> ImportDeclaration
584 %type <import_> ImportSpecifier
585 %type <identifier_> ImportedBinding
586 %type <import_> ImportedDefaultBinding
587 %type <import_> ImportsList_
588 %type <import_> ImportsList
589 %type <import_> ImportsListOpt
590 %type <target_> IndirectExpression
591 %type <expression_> Initializer
592 %type <expression_> InitializerOpt
593 %type <statement_> IterationStatement
594 %type <identifier_> LabelIdentifier
595 %type <statement_> LabelledItem
596 %type <statement_> LabelledStatement
597 %type <assignment_> LeftHandSideAssignment
598 %type <target_> LeftHandSideExpression
599 %type <bool_> LetOrConst
600 %type <binding_> LexicalBinding
601 %type <for_> LexicalDeclaration_
602 %type <statement_> LexicalDeclaration
603 %type <literal_> Literal
604 %type <propertyName_> LiteralPropertyName
605 %type <expression_> LogicalANDExpression
606 %type <expression_> LogicalORExpression
607 %type <access_> MemberAccess
608 %type <target_> MemberExpression
609 %type <method_> MethodDefinition
610 %type <statement_> ModuleBody
611 %type <statement_> ModuleBodyOpt
612 %type <statement_> ModuleItem
613 %type <statement_> ModuleItemList
614 %type <statement_> ModuleItemListOpt
615 %type <module_> ModulePath
616 %type <string_> ModuleSpecifier
617 %type <expression_> MultiplicativeExpression
618 %type <import_> NameSpaceImport
619 %type <import_> NamedImports
620 %type <target_> NewExpression
621 %type <null_> NullLiteral
622 %type <literal_> ObjectLiteral
623 %type <expression_> PostfixExpression
624 %type <target_> PrimaryExpression
625 %type <propertyName_> PropertyName
626 %type <property_> PropertyDefinition
627 %type <property_> PropertyDefinitionList_
628 %type <property_> PropertyDefinitionList
629 %type <property_> PropertyDefinitionListOpt
630 %type <functionParameter_> PropertySetParameterList
631 %type <literal_> RegularExpressionLiteral
632 %type <bool_> RegularExpressionSlash
633 %type <expression_> RelationalExpression
634 %type <statement_> ReturnStatement
635 %type <braced_> BracedParameter
636 %type <functionParameter_> RubyProcParameterList_
637 %type <functionParameter_> RubyProcParameterList
638 %type <functionParameter_> RubyProcParameters
639 %type <functionParameter_> RubyProcParametersOpt
640 %type <statement_> Script
641 %type <statement_> ScriptBody
642 %type <statement_> ScriptBodyOpt
643 %type <expression_> ShiftExpression
644 %type <binding_> SingleNameBinding
645 %type <statement_> Statement__
646 %type <statement_> Statement_
647 %type <statement_> Statement
648 %type <statement_> StatementList
649 %type <statement_> StatementListOpt
650 %type <statement_> StatementListItem
651 %type <functionParameter_> StrictFormalParameters
652 %type <target_> SuperCall
653 %type <target_> SuperProperty
654 %type <statement_> SwitchStatement
655 %type <target_> TemplateLiteral
656 %type <span_> TemplateSpans
657 %type <statement_> ThrowStatement
658 %type <statement_> TryStatement
659 %type <statement_> TypeDefinition
660 %type <expression_> UnaryExpression_
661 %type <expression_> UnaryExpression
662 %type <binding_> VariableDeclaration
663 %type <bindings_> VariableDeclarationList_
664 %type <bindings_> VariableDeclarationList
665 %type <for_> VariableStatement_
666 %type <statement_> VariableStatement
667 %type <statement_> WithStatement
669 %type <word_> WordNoUnary
671 %type <word_> WordOpt
673 %type <expression_> YieldExpression
676 %type <constant_> EnumConstantListOpt_
677 %type <constant_> EnumConstantListOpt
678 %type <number_> IntegerNumber
679 %type <integral_> IntegerType
680 %type <integral_> IntegerTypeOpt
681 %type <typedName_> PrefixedType
682 %type <specifier_> PrimitiveReference
683 %type <specifier_> PrimitiveType
684 %type <structField_> StructFieldListOpt
685 %type <typedName_> SuffixedType
686 %type <typedName_> SuffixedTypeOpt
687 %type <typedName_> TypeSignifier
688 %type <typedName_> TypeSignifierNone
689 %type <typedName_> TypeSignifierOpt
690 %type <signing_> TypeSigning
691 %type <modifier_> ParameterTail
692 %type <modifier_> TypeQualifierLeft
693 %type <modifier_> TypeQualifierLeftOpt
694 %type <typedName_> TypeQualifierRight
695 %type <typedName_> TypeQualifierRightOpt
696 %type <typedName_> TypedIdentifierDefinition
697 %type <typedThing_> TypedIdentifierEncoding
698 %type <typedName_> TypedIdentifierField
699 %type <typedName_> TypedIdentifierMaybe
700 %type <typedLocation_> TypedIdentifierNo
701 %type <typedName_> TypedIdentifierTagged
702 %type <typedName_> TypedIdentifierYes
703 %type <typedFormal_> TypedParameterList_
704 %type <typedFormal_> TypedParameterList
705 %type <typedFormal_> TypedParameterListOpt
706 %type <typedParameter_> TypedParameters
710 %type <expression_> AssignmentExpressionClassic
711 %type <expression_> BoxableExpression
712 %type <statement_> CategoryStatement
713 %type <expression_> ClassSuperOpt
714 %type <expression_> ConditionalExpressionClassic
715 %type <message_> ClassMessageDeclaration
716 %type <message_> ClassMessageDeclarationListOpt
717 %type <protocol_> ClassProtocolListOpt
718 %type <protocol_> ClassProtocols
719 %type <protocol_> ClassProtocolsOpt
720 %type <implementationField_> ImplementationFieldListOpt
721 %type <statement_> ImplementationStatement
722 %type <keyValue_> KeyValuePairList_
723 %type <keyValue_> KeyValuePairList
724 %type <keyValue_> KeyValuePairListOpt
725 %type <target_> MessageExpression
726 %type <messageParameter_> MessageParameter
727 %type <messageParameter_> MessageParameters
728 %type <messageParameter_> MessageParameterList
729 %type <messageParameter_> MessageParameterListOpt
730 %type <bool_> MessageScope
731 %type <argument_> SelectorCall_
732 %type <argument_> SelectorCall
733 %type <selector_> SelectorExpression_
734 %type <selector_> SelectorExpression
735 %type <selector_> SelectorExpressionOpt
736 %type <argument_> SelectorList
737 %type <word_> SelectorWordOpt
738 %type <typedThing_> TypeOpt
739 %type <argument_> VariadicCall
743 %type <propertyIdentifier_> PropertyIdentifier_
744 %type <selector_> PropertySelector_
745 %type <selector_> PropertySelector
746 %type <identifier_> QualifiedIdentifier_
747 %type <identifier_> QualifiedIdentifier
748 %type <identifier_> WildcardIdentifier
749 %type <identifier_> XMLComment
750 %type <identifier_> XMLCDATA
751 %type <identifier_> XMLElement
752 %type <identifier_> XMLElementContent
753 %type <identifier_> XMLMarkup
754 %type <identifier_> XMLPI
756 %type <attribute_> AttributeIdentifier
757 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
758 %type <expression_> PropertyIdentifier
759 %type <expression_> XMLListInitilizer
760 %type <expression_> XMLInitilizer
763 /* Token Priorities {{{ */
774 %token MarkExpression
781 | MarkExpression Expression[expression] { driver.context_ = $expression; }
784 /* Lexer State {{{ */
785 LexPushInOn: { driver.in_.push(true); };
786 LexPushInOff: { driver.in_.push(false); };
787 LexPopIn: { driver.in_.pop(); };
789 LexPushReturnOn: { driver.return_.push(true); };
790 LexPopReturn: { driver.return_.pop(); };
791 Return: "return"[return] { if (!driver.return_.top()) CYERR(@return, "invalid return"); };
793 LexPushSuperOn: { driver.super_.push(true); };
794 LexPushSuperOff: { driver.super_.push(false); };
795 LexPopSuper: { driver.super_.pop(); };
796 Super: "super"[super] { if (!driver.super_.top()) CYERR(@super, "invalid super"); };
798 LexPushYieldOn: { driver.yield_.push(true); };
799 LexPushYieldOff: { driver.yield_.push(false); };
800 LexPopYield: { driver.yield_.pop(); };
803 : { CYLEX(); if (driver.newline_) { CYHLD(@$, tk::NewLine); } }
807 : { CYLEX(); CYHLD(@$, driver.newline_ ? tk::NewLine : tk::__); }
811 : { CYMAP(YieldStar, Star); }
815 : { CYMAP(OpenBrace_, OpenBrace); }
819 : { CYMAP(_class__, _class_); }
823 : { CYMAP(_function__, _function_); }
827 : LexNoBrace LexNoClass LexNoFunction
830 /* Virtual Tokens {{{ */
836 /* 11.6 Names and Keywords {{{ */
838 : Word[pass] { $$ = $pass; }
839 | "for" { $$ = CYNew CYWord("for"); }
840 | "in" { $$ = CYNew CYWord("in"); }
841 | "instanceof" { $$ = CYNew CYWord("instanceof"); }
845 : IdentifierNoOf[pass] { $$ = $pass; }
846 | "break" { $$ = CYNew CYWord("break"); }
847 | "case" { $$ = CYNew CYWord("case"); }
848 | "catch" { $$ = CYNew CYWord("catch"); }
849 | "class" LexOf { $$ = CYNew CYWord("class"); }
850 | ";class" { $$ = CYNew CYWord("class"); }
851 | "const" { $$ = CYNew CYWord("const"); }
852 | "continue" { $$ = CYNew CYWord("continue"); }
853 | "debugger" { $$ = CYNew CYWord("debugger"); }
854 | "default" { $$ = CYNew CYWord("default"); }
855 | "do" { $$ = CYNew CYWord("do"); }
856 | "else" { $$ = CYNew CYWord("else"); }
857 | "enum" { $$ = CYNew CYWord("enum"); }
858 | "export" { $$ = CYNew CYWord("export"); }
859 | "extends" { $$ = CYNew CYWord("extends"); }
860 | "false" { $$ = CYNew CYWord("false"); }
861 | "finally" { $$ = CYNew CYWord("finally"); }
862 | "function" LexOf { $$ = CYNew CYWord("function"); }
863 | "if" { $$ = CYNew CYWord("if"); }
864 | "import" { $$ = CYNew CYWord("import"); }
865 | "!in" { $$ = CYNew CYWord("in"); }
866 | "!of" { $$ = CYNew CYWord("of"); }
867 | "null" { $$ = CYNew CYWord("null"); }
868 | "return" { $$ = CYNew CYWord("return"); }
869 | "super" { $$ = CYNew CYWord("super"); }
870 | "switch" { $$ = CYNew CYWord("switch"); }
871 | "this" { $$ = CYNew CYWord("this"); }
872 | "throw" { $$ = CYNew CYWord("throw"); }
873 | "true" { $$ = CYNew CYWord("true"); }
874 | "try" { $$ = CYNew CYWord("try"); }
875 | "var" { $$ = CYNew CYWord("var"); }
876 | "while" { $$ = CYNew CYWord("while"); }
877 | "with" { $$ = CYNew CYWord("with"); }
881 : WordNoUnary[pass] { $$ = $pass; }
882 | "delete" { $$ = CYNew CYWord("delete"); }
883 | "typeof" { $$ = CYNew CYWord("typeof"); }
884 | "void" { $$ = CYNew CYWord("void"); }
885 | "yield" { $$ = CYNew CYIdentifier("yield"); }
890 : Word[pass] { $$ = $pass; }
895 /* 11.8.1 Null Literals {{{ */
897 : "null" { $$ = CYNew CYNull(); }
900 /* 11.8.2 Boolean Literals {{{ */
902 : "true" { $$ = CYNew CYTrue(); }
903 | "false" { $$ = CYNew CYFalse(); }
906 /* 11.8.5 Regular Expression Literals {{{ */
907 RegularExpressionSlash
908 : "/" { $$ = false; }
909 | "/=" { $$ = true; }
912 RegularExpressionLiteral
913 : RegularExpressionSlash[equals] { CYMPT(@$); driver.SetRegEx($equals); } RegularExpressionLiteral_[pass] { $$ = $pass; }
917 /* 11.9 Automatic Semicolon Insertion {{{ */
919 : { driver.Warning(@$, "warning, automatic semi-colon insertion required"); }
927 : LexNewLineOrNot "\n"
932 : LexNewLineOrNot "\n" StrictSemi
933 | NewLineNot LexOf Terminator
938 | error { if (yyla.type_get() != yyeof_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
943 | error { if (yyla.type_get() != yyeof_ && yyla.type != yytranslate_(token::CloseBrace) && !driver.newline_) CYERR(@error, "required semi-colon"); else CYEOK(); } StrictSemi
948 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
952 /* 12.1 Identifiers {{{ */
954 : Identifier[pass] { $$ = CYNew CYVariable($pass); }
955 | "yield" { $$ = CYNew CYVariable(CYNew CYIdentifier("yield")); }
959 : LexOf IdentifierNoOf[pass] { $$ = $pass; }
960 | LexOf "!of" { $$ = CYNew CYIdentifier("of"); }
961 | LexOf "yield" { $$ = CYNew CYIdentifier("yield"); }
965 : BindingIdentifier[pass] { $$ = $pass; }
966 | LexOf { $$ = NULL; }
970 : Identifier[pass] { $$ = $pass; }
971 | "yield" { $$ = CYNew CYIdentifier("yield"); }
975 : Identifier_[pass] { $$ = $pass; }
976 | "abstract" { $$ = CYNew CYIdentifier("abstract"); }
977 | "as" { $$ = CYNew CYIdentifier("as"); }
978 | "await" { $$ = CYNew CYIdentifier("await"); }
979 | "boolean" { $$ = CYNew CYIdentifier("boolean"); }
980 | "byte" { $$ = CYNew CYIdentifier("byte"); }
981 | "constructor" { $$ = CYNew CYIdentifier("constructor"); }
982 | "each" { $$ = CYNew CYIdentifier("each"); }
983 | "eval" { $$ = CYNew CYIdentifier("eval"); }
984 | "final" { $$ = CYNew CYIdentifier("final"); }
985 | "from" { $$ = CYNew CYIdentifier("from"); }
986 | "get" { $$ = CYNew CYIdentifier("get"); }
987 | "goto" { $$ = CYNew CYIdentifier("goto"); }
988 | "implements" { $$ = CYNew CYIdentifier("implements"); }
989 | "Infinity" { $$ = CYNew CYIdentifier("Infinity"); }
990 | "interface" { $$ = CYNew CYIdentifier("interface"); }
991 | "let" { $$ = CYNew CYIdentifier("let"); }
992 | "!let" LexBind LexOf { $$ = CYNew CYIdentifier("let"); }
993 | "native" { $$ = CYNew CYIdentifier("native"); }
994 | "package" { $$ = CYNew CYIdentifier("package"); }
995 | "private" { $$ = CYNew CYIdentifier("private"); }
996 | "protected" { $$ = CYNew CYIdentifier("protected"); }
997 | "__proto__" { $$ = CYNew CYIdentifier("__proto__"); }
998 | "prototype" { $$ = CYNew CYIdentifier("prototype"); }
999 | "public" { $$ = CYNew CYIdentifier("public"); }
1000 | "set" { $$ = CYNew CYIdentifier("set"); }
1001 | "synchronized" { $$ = CYNew CYIdentifier("synchronized"); }
1002 | "target" { $$ = CYNew CYIdentifier("target"); }
1003 | "throws" { $$ = CYNew CYIdentifier("throws"); }
1004 | "transient" { $$ = CYNew CYIdentifier("transient"); }
1005 | "typeid" { $$ = CYNew CYIdentifier("typeid"); }
1006 | "undefined" { $$ = CYNew CYIdentifier("undefined"); }
1008 | "bool" { $$ = CYNew CYIdentifier("bool"); }
1009 | "BOOL" { $$ = CYNew CYIdentifier("BOOL"); }
1010 | "id" { $$ = CYNew CYIdentifier("id"); }
1011 | "SEL" { $$ = CYNew CYIdentifier("SEL"); }
1016 : IdentifierTypeNoOf[pass] { $$ = $pass; }
1017 | "of" { $$ = CYNew CYIdentifier("of"); }
1021 : IdentifierType[pass] { $$ = $pass; }
1026 : IdentifierTypeNoOf
1027 | "char" { $$ = CYNew CYIdentifier("char"); }
1028 | "double" { $$ = CYNew CYIdentifier("double"); }
1029 | "float" { $$ = CYNew CYIdentifier("float"); }
1030 | "int" { $$ = CYNew CYIdentifier("int"); }
1031 | "__int128" { $$ = CYNew CYIdentifier("__int128"); }
1032 | "long" { $$ = CYNew CYIdentifier("long"); }
1033 | "short" { $$ = CYNew CYIdentifier("short"); }
1034 | "static" { $$ = CYNew CYIdentifier("static"); }
1035 | "volatile" { $$ = CYNew CYIdentifier("volatile"); }
1037 | "signed" { $$ = CYNew CYIdentifier("signed"); }
1038 | "unsigned" { $$ = CYNew CYIdentifier("unsigned"); }
1041 | "nil" { $$ = CYNew CYIdentifier("nil"); }
1042 | "NO" { $$ = CYNew CYIdentifier("NO"); }
1043 | "NULL" { $$ = CYNew CYIdentifier("NULL"); }
1044 | "YES" { $$ = CYNew CYIdentifier("YES"); }
1049 : IdentifierNoOf[pass] { $$ = $pass; }
1050 | "of" { $$ = CYNew CYIdentifier("of"); }
1051 | "!of" { $$ = CYNew CYIdentifier("of"); }
1054 /* 12.2 Primary Expression {{{ */
1056 : "this" { $$ = CYNew CYThis(); }
1057 | IdentifierReference[pass] { $$ = $pass; }
1058 | Literal[pass] { $$ = $pass; }
1059 | ArrayLiteral[pass] { $$ = $pass; }
1060 | ObjectLiteral[pass] { $$ = $pass; }
1061 | FunctionExpression[pass] { $$ = $pass; }
1062 | ClassExpression[pass] { $$ = $pass; }
1063 | GeneratorExpression[pass] { $$ = $pass; }
1064 | RegularExpressionLiteral[pass] { $$ = $pass; }
1065 | TemplateLiteral[pass] { $$ = $pass; }
1066 | CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) CYERR(@cover, "invalid parenthetical"); $$ = $cover; }
1067 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
1070 CoverParenthesizedExpressionAndArrowParameterList
1071 : "(" Expression[expression] ")" { $$ = CYNew CYParenthetical($expression); }
1072 | "(" LexOf ")" { $$ = NULL; }
1073 | "(" LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1074 | "(" Expression "," LexOf "..." BindingIdentifier ")" { CYNOT(@$); }
1077 /* 12.2.4 Literals {{{ */
1079 : NullLiteral[pass] { $$ = $pass; }
1080 | BooleanLiteral[pass] { $$ = $pass; }
1081 | NumericLiteral[pass] { $$ = $pass; }
1082 | StringLiteral[pass] { $$ = $pass; }
1085 /* 12.2.5 Array Initializer {{{ */
1087 : "[" ElementListOpt[elements] "]" { $$ = CYNew CYArray($elements); }
1091 : AssignmentExpression[value] { $$ = CYNew CYElementValue($value); }
1092 | LexOf "..." AssignmentExpression[values] { $$ = CYNew CYElementSpread($values); }
1096 : "," ElementListOpt[elements] { $$ = $elements; }
1101 : ArrayElement[element] ElementList_[next] { $$ = $element; $$->SetNext($next); }
1102 | LexOf "," ElementListOpt[next] { $$ = CYNew CYElementValue(NULL, $next); }
1106 : ElementList[pass] { $$ = $pass; }
1107 | LexOf { $$ = NULL; }
1110 /* 12.2.6 Object Initializer {{{ */
1112 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYObject($properties); }
1115 PropertyDefinitionList_
1116 : "," PropertyDefinitionListOpt[properties] { $$ = $properties; }
1120 PropertyDefinitionList
1121 : PropertyDefinition[property] PropertyDefinitionList_[next] { $property->SetNext($next); $$ = $property; }
1124 PropertyDefinitionListOpt
1125 : PropertyDefinitionList[properties] { $$ = $properties; }
1130 : IdentifierReference[value] { $$ = CYNew CYPropertyValue($value->name_, $value); }
1131 | CoverInitializedName[name] { CYNOT(@$); }
1132 | PropertyName[name] ":" AssignmentExpression[value] { $$ = CYNew CYPropertyValue($name, $value); }
1133 | MethodDefinition[pass] { $$ = $pass; }
1137 : LiteralPropertyName[pass] { $$ = $pass; }
1138 | ComputedPropertyName[pass] { $$ = $pass; }
1142 : IdentifierName[pass] { $$ = $pass; }
1143 | StringLiteral[pass] { $$ = $pass; }
1144 | NumericLiteral[pass] { $$ = $pass; }
1147 ComputedPropertyName
1148 : "[" AssignmentExpression[expression] "]" { $$ = CYNew CYComputed($expression); }
1151 CoverInitializedName
1152 : IdentifierReference Initializer
1156 : "=" AssignmentExpression[initializer] { $$ = $initializer; }
1160 : Initializer[pass] { $$ = $pass; }
1164 /* 12.2.9 Template Literals {{{ */
1166 : NoSubstitutionTemplate[string] { $$ = CYNew CYTemplate($string, NULL); }
1167 | TemplateHead[string] LexPushInOff TemplateSpans[spans] { $$ = CYNew CYTemplate($string, $spans); }
1171 : Expression[value] TemplateMiddle[string] TemplateSpans[spans] { $$ = CYNew CYSpan($value, $string, $spans); }
1172 | Expression[value] TemplateTail[string] LexPopIn { $$ = CYNew CYSpan($value, $string, NULL); }
1176 /* 12.3 Left-Hand-Side Expressions {{{ */
1178 : "[" Expression[property] "]" { $$ = CYNew CYDirectMember(NULL, $property); }
1179 | "." IdentifierName[property] { $$ = CYNew CYDirectMember(NULL, CYNew CYString($property)); }
1180 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
1181 | TemplateLiteral { CYNOT(@$); }
1185 : PrimaryExpression[pass] { $$ = $pass; }
1186 | MemberExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1187 | SuperProperty[pass] { $$ = $pass; }
1188 | MetaProperty { CYNOT(@$); }
1189 | "new" MemberExpression[constructor] Arguments[arguments] { $$ = CYNew cy::Syntax::New($constructor, $arguments); }
1193 : Super "[" Expression[property] "]" { $$ = CYNew CYSuperAccess($property); }
1194 | Super "." IdentifierName[property] { $$ = CYNew CYSuperAccess(CYNew CYString($property)); }
1202 : "new" "." "target"
1206 : MemberExpression[pass] { $$ = $pass; }
1207 | "new" NewExpression[expression] { $$ = CYNew cy::Syntax::New($expression, NULL); }
1211 : MemberExpression[pass] { $$ = $pass; }
1212 | CallExpression[pass] { $$ = $pass; }
1216 : CallExpression_[function] Arguments[arguments] { if (!$function->Eval()) $$ = CYNew CYCall($function, $arguments); else $$ = CYNew CYEval($arguments); }
1217 | SuperCall[pass] { $$ = $pass; }
1218 | CallExpression[object] { driver.context_ = $object; } MemberAccess[member] { $member->SetLeft($object); $$ = $member; }
1222 : Super Arguments[arguments] { $$ = CYNew CYSuperCall($arguments); }
1226 : "(" ArgumentListOpt[arguments] ")" { $$ = $arguments; }
1230 : "," ArgumentList[arguments] { $$ = $arguments; }
1235 : AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
1236 | LexOf "..." AssignmentExpression { CYNOT(@$); }
1240 : ArgumentList[pass] { $$ = $pass; }
1241 | LexOf { $$ = NULL; }
1245 : NewExpression[pass] { $$ = $pass; }
1246 | CallExpression[pass] { $$ = $pass; }
1249 LeftHandSideExpression
1250 : BracedExpression[pass] { $$ = $pass; }
1251 | IndirectExpression[pass] { $$ = $pass; }
1254 /* 12.4 Postfix Expressions {{{ */
1256 : BracedExpression[pass] { $$ = $pass; }
1257 | AccessExpression[lhs] LexNewLineOrOpt "++" { $$ = CYNew CYPostIncrement($lhs); }
1258 | AccessExpression[lhs] LexNewLineOrOpt "--" { $$ = CYNew CYPostDecrement($lhs); }
1261 /* 12.5 Unary Operators {{{ */
1263 : "delete" UnaryExpression[rhs] { $$ = CYNew CYDelete($rhs); }
1264 | "void" UnaryExpression[rhs] { $$ = CYNew CYVoid($rhs); }
1265 | "typeof" UnaryExpression[rhs] { $$ = CYNew CYTypeOf($rhs); }
1266 | "++" UnaryExpression[rhs] { $$ = CYNew CYPreIncrement($rhs); }
1267 | "--" UnaryExpression[rhs] { $$ = CYNew CYPreDecrement($rhs); }
1268 | "+" UnaryExpression[rhs] { $$ = CYNew CYAffirm($rhs); }
1269 | "-" UnaryExpression[rhs] { $$ = CYNew CYNegate($rhs); }
1270 | "~" UnaryExpression[rhs] { $$ = CYNew CYBitwiseNot($rhs); }
1271 | "!" UnaryExpression[rhs] { $$ = CYNew CYLogicalNot($rhs); }
1275 : PostfixExpression[expression] { $$ = $expression; }
1276 | UnaryExpression_[pass] { $$ = $pass; }
1279 /* 12.6 Multiplicative Operators {{{ */
1280 MultiplicativeExpression
1281 : UnaryExpression[pass] { $$ = $pass; }
1282 | MultiplicativeExpression[lhs] "*" UnaryExpression[rhs] { $$ = CYNew CYMultiply($lhs, $rhs); }
1283 | MultiplicativeExpression[lhs] "/" UnaryExpression[rhs] { $$ = CYNew CYDivide($lhs, $rhs); }
1284 | MultiplicativeExpression[lhs] "%" UnaryExpression[rhs] { $$ = CYNew CYModulus($lhs, $rhs); }
1287 /* 12.7 Additive Operators {{{ */
1289 : MultiplicativeExpression[pass] { $$ = $pass; }
1290 | AdditiveExpression[lhs] "+" MultiplicativeExpression[rhs] { $$ = CYNew CYAdd($lhs, $rhs); }
1291 | AdditiveExpression[lhs] "-" MultiplicativeExpression[rhs] { $$ = CYNew CYSubtract($lhs, $rhs); }
1294 /* 12.8 Bitwise Shift Operators {{{ */
1296 : AdditiveExpression[pass] { $$ = $pass; }
1297 | ShiftExpression[lhs] "<<" AdditiveExpression[rhs] { $$ = CYNew CYShiftLeft($lhs, $rhs); }
1298 | ShiftExpression[lhs] ">>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightSigned($lhs, $rhs); }
1299 | ShiftExpression[lhs] ">>>" AdditiveExpression[rhs] { $$ = CYNew CYShiftRightUnsigned($lhs, $rhs); }
1302 /* 12.9 Relational Operators {{{ */
1303 RelationalExpression
1304 : ShiftExpression[pass] { $$ = $pass; }
1305 | RelationalExpression[lhs] "<" ShiftExpression[rhs] { $$ = CYNew CYLess($lhs, $rhs); }
1306 | RelationalExpression[lhs] ">" ShiftExpression[rhs] { $$ = CYNew CYGreater($lhs, $rhs); }
1307 | RelationalExpression[lhs] "<=" ShiftExpression[rhs] { $$ = CYNew CYLessOrEqual($lhs, $rhs); }
1308 | RelationalExpression[lhs] ">=" ShiftExpression[rhs] { $$ = CYNew CYGreaterOrEqual($lhs, $rhs); }
1309 | RelationalExpression[lhs] "instanceof" ShiftExpression[rhs] { $$ = CYNew CYInstanceOf($lhs, $rhs); }
1310 | RelationalExpression[lhs] "in" ShiftExpression[rhs] { $$ = CYNew CYIn($lhs, $rhs); }
1313 /* 12.10 Equality Operators {{{ */
1315 : RelationalExpression[pass] { $$ = $pass; }
1316 | EqualityExpression[lhs] "==" RelationalExpression[rhs] { $$ = CYNew CYEqual($lhs, $rhs); }
1317 | EqualityExpression[lhs] "!=" RelationalExpression[rhs] { $$ = CYNew CYNotEqual($lhs, $rhs); }
1318 | EqualityExpression[lhs] "===" RelationalExpression[rhs] { $$ = CYNew CYIdentical($lhs, $rhs); }
1319 | EqualityExpression[lhs] "!==" RelationalExpression[rhs] { $$ = CYNew CYNotIdentical($lhs, $rhs); }
1322 /* 12.11 Binary Bitwise Operators {{{ */
1323 BitwiseANDExpression
1324 : EqualityExpression[pass] { $$ = $pass; }
1325 | BitwiseANDExpression[lhs] "&" EqualityExpression[rhs] { $$ = CYNew CYBitwiseAnd($lhs, $rhs); }
1328 BitwiseXORExpression
1329 : BitwiseANDExpression[pass] { $$ = $pass; }
1330 | BitwiseXORExpression[lhs] "^" BitwiseANDExpression[rhs] { $$ = CYNew CYBitwiseXOr($lhs, $rhs); }
1334 : BitwiseXORExpression[pass] { $$ = $pass; }
1335 | BitwiseORExpression[lhs] "|" BitwiseXORExpression[rhs] { $$ = CYNew CYBitwiseOr($lhs, $rhs); }
1338 /* 12.12 Binary Logical Operators {{{ */
1339 LogicalANDExpression
1340 : BitwiseORExpression[pass] { $$ = $pass; }
1341 | LogicalANDExpression[lhs] "&&" BitwiseORExpression[rhs] { $$ = CYNew CYLogicalAnd($lhs, $rhs); }
1345 : LogicalANDExpression[pass] { $$ = $pass; }
1346 | LogicalORExpression[lhs] "||" LogicalANDExpression[rhs] { $$ = CYNew CYLogicalOr($lhs, $rhs); }
1349 /* 12.13 Conditional Operator ( ? : ) {{{ */
1351 ConditionalExpressionClassic
1352 : LogicalORExpression[pass] { $$ = $pass; }
1353 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpressionClassic[false] { $$ = CYNew CYCondition($test, $true, $false); }
1357 ConditionalExpression
1358 : LogicalORExpression[pass] { $$ = $pass; }
1359 | LogicalORExpression[test] "?" LexPushInOff AssignmentExpression[true] ":" LexPopIn AssignmentExpression[false] { $$ = CYNew CYCondition($test, $true, $false); }
1362 /* 12.14 Assignment Operators {{{ */
1363 LeftHandSideAssignment
1364 : LeftHandSideExpression[lhs] "=" { $$ = CYNew CYAssign($lhs, NULL); }
1365 | LeftHandSideExpression[lhs] "*=" { $$ = CYNew CYMultiplyAssign($lhs, NULL); }
1366 | LeftHandSideExpression[lhs] "/=" { $$ = CYNew CYDivideAssign($lhs, NULL); }
1367 | LeftHandSideExpression[lhs] "%=" { $$ = CYNew CYModulusAssign($lhs, NULL); }
1368 | LeftHandSideExpression[lhs] "+=" { $$ = CYNew CYAddAssign($lhs, NULL); }
1369 | LeftHandSideExpression[lhs] "-=" { $$ = CYNew CYSubtractAssign($lhs, NULL); }
1370 | LeftHandSideExpression[lhs] "<<=" { $$ = CYNew CYShiftLeftAssign($lhs, NULL); }
1371 | LeftHandSideExpression[lhs] ">>=" { $$ = CYNew CYShiftRightSignedAssign($lhs, NULL); }
1372 | LeftHandSideExpression[lhs] ">>>=" { $$ = CYNew CYShiftRightUnsignedAssign($lhs, NULL); }
1373 | LeftHandSideExpression[lhs] "&=" { $$ = CYNew CYBitwiseAndAssign($lhs, NULL); }
1374 | LeftHandSideExpression[lhs] "^=" { $$ = CYNew CYBitwiseXOrAssign($lhs, NULL); }
1375 | LeftHandSideExpression[lhs] "|=" { $$ = CYNew CYBitwiseOrAssign($lhs, NULL); }
1379 AssignmentExpressionClassic
1380 : LexOf ConditionalExpressionClassic[pass] { $$ = $pass; }
1381 | LexOf LeftHandSideAssignment[assignment] AssignmentExpressionClassic[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1385 AssignmentExpression
1386 : LexOf ConditionalExpression[pass] { $$ = $pass; }
1387 | LexOf YieldExpression[pass] { $$ = $pass; }
1388 | ArrowFunction[pass] { $$ = $pass; }
1389 | LexOf LeftHandSideAssignment[assignment] AssignmentExpression[rhs] { $assignment->SetRight($rhs); $$ = $assignment; }
1392 /* 12.15 Comma Operator ( , ) {{{ */
1394 : AssignmentExpression[pass] { $$ = $pass; }
1395 | Expression[expression] "," AssignmentExpression[next] { $$ = CYNew CYCompound($expression, $next); }
1399 : Expression[pass] { $$ = $pass; }
1400 | LexOf { $$ = NULL; }
1404 /* 13 Statements and Declarations {{{ */
1406 : BlockStatement[pass] { $$ = $pass; }
1407 | VariableStatement[pass] { $$ = $pass; }
1408 | EmptyStatement[pass] { $$ = $pass; }
1409 | IfStatement[pass] { $$ = $pass; }
1410 | BreakableStatement[pass] { $$ = $pass; }
1411 | ContinueStatement[pass] { $$ = $pass; }
1412 | BreakStatement[pass] { $$ = $pass; }
1413 | ReturnStatement[pass] { $$ = $pass; }
1414 | WithStatement[pass] { $$ = $pass; }
1415 | LabelledStatement[pass] { $$ = $pass; }
1416 | ThrowStatement[pass] { $$ = $pass; }
1417 | TryStatement[pass] { $$ = $pass; }
1418 | DebuggerStatement[pass] { $$ = $pass; }
1422 : LexOf Statement__[pass] { $$ = $pass; }
1423 | ExpressionStatement[pass] { $$ = $pass; }
1427 : LexSetStatement LexLet Statement_[pass] { $$ = $pass; }
1431 : HoistableDeclaration[pass] { $$ = $pass; }
1432 | ClassDeclaration[pass] { $$ = $pass; }
1436 : LexSetStatement LexLet LexOf Declaration_[pass] { $$ = $pass; }
1437 | LexSetStatement LexicalDeclaration[pass] { $$ = $pass; }
1440 HoistableDeclaration
1441 : FunctionDeclaration[pass] { $$ = $pass; }
1442 | GeneratorDeclaration[pass] { $$ = $pass; }
1446 : IterationStatement[pass] { $$ = $pass; }
1447 | SwitchStatement[pass] { $$ = $pass; }
1450 /* 13.2 Block {{{ */
1452 : ";{" StatementListOpt[code] "}" { $$ = CYNew CYBlock($code); }
1456 : "{" StatementListOpt[code] "}" { $$ = $code; }
1460 : StatementListItem[statement] StatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1464 : StatementList[pass] { $$ = $pass; }
1465 | LexSetStatement LexLet LexOf { $$ = NULL; }
1469 : Statement[pass] { $$ = $pass; }
1470 | Declaration[pass] { $$ = $pass; }
1473 /* 13.3 Let and Const Declarations {{{ */
1475 : LetOrConst[constant] BindingList[bindings] { $$ = CYNew CYLexical($constant, $bindings); }
1479 : LexicalDeclaration_[statement] Terminator { $$ = $statement; }
1483 : { CYMAP(_let__, _let_); }
1487 : { CYMAP(_of__, _of_); }
1491 : { CYMAP(OpenBrace_let, OpenBrace); CYMAP(OpenBracket_let, OpenBracket); }
1495 : LexLet LexOf "!let" LexBind LexOf { $$ = false; }
1496 | LexLet LexOf "const" { $$ = true; }
1500 : "," LexBind BindingList[bindings] { $$ = $bindings; }
1505 : LexicalBinding[binding] BindingList_[next] { $$ = CYNew CYBindings($binding, $next); }
1509 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1510 | LexOf BindingPattern Initializer { CYNOT(@$); }
1513 /* 13.3.2 Variable Statement {{{ */
1515 : Var_ VariableDeclarationList[bindings] { $$ = CYNew CYVar($bindings); }
1519 : VariableStatement_[statement] Terminator { $$ = $statement; }
1522 VariableDeclarationList_
1523 : "," VariableDeclarationList[bindings] { $$ = $bindings; }
1527 VariableDeclarationList
1528 : LexBind VariableDeclaration[binding] VariableDeclarationList_[next] { $$ = CYNew CYBindings($binding, $next); }
1532 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1533 | LexOf BindingPattern Initializer { CYNOT(@$); }
1536 /* 13.3.3 Destructuring Binding Patterns {{{ */
1538 : ObjectBindingPattern
1539 | ArrayBindingPattern
1542 ObjectBindingPattern
1543 : "let {" BindingPropertyListOpt "}"
1547 : "let [" BindingElementListOpt "]"
1550 BindingPropertyList_
1551 : "," BindingPropertyListOpt
1556 : BindingProperty BindingPropertyList_
1559 BindingPropertyListOpt
1560 : BindingPropertyList
1565 : BindingElementOpt[element] "," BindingElementListOpt[next]
1566 | BindingRestElement[element]
1567 | BindingElement[element]
1570 BindingElementListOpt
1571 : BindingElementList[pass]
1577 | LexOf PropertyName ":" BindingElement
1581 : LexBind SingleNameBinding[pass] { $$ = $pass; }
1582 | LexBind LexOf BindingPattern InitializerOpt[initializer] { CYNOT(@$); }
1586 : BindingElement[pass]
1591 : BindingIdentifier[identifier] InitializerOpt[initializer] { $$ = CYNew CYBinding($identifier, $initializer); }
1595 : LexBind LexOf "..." BindingIdentifier
1598 /* 13.4 Empty Statement {{{ */
1600 : ";" { $$ = CYNew CYEmpty(); }
1603 /* 13.5 Expression Statement {{{ */
1604 ExpressionStatement_
1605 : Expression[expression] { $$ = CYNew CYExpress($[expression]); }
1608 : ExpressionStatement_[statement] Terminator { $$ = $statement; }
1611 /* 13.6 The if Statement {{{ */
1613 : "else" Statement[false] { $$ = $false; }
1614 | %prec "if" { $$ = NULL; }
1618 : "if" "(" Expression[test] ")" Statement[true] ElseStatementOpt[false] { $$ = CYNew CYIf($test, $true, $false); }
1621 /* 13.7 Iteration Statements {{{ */
1623 : "do" Statement[code] "while" "(" Expression[test] ")" TerminatorOpt { $$ = CYNew CYDoWhile($test, $code); }
1624 | "while" "(" Expression[test] ")" Statement[code] { $$ = CYNew CYWhile($test, $code); }
1625 | "for" "(" LexPushInOn ForStatementInitializer[initializer] LexPopIn ExpressionOpt[test] ";" ExpressionOpt[increment] ")" Statement[code] { $$ = CYNew CYFor($initializer, $test, $increment, $code); }
1626 | "for" "(" LexPushInOn LexLet LexOf Var_ LexBind BindingIdentifier[identifier] Initializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForInitialized(CYNew CYBinding($identifier, $initializer), $iterable, $code); }
1627 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForIn($initializer, $iterable, $code); }
1628 | "for" "(" LexPushInOn ForInStatementInitializer[initializer] "of" LexPopIn AssignmentExpression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
1631 ForStatementInitializer
1632 : LexLet LexOf EmptyStatement[pass] { $$ = $pass; }
1633 | LexLet ExpressionStatement_[initializer] ";" { $$ = $initializer; }
1634 | LexLet LexOf VariableStatement_[initializer] ";" { $$ = $initializer; }
1635 | LexicalDeclaration_[initializer] ";" { $$ = $initializer; }
1638 ForInStatementInitializer
1639 : LexLet LexOf BracedExpression[pass] { $$ = $pass; }
1640 | LexLet LexOf IndirectExpression[pass] { $$ = $pass; }
1641 | LexLet LexOf Var_ LexBind ForBinding[binding] { $$ = CYNew CYForVariable($binding); }
1642 | ForDeclaration[pass] { $$ = $pass; }
1646 : LetOrConst[constant] ForBinding[binding] { $$ = CYNew CYForLexical($constant, $binding); }
1650 : BindingIdentifier[identifier] { $$ = CYNew CYBinding($identifier, NULL); }
1651 | LexOf BindingPattern { CYNOT(@$); }
1654 /* 13.8 The continue Statement {{{ */
1656 : "continue" TerminatorSoft { $$ = CYNew CYContinue(NULL); }
1657 | "continue" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYContinue($label); }
1660 /* 13.9 The break Statement {{{ */
1662 : "break" TerminatorSoft { $$ = CYNew CYBreak(NULL); }
1663 | "break" NewLineNot LexOf Identifier[label] Terminator { $$ = CYNew CYBreak($label); }
1666 /* 13.10 The return Statement {{{ */
1668 : Return TerminatorSoft { $$ = CYNew CYReturn(NULL); }
1669 | Return NewLineNot Expression[value] Terminator { $$ = CYNew CYReturn($value); }
1672 /* 13.11 The with Statement {{{ */
1674 : "with" "(" Expression[scope] ")" Statement[code] { $$ = CYNew CYWith($scope, $code); }
1677 /* 13.12 The switch Statement {{{ */
1679 : "switch" "(" Expression[value] ")" CaseBlock[clauses] { $$ = CYNew CYSwitch($value, $clauses); }
1683 : "{" CaseClausesOpt[clauses] "}" { $$ = $clauses; }
1687 : "case" Expression[value] ":" StatementListOpt[code] { $$ = CYNew CYClause($value, $code); }
1691 : CaseClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1692 | DefaultClause[clause] CaseClausesOpt[next] { $clause->SetNext($next); $$ = $clause; }
1696 // XXX: the standard makes certain you can only have one of these
1698 : "default" ":" StatementListOpt[code] { $$ = CYNew CYClause(NULL, $code); }
1701 /* 13.13 Labelled Statements {{{ */
1703 : LabelIdentifier[name] ":" LabelledItem[statement] { $$ = CYNew CYLabel($name, $statement); }
1707 : Statement[pass] { $$ = $pass; }
1708 | LexSetStatement LexLet LexOf FunctionDeclaration[pass] { $$ = $pass; }
1711 /* 13.14 The throw Statement {{{ */
1713 : "throw"[throw] TerminatorSoft { CYERR(@throw, "throw without exception"); }
1714 | "throw" NewLineNot Expression[value] Terminator { $$ = CYNew cy::Syntax::Throw($value); }
1717 /* 13.15 The try Statement {{{ */
1719 : "try" Block[code] Catch[catch] { $$ = CYNew cy::Syntax::Try($code, $catch, NULL); }
1720 | "try" Block[code] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, NULL, $finally); }
1721 | "try" Block[code] Catch[catch] Finally[finally] { $$ = CYNew cy::Syntax::Try($code, $catch, $finally); }
1725 : "catch" "(" LexBind CatchParameter[name] ")" Block[code] { $$ = CYNew cy::Syntax::Catch($name, $code); }
1729 : "finally" Block[code] { $$ = CYNew CYFinally($code); }
1733 : BindingIdentifier[pass] { $$ = $pass; }
1734 | LexOf BindingPattern { CYNOT(@$); }
1737 /* 13.16 The debugger Statement {{{ */
1739 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1743 /* 14.1 Function Definitions {{{ */
1745 : ";function" BindingIdentifier[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionStatement($name, $parameters, $code); }
1749 : "function" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" LexPushSuperOff FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYFunctionExpression($name, $parameters, $code); }
1752 StrictFormalParameters
1753 : FormalParameters[pass] { $$ = $pass; }
1757 : LexBind LexOf { $$ = NULL; }
1758 | FormalParameterList
1761 FormalParameterList_
1762 : "," FormalParameterList[parameters] { $$ = $parameters; }
1767 : FunctionRestParameter { CYNOT(@$); }
1768 | FormalParameter[binding] FormalParameterList_[next] { $$ = CYNew CYFunctionParameter($binding, $next); }
1771 FunctionRestParameter
1772 : BindingRestElement
1776 : BindingElement[pass] { $$ = $pass; }
1780 : LexPushYieldOff FunctionStatementList[code] LexPopYield { $$ = $code; }
1783 FunctionStatementList
1784 : LexPushReturnOn StatementListOpt[code] LexPopReturn { $$ = $code; }
1787 /* 14.2 Arrow Function Definitions {{{ */
1789 : ArrowParameters[parameters] LexNewLineOrOpt "=>" LexNoBrace ConciseBody[code] { $$ = CYNew CYFatArrow($parameters, $code); }
1793 : BindingIdentifier[identifier] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier)); }
1794 | LexOf CoverParenthesizedExpressionAndArrowParameterList[cover] { if ($cover == NULL) $$ = NULL; else { $$ = $cover->expression_->Parameter(); if ($$ == NULL) CYERR(@cover, "invalid parameter list"); } }
1798 : AssignmentExpression[expression] { $$ = CYNew CYReturn($expression); }
1799 | LexOf ";{" FunctionBody[code] "}" { $$ = $code; }
1802 /* 14.3 Method Definitions {{{ */
1804 : PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyMethod($name, $parameters, $code); }
1805 | GeneratorMethod[pass] { $$ = $pass; }
1806 | "get" PropertyName[name] "(" ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertyGetter($name, $code); }
1807 | "set" PropertyName[name] "(" PropertySetParameterList[parameter] ")" "{" FunctionBody[code] "}" { $$ = CYNew CYPropertySetter($name, $parameter, $code); }
1810 PropertySetParameterList
1811 : FormalParameter[binding] { $$ = CYNew CYFunctionParameter($binding); }
1814 /* 14.4 Generator Function Definitions {{{ */
1816 : "*" PropertyName[name] "(" StrictFormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorMethod($name, $parameters, $code); */ }
1819 GeneratorDeclaration
1820 : ";function" LexOf "*" BindingIdentifier[name] "(" FormalParameters[code] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorStatement($name, $parameters, $code); */ }
1824 : "function" LexOf "*" BindingIdentifierOpt[name] "(" FormalParameters[parameters] ")" "{" GeneratorBody[code] "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorExpression($name, $parameters, $code); */ }
1828 : LexPushYieldOn FunctionStatementList[code] LexPopYield { $$ = $code; }
1832 : "!yield" LexNewLineOrNot "\n" LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ }
1833 | "!yield" LexNewLineOrNot "" LexNoStar LexOf { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ } %prec "!yield"
1834 | "!yield" LexNewLineOrNot "" LexNoStar AssignmentExpression[value] { CYNOT(@$); /* $$ = CYNew CYYieldValue($value); */ }
1835 | "!yield" LexNewLineOrNot "" LexNoStar LexOf "yield *" AssignmentExpression[generator] { CYNOT(@$); /* $$ = CYNew CYYieldGenerator($generator); */ }
1838 /* 14.5 Class Definitions {{{ */
1840 : ";class" BindingIdentifier[name] ClassTail[tail] { $$ = CYNew CYClassStatement($name, $tail); }
1844 : "class" BindingIdentifierOpt[name] ClassTail[tail] { $$ = CYNew CYClassExpression($name, $tail); }
1848 : ClassHeritageOpt[tail] { driver.class_.push($tail); } "{" LexPushSuperOn ClassBodyOpt "}" LexPopSuper { driver.class_.pop(); $$ = $tail; }
1852 : "extends" AccessExpression[extends] { $$ = CYNew CYClassTail($extends); }
1856 : ClassHeritage[pass] { $$ = $pass; }
1857 | { $$ = CYNew CYClassTail(NULL); }
1870 : ClassElementListOpt ClassElement
1879 : MethodDefinition[method] { if (CYFunctionExpression *constructor = $method->Constructor()) driver.class_.top()->constructor_ = constructor; else driver.class_.top()->instance_->*$method; }
1880 | "static" MethodDefinition[method] { driver.class_.top()->static_->*$method; }
1885 /* 15.1 Scripts {{{ */
1887 : ScriptBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1891 : StatementList[pass] { $$ = $pass; }
1895 : ScriptBody[pass] { $$ = $pass; }
1896 | LexSetStatement LexLet LexOf { $$ = NULL; }
1899 /* 15.2 Modules {{{ */
1901 : ModuleBodyOpt[code] { driver.script_ = CYNew CYScript($code); }
1905 : ModuleItemList[pass] { $$ = $pass; }
1909 : ModuleBody[pass] { $$ = $pass; }
1910 | LexSetStatement LexLet LexOf { $$ = NULL; }
1914 : ModuleItem[statement] ModuleItemListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
1918 : ModuleItemList[pass] { $$ = $pass; }
1919 | LexSetStatement LexLet LexOf { $$ = NULL; }
1923 : LexSetStatement LexLet LexOf ImportDeclaration[pass] { $$ = $pass; }
1924 | LexSetStatement LexLet LexOf ExportDeclaration { CYNOT(@$); }
1925 | StatementListItem[pass] { $$ = $pass; }
1928 /* 15.2.2 Imports {{{ */
1930 : "import" ImportClause[specifiers] FromClause[module] Terminator { $$ = CYNew CYImportDeclaration($specifiers, $module); }
1931 | "import" LexOf ModuleSpecifier[module] Terminator { $$ = CYNew CYImportDeclaration(NULL, $module); }
1935 : ImportedDefaultBinding[default] { $$ = $default; }
1936 | LexOf NameSpaceImport[pass] { $$ = $pass; }
1937 | LexOf NamedImports[pass] { $$ = $pass; }
1938 | ImportedDefaultBinding[default] "," NameSpaceImport[next] { $$ = $default; CYSetLast($$) = $next; }
1939 | ImportedDefaultBinding[default] "," NamedImports[next] { $$ = $default; CYSetLast($$) = $next; }
1942 ImportedDefaultBinding
1943 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(CYNew CYIdentifier("default"), $binding); }
1947 : "*" "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier(NULL, $binding); }
1951 : "{" ImportsListOpt[pass] "}" { $$ = $pass; }
1955 : "from" ModuleSpecifier[pass] { $$ = $pass; }
1959 : "," ImportsListOpt[pass] { $$ = $pass; }
1964 : ImportSpecifier[import] ImportsList_[next] { $$ = $import; CYSetLast($$) = $next; }
1968 : ImportsList[pass] { $$ = $pass; }
1969 | LexOf { $$ = NULL; }
1973 : ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($binding, $binding); }
1974 | LexOf IdentifierName[name] "as" ImportedBinding[binding] { $$ = CYNew CYImportSpecifier($name, $binding); }
1978 : StringLiteral[pass] { $$ = $pass; }
1982 : BindingIdentifier[pass] { $$ = $pass; }
1985 /* 15.2.3 Exports {{{ */
1987 : "*" FromClause Terminator
1988 | ExportClause FromClause Terminator
1989 | ExportClause Terminator
1991 | "default" LexSetStatement LexOf HoistableDeclaration
1992 | "default" LexSetStatement LexOf ClassDeclaration
1993 | "default" LexSetStatement AssignmentExpression Terminator
1997 : "export" LexSetStatement LexLet LexOf ExportDeclaration_
1998 | "export" Declaration
2002 : ";{" ExportsListOpt "}"
2006 : "," ExportsListOpt
2011 : ExportSpecifier ExportsList_
2021 | IdentifierName "as" IdentifierName
2026 /* Cycript (C): Type Encoding {{{ */
2028 : IdentifierType[name] { $$ = CYNew CYTypedName(@name, $name); }
2029 | StringLiteral[name] { $$ = CYNew CYTypedName(@name, $name); }
2030 | NumericLiteral[name] { $$ = CYNew CYTypedName(@name, $name); }
2031 | "(" "*" TypeQualifierRightOpt[typed] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2035 : { $$ = CYNew CYTypedName(@$); }
2039 : TypeSignifier[pass] { $$ = $pass; }
2040 | TypeSignifierNone[pass] { $$ = $pass; }
2044 : TypedParameterListOpt[formal] ")" { $$ = CYNew CYTypeFunctionWith($formal->variadic_, $formal->parameters_); }
2048 : SuffixedTypeOpt[typed] "[" NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
2049 | "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameters[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
2050 | TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2051 | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedName(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2055 : SuffixedType[pass] { $$ = $pass; }
2056 | TypeSignifierOpt[pass] { $$ = $pass; }
2060 : "*" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
2064 : "const" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeConstant(); }
2065 | "volatile" TypeQualifierLeftOpt[modifier] { $$ = $modifier; CYSetLast($$) = CYNew CYTypeVolatile(); }
2068 TypeQualifierLeftOpt
2069 : TypeQualifierLeft[pass] { $$ = $pass; }
2074 : SuffixedType[pass] { $$ = $pass; }
2075 | PrefixedType[pass] { $$ = $pass; }
2076 | "const" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
2077 | "volatile" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
2080 TypeQualifierRightOpt
2081 : TypeQualifierRight[pass] { $$ = $pass; }
2082 | TypeSignifierOpt[pass] { $$ = $pass; }
2086 : "int" { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2087 | "unsigned" IntegerTypeOpt[integral] { $$ = $integral->Unsigned(); if ($$ == NULL) CYERR(@1, "incompatible unsigned"); }
2088 | "signed" IntegerTypeOpt[integral] { $$ = $integral->Signed(); if ($$ == NULL) CYERR(@1, "incompatible signed"); }
2089 | "long" IntegerTypeOpt[integral] { $$ = $integral->Long(); if ($$ == NULL) CYERR(@1, "incompatible long"); }
2090 | "short" IntegerTypeOpt[integral] { $$ = $integral->Short(); if ($$ == NULL) CYERR(@1, "incompatible short"); }
2094 : IntegerType[pass] { $$ = $pass; }
2095 | { $$ = CYNew CYTypeIntegral(CYTypeNeutral); }
2099 : TypedIdentifierField[typed] ";" StructFieldListOpt[next] { $$ = CYNew CYTypeStructField($typed, $typed->name_, $next); }
2104 : NumericLiteral[pass] { $$ = $pass; }
2105 | "-" NumericLiteral[positive] { $$ = $positive; $$->value_ = -$$->value_; }
2108 EnumConstantListOpt_
2109 : "," EnumConstantListOpt[pass] { $$ = $pass; }
2114 : IdentifierType[name] "=" IntegerNumber[value] EnumConstantListOpt_[next] { $$ = CYNew CYEnumConstant($name, $value, $next); }
2119 : { $$ = CYTypeNeutral; }
2120 | "signed" { $$ = CYTypeSigned; }
2121 | "unsigned" { $$ = CYTypeUnsigned; }
2125 : IdentifierType[name] { $$ = CYNew CYTypeVariable($name); }
2126 | IntegerType[pass] { $$ = $pass; }
2127 | TypeSigning[signing] "char" { $$ = CYNew CYTypeCharacter($signing); }
2128 | TypeSigning[signing] "__int128" { $$ = CYNew CYTypeInt128($signing); }
2129 | "float" { $$ = CYNew CYTypeFloating(0); }
2130 | "double" { $$ = CYNew CYTypeFloating(1); }
2131 | "long" "double" { $$ = CYNew CYTypeFloating(2); }
2135 : PrimitiveType[pass] { $$ = $pass; }
2136 | "struct" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); }
2137 | "enum" IdentifierType[name] { $$ = CYNew CYTypeReference(CYTypeReferenceEnum, $name); }
2138 | "struct" AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2139 | "enum" AutoComplete { driver.mode_ = CYDriver::AutoEnum; YYACCEPT; }
2142 TypedIdentifierMaybe
2143 : TypeQualifierLeft[modifier] "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2144 | "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2145 | TypeQualifierLeftOpt[modifier] PrimitiveReference[specifier] TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = $specifier; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2149 : TypedIdentifierMaybe[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2153 : TypedIdentifierMaybe[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2156 TypedIdentifierTagged
2157 : TypeQualifierLeftOpt[modifier] "struct" "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeStruct(NULL, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2158 | TypeQualifierLeftOpt[modifier] "enum" ":" PrimitiveType[specifier] "{" EnumConstantListOpt[constants] "}" TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeEnum(NULL, $specifier, $constants); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
2161 TypedIdentifierField
2162 : TypedIdentifierYes[pass] { $$ = $pass; }
2163 | TypedIdentifierTagged[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
2166 TypedIdentifierEncoding
2167 : TypedIdentifierNo[pass] { $$ = $pass; }
2168 | TypedIdentifierTagged[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
2169 | "void" TypeSignifierNone[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2172 TypedIdentifierDefinition
2173 : TypedIdentifierYes[pass] { $$ = $pass; }
2174 | 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; }
2175 | "void" TypeSignifier[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
2179 : "@encode" "(" TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYEncodedType($typed); }
2185 /* Cycript (Objective-C): @class Declaration {{{ */
2187 /* XXX: why the hell did I choose MemberExpression? */
2188 : ":" MemberExpression[extends] { $$ = $extends; }
2192 ImplementationFieldListOpt
2193 : TypedIdentifierField[typed] ";" ImplementationFieldListOpt[next] { $$ = CYNew CYImplementationField($typed, $typed->name_, $next); }
2198 : "+" { $$ = false; }
2199 | "-" { $$ = true; }
2203 : "(" TypedIdentifierNo[type] ")" { $$ = $type; }
2204 | { $$ = CYNew CYType(CYNew CYTypeVariable("id")); }
2208 : Word[tag] ":" TypeOpt[type] BindingIdentifier[identifier] { $$ = CYNew CYMessageParameter($tag, $type, $identifier); }
2211 MessageParameterList
2212 : MessageParameter[parameter] MessageParameterListOpt[next] { $parameter->SetNext($next); $$ = $parameter; }
2215 MessageParameterListOpt
2216 : MessageParameterList[pass] { $$ = $pass; }
2217 | TypedParameterList_[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); /*XXX*/ if ($formal->parameters_ != NULL) CYERR(@$, "temporarily unsupported"); $$ = NULL; }
2221 : MessageParameterList[pass] { $$ = $pass; }
2222 | Word[tag] { $$ = CYNew CYMessageParameter($tag); }
2225 ClassMessageDeclaration
2226 : MessageScope[instance] TypeOpt[type] MessageParameters[parameters] "{" LexPushSuperOn FunctionBody[code] "}" LexPopSuper { $$ = CYNew CYMessage($instance, $type, $parameters, $code); }
2229 ClassMessageDeclarationListOpt
2230 : ClassMessageDeclarationListOpt[next] ClassMessageDeclaration[message] { $message->SetNext($next); $$ = $message; }
2234 // XXX: this should be AssignmentExpressionNoRight
2236 : ShiftExpression[name] ClassProtocolsOpt[next] { $$ = CYNew CYProtocol($name, $next); }
2240 : "," ClassProtocols[protocols] { $$ = $protocols; }
2244 ClassProtocolListOpt
2245 : "<" ClassProtocols[protocols] ">" { $$ = $protocols; }
2249 ImplementationStatement
2250 : "@implementation" Identifier[name] ClassSuperOpt[extends] ClassProtocolListOpt[protocols] "{" ImplementationFieldListOpt[fields] "}" ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYImplementation($name, $extends, $protocols, $fields, $messages); }
2258 : "@implementation" Identifier[name] CategoryName ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYCategory($name, $messages); }
2262 : ImplementationStatement[pass] { $$ = $pass; }
2263 | CategoryStatement[pass] { $$ = $pass; }
2266 /* Cycript (Objective-C): Send Message {{{ */
2268 : "," AssignmentExpressionClassic[value] VariadicCall[next] { $$ = CYNew CYArgument(NULL, $value, $next); }
2273 : WordOpt[name] { driver.contexts_.back().words_.push_back($name); } { $$ = $name; }
2274 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
2278 : SelectorCall[pass] { $$ = $pass; }
2279 | VariadicCall[pass] { $$ = $pass; }
2283 : SelectorWordOpt[name] ":" AssignmentExpressionClassic[value] SelectorCall_[next] { $$ = CYNew CYArgument($name ?: CYNew CYWord(""), $value, $next); }
2287 : SelectorCall[pass] { $$ = $pass; }
2288 | Word[name] { $$ = CYNew CYArgument($name, NULL); }
2292 : "[" AssignmentExpressionClassic[self] { driver.contexts_.push_back($self); } SelectorList[arguments] "]" { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($self, $arguments); }
2293 | "[" LexOf "super" { driver.context_ = NULL; } SelectorList[arguments] "]" { $$ = CYNew CYSendSuper($arguments); }
2297 : WordOpt[name] ":" SelectorExpressionOpt[next] { $$ = CYNew CYSelectorPart($name, true, $next); }
2301 : SelectorExpression_[pass] { $$ = $pass; }
2302 | Word[name] { $$ = CYNew CYSelectorPart($name, false, NULL); }
2305 SelectorExpressionOpt
2306 : SelectorExpression_[pass] { $$ = $pass; }
2311 : MessageExpression[pass] { $$ = $pass; }
2312 | "@selector" "(" SelectorExpression[parts] ")" { $$ = CYNew CYSelector($parts); }
2317 /* Cycript: @import Directive {{{ */
2319 : ModulePath[next] "." Word[part] { $$ = CYNew CYModule($part, $next); }
2320 | Word[part] { $$ = CYNew CYModule($part); }
2324 : "@import" ModulePath[path] { $$ = CYNew CYImport($path); }
2329 /* Cycript (Objective-C): Boxed Expressions {{{ */
2331 : NullLiteral[pass] { $$ = $pass; }
2332 | BooleanLiteral[pass] { $$ = $pass; }
2333 | NumericLiteral[pass] { $$ = $pass; }
2334 | StringLiteral[pass] { $$ = $pass; }
2335 | CoverParenthesizedExpressionAndArrowParameterList[pass] { $$ = $pass; }
2336 | "YES" { $$ = CYNew CYTrue(); }
2337 | "NO" { $$ = CYNew CYFalse(); }
2341 : "," KeyValuePairListOpt[next] { $$ = $next; }
2345 : AssignmentExpression[key] ":" AssignmentExpression[value] KeyValuePairList_[next] { $$ = CYNew CYObjCKeyValue($key, $value, $next); }
2349 : KeyValuePairList[pass] { $$ = $pass; }
2350 | LexOf { $$ = NULL; }
2354 : "@" BoxableExpression[expression] { $$ = CYNew CYBox($expression); }
2355 | "@" "[" ElementListOpt[elements] "]" { $$ = CYNew CYObjCArray($elements); }
2356 | "@" "{" KeyValuePairListOpt[pairs] "}" { $$ = CYNew CYObjCDictionary($pairs); }
2358 | "@YES" { $$ = CYNew CYBox(CYNew CYTrue()); }
2359 | "@NO" { $$ = CYNew CYBox(CYNew CYFalse()); }
2360 | "@true" { $$ = CYNew CYBox(CYNew CYTrue()); }
2361 | "@false" { $$ = CYNew CYBox(CYNew CYFalse()); }
2362 | "@null" { $$ = CYNew CYBox(CYNew CYNull()); }
2365 /* Cycript (Objective-C): Block Expressions {{{ */
2367 : "^" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { if (CYTypeFunctionWith *function = $type->Function()) $$ = CYNew CYObjCBlock($type, function->parameters_, $code); else CYERR($type->location_, "expected parameters"); }
2370 /* Cycript (Objective-C): Instance Literals {{{ */
2372 : "#" NumericLiteral[address] { $$ = CYNew CYInstanceLiteral($address); }
2378 /* Cycript (C): Pointer Indirection/Addressing {{{ */
2380 : IndirectExpression[pass] { $$ = $pass; }
2384 : "*" UnaryExpression[rhs] { $$ = CYNew CYIndirect($rhs); }
2388 : "&" UnaryExpression[rhs] { $$ = CYNew CYAddressOf($rhs); }
2392 : "->" "[" Expression[property] "]" { $$ = CYNew CYIndirectMember(NULL, $property); }
2393 | "->" IdentifierName[property] { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($property)); }
2394 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
2397 /* Cycript (C): Lambda Expressions {{{ */
2399 : "," TypedParameterList[parameters] { $$ = $parameters; }
2400 | { $$ = CYNew CYTypedFormal(false); }
2404 : 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_); }
2405 | "..." { $$ = CYNew CYTypedFormal(true); }
2408 TypedParameterListOpt
2409 : TypedParameterList[pass] { $$ = $pass; }
2410 | "void" { $$ = CYNew CYTypedFormal(false); }
2411 | { $$ = CYNew CYTypedFormal(false); }
2415 : TypedParameterListOpt[formal] { if ($formal->variadic_) CYERR(@$, "unsupported variadic"); $$ = $formal->parameters_; }
2419 : "[" LexOf "&" "]" "(" TypedParameters[parameters] ")" "->" TypedIdentifierNo[type] "{" FunctionBody[code] "}" { $$ = CYNew CYLambda($type, $parameters, $code); }
2422 /* Cycript (C): Structure Definitions {{{ */
2424 : "struct" NewLineOpt { $$ = CYNew CYIdentifier("struct"); }
2428 : "struct" NewLineNot IdentifierType[name] "{" StructFieldListOpt[fields] "}" { $$ = CYNew CYStructDefinition($name, CYNew CYStructTail($fields)); }
2432 : "(" LexOf "struct" NewLineOpt IdentifierType[name] TypeQualifierRightOpt[typed] ")" { $typed->specifier_ = CYNew CYTypeReference(CYTypeReferenceStruct, $name); $$ = CYNew CYTypeExpression($typed); }
2433 | "(" LexOf "struct" NewLineOpt AutoComplete { driver.mode_ = CYDriver::AutoStruct; YYACCEPT; }
2436 /* Cycript (C): Type Definitions {{{ */
2438 : "typedef" NewLineOpt { $$ = CYNew CYIdentifier("typedef"); }
2442 : "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); }
2446 : TypeDefinition[pass] { $$ = $pass; }
2450 : "(" LexOf "typedef" NewLineOpt TypedIdentifierEncoding[typed] ")" { $$ = CYNew CYTypeExpression($typed); }
2453 /* Cycript (C): extern "C" {{{ */
2455 : "extern" NewLineOpt { $$ = CYNew CYIdentifier("extern"); }
2459 : 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); }
2460 | TypeDefinition[pass] { $$ = $pass; }
2463 ExternCStatementListOpt
2464 : ExternCStatement[statement] ExternCStatementListOpt[next] { $$ = $statement; CYSetLast($$) = $next; }
2469 : "{" ExternCStatementListOpt[pass] "}" { $$ = $pass; }
2470 | ExternCStatement[pass] { $$ = $pass; }
2474 : StringLiteral[abi] { if (strcmp($abi->Value(), "C") != 0) CYERR(@abi, "unknown extern binding"); }
2478 : "extern" NewLineNot ABI[abi] ExternC[pass] { $$ = $pass; }
2482 : "(" LexOf "extern" NewLineOpt ABI[abi] TypedIdentifierField[typed] ")" { $$ = CYNew CYExternalExpression(CYNew CYString("C"), $typed, $typed->name_); }
2488 /* Lexer State {{{ */
2490 : { driver.PushCondition(CYDriver::RegExpCondition); }
2494 : { driver.PushCondition(CYDriver::XMLContentCondition); }
2498 : { driver.PushCondition(CYDriver::XMLTagCondition); }
2502 : { driver.PopCondition(); }
2506 : { driver.SetCondition(CYDriver::XMLContentCondition); }
2510 : { driver.SetCondition(CYDriver::XMLTagCondition); }
2513 /* Virtual Tokens {{{ */
2520 /* 8.1 Context Keywords {{{ */
2522 : "namespace" { $$ = CYNew CYIdentifier("namespace"); }
2523 | "xml" { $$ = CYNew CYIdentifier("xml"); }
2526 /* 8.3 XML Initializer Input Elements {{{ */
2528 : XMLComment { $$ = $1; }
2529 | XMLCDATA { $$ = $1; }
2530 | XMLPI { $$ = $1; }
2534 /* 11.1 Primary Expressions {{{ */
2536 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
2537 | XMLInitilizer { $$ = $1; }
2538 | XMLListInitilizer { $$ = $1; }
2542 : AttributeIdentifier { $$ = $1; }
2543 | QualifiedIdentifier { $$ = $1; }
2544 | WildcardIdentifier { $$ = $1; }
2547 /* 11.1.1 Attribute Identifiers {{{ */
2549 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
2553 : PropertySelector { $$ = $1; }
2554 | "[" Expression "]" { $$ = CYNew CYSelector($2); }
2558 : Identifier { $$ = CYNew CYSelector($1); }
2559 | WildcardIdentifier { $$ = $1; }
2562 /* 11.1.2 Qualified Identifiers {{{ */
2563 QualifiedIdentifier_
2564 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
2565 | QualifiedIdentifier { $$ = $1; }
2569 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
2572 /* 11.1.3 Wildcard Identifiers {{{ */
2574 : "*" { $$ = CYNew CYWildcard(); }
2577 /* 11.1.4 XML Initializer {{{ */
2579 : XMLMarkup { $$ = $1; }
2580 | XMLElement { $$ = $1; }
2584 : "<" LexPushInOff XMLTagContent LexPop "/>" LexPopIn
2585 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop ">" LexPopIn
2589 : LexPushXMLTag XMLTagName XMLAttributes
2593 : "{" LexPushRegExp Expression LexPop "}"
2602 : XMLAttributes_ XMLAttribute
2607 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
2608 | XMLAttributes_ XMLWhitespaceOpt
2617 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
2621 : XMLExpression XMLElementContentOpt
2622 | XMLMarkup XMLElementContentOpt
2623 | XMLText XMLElementContentOpt
2624 | XMLElement XMLElementContentOpt
2627 XMLElementContentOpt
2632 /* 11.1.5 XMLList Initializer {{{ */
2634 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop "</>" LexPopIn { $$ = CYNew CYXMLList($4); }
2638 /* 11.2 Left-Hand-Side Expressions {{{ */
2640 : Identifier { $$ = $1; }
2641 | PropertyIdentifier { $$ = $1; }
2645 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
2646 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
2647 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
2650 /* 12.1 The default xml namespace Statement {{{ */
2651 /* XXX: DefaultXMLNamespaceStatement
2652 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
2656 : DefaultXMLNamespaceStatement { $$ = $1; }
2661 /* JavaScript FTL: Array Comprehensions {{{ */
2663 : AssignmentExpression[expression] ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2667 : "for" "each" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2670 /* JavaScript FTL: for each {{{ */
2672 : "for" "each" "(" LexPushInOn ForInStatementInitializer[initializer] "!in" LexPopIn Expression[iterable] ")" Statement[code] { $$ = CYNew CYForOf($initializer, $iterable, $code); }
2676 /* JavaScript FTW: Array Comprehensions {{{ */
2678 : ArrayComprehension
2682 : "[" Comprehension[comprehension] "]" { $$ = $comprehension; }
2686 : LexOf ComprehensionFor[comprehension] ComprehensionTail[next] AssignmentExpression[expression] { $comprehension->SetNext($next); $$ = CYNew CYArrayComprehension($expression, $comprehension); }
2691 | ComprehensionFor[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2692 | ComprehensionIf[comprehension] ComprehensionTail[next] { $comprehension->SetNext($next); $$ = $comprehension; }
2696 : "for" "(" LexPushInOn LexBind ForBinding[binding] "!in" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForInComprehension($binding, $iterable); }
2697 | "for" "(" LexPushInOn LexBind ForBinding[binding] "of" LexPopIn Expression[iterable] ")" { $$ = CYNew CYForOfComprehension($binding, $iterable); }
2701 : "if" "(" AssignmentExpression[test] ")" { $$ = CYNew CYIfComprehension($test); }
2704 /* JavaScript FTW: Named Arguments {{{ */
2706 : LexOf WordNoUnary[tag] ":" AssignmentExpression[value] ArgumentList_[next] { $$ = CYNew CYArgument($tag, $value, $next); }
2709 /* JavaScript FTW: Subscript Access {{{ */
2711 : "." "[" AssignmentExpression[property] "]" { $$ = CYNew CYSubscriptMember(NULL, $property); }
2715 /* JavaScript FTW: Java "Anonymous Inner Classes" {{{ */
2717 : "{" PropertyDefinitionListOpt[properties] "}" { $$ = CYNew CYExtend(NULL, $properties); }
2721 /* JavaScript FTW: Ruby Blocks {{{ */
2722 RubyProcParameterList_
2723 : "," RubyProcParameterList[parameters] { $$ = $parameters; }
2727 RubyProcParameterList
2728 : BindingIdentifier[identifier] RubyProcParameterList_[next] { $$ = CYNew CYFunctionParameter(CYNew CYBinding($identifier), $next); }
2729 | LexOf { $$ = NULL; }
2733 : "|" RubyProcParameterList[parameters] "|" { $$ = $parameters; }
2734 | "||" { $$ = NULL; }
2737 RubyProcParametersOpt
2738 : RubyProcParameters[pass] { $$ = $pass; }
2743 : ";{" RubyProcParametersOpt[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyBlock(NULL, CYNew CYRubyProc($parameters, $code)); }
2747 : "{" RubyProcParameters[parameters] StatementListOpt[code] "}" { $$ = CYNew CYRubyProc($parameters, $code); }
2751 : AccessExpression[pass] LexNewLineOrOpt { $$ = $pass; }
2752 | BracedExpression_[lhs] { if (!$lhs->IsNew()) CYMAP(OpenBrace_, OpenBrace); } BracedParameter[rhs] LexNewLineOrOpt { $rhs->SetLeft($lhs); $$ = $rhs; }
2756 : BracedExpression_[pass] "\n" { $$ = $pass; }
2757 | BracedExpression_[pass] { $$ = $pass; }
2760 /* JavaScript FTW: Ruby Scopes {{{ */
2762 : "::" "[" Expression[property] "]" { $$ = CYNew CYResolveMember(NULL, $property); }
2763 | "::" IdentifierName[property] { $$ = CYNew CYResolveMember(NULL, CYNew CYString($property)); }
2764 | "::" AutoComplete { driver.mode_ = CYDriver::AutoResolve; YYACCEPT; }
2767 /* JavaScript FTW: Ruby Symbols {{{ */
2769 : ":" Word[name] { $$ = CYNew CYSymbol($name->Word()); }
2775 bool CYDriver::Parse(CYMark mark) {
2777 CYLocal<CYPool> local(&pool_);
2778 cy::parser parser(*this);
2780 parser.set_debug_level(debug_);
2782 return parser.parse() != 0;
2785 void CYDriver::Warning(const cy::parser::location_type &location, const char *message) {
2789 CYDriver::Error error;
2790 error.warning_ = true;
2791 error.location_ = location;
2792 error.message_ = message;
2793 errors_.push_back(error);
2796 void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
2797 CYDriver::Error error;
2798 error.warning_ = false;
2799 error.location_ = location;
2800 error.message_ = message;
2801 driver.errors_.push_back(error);