1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2015 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
30 #define CYNew new(driver.pool_)
33 #include "ObjectiveC/Syntax.hpp"
37 #include "E4X/Syntax.hpp"
40 #include "Highlight.hpp"
43 %union { bool bool_; }
45 %union { CYMember *access_; }
46 %union { CYArgument *argument_; }
47 %union { CYAssignment *assignment_; }
48 %union { CYBoolean *boolean_; }
49 %union { CYClause *clause_; }
50 %union { cy::Syntax::Catch *catch_; }
51 %union { CYClassTail *classTail_; }
52 %union { CYComprehension *comprehension_; }
53 %union { CYDeclaration *declaration_; }
54 %union { CYDeclarations *declarations_; }
55 %union { CYElement *element_; }
56 %union { CYExpression *expression_; }
57 %union { CYFalse *false_; }
58 %union { CYVariable *variable_; }
59 %union { CYFinally *finally_; }
60 %union { CYForInitializer *for_; }
61 %union { CYForInInitializer *forin_; }
62 %union { CYFunctionParameter *functionParameter_; }
63 %union { CYIdentifier *identifier_; }
64 %union { CYInfix *infix_; }
65 %union { CYLiteral *literal_; }
66 %union { CYMethod *method_; }
67 %union { CYModule *module_; }
68 %union { CYNull *null_; }
69 %union { CYNumber *number_; }
70 %union { CYParenthetical *parenthetical_; }
71 %union { CYProperty *property_; }
72 %union { CYPropertyName *propertyName_; }
73 %union { CYRubyProc *rubyProc_; }
74 %union { CYSpan *span_; }
75 %union { CYStatement *statement_; }
76 %union { CYString *string_; }
77 %union { CYTarget *target_; }
78 %union { CYThis *this_; }
79 %union { CYTrue *true_; }
80 %union { CYWord *word_; }
83 %union { CYTypeModifier *modifier_; }
84 %union { CYTypeSpecifier *specifier_; }
85 %union { CYTypedIdentifier *typedIdentifier_; }
86 %union { CYTypedParameter *typedParameter_; }
90 %union { CYMessage *message_; }
91 %union { CYMessageParameter *messageParameter_; }
92 %union { CYImplementationField *implementationField_; }
93 %union { CYProtocol *protocol_; }
94 %union { CYSelectorPart *selector_; }
98 %union { CYAttribute *attribute_; }
99 %union { CYPropertyIdentifier *propertyIdentifier_; }
100 %union { CYSelector *selector_; }
106 cy::parser::semantic_type semantic_;
107 hi::Value highlight_;
110 int cylex(YYSTYPE *, CYLocation *, void *);
117 _finline int yylex(cy::parser::semantic_type *semantic, CYLocation *location, CYDriver &driver) {
118 if (driver.mark_ == CYMarkIgnore);
119 else if (driver.mark_ == CYMarkScript) {
120 driver.mark_ = CYMarkIgnore;
121 return cy::parser::token::MarkScript;
122 } else if (driver.mark_ == CYMarkModule) {
123 driver.mark_ = CYMarkIgnore;
124 return cy::parser::token::MarkModule;
128 int token(cylex(&data, location, driver.scanner_));
129 *semantic = data.semantic_;
133 #define CYLEX() do if (yyla.empty()) { \
134 YYCDEBUG << "Mapping a token: "; \
135 yyla.type = yytranslate_(yylex(&yyla.value, &yyla.location, driver)); \
136 YY_SYMBOL_PRINT("Next token is", yyla); \
139 #define CYMAP(to, from) do { \
141 if (yyla.type == yytranslate_(token::from)) \
142 yyla.type = yytranslate_(token::to); \
145 #define CYERR(location, message) do { \
146 error(location, message); \
150 #define CYNOT(location) \
151 CYERR(location, "unimplemented feature")
160 @$.begin.filename = @$.end.filename = &driver.filename_;
166 %define api.location.type { CYLocation }
173 %param { CYDriver &driver }
175 /* Token Declarations {{{ */
181 %token XMLAttributeValue
183 %token XMLTagCharacters
189 %token LeftRight "<>"
190 %token LeftSlashRight "</>"
192 %token SlashRight "/>"
193 %token LeftSlash "</"
195 %token ColonColon "::"
196 %token PeriodPeriod ".."
199 @begin E4X ObjectiveC
205 %token AmpersandAmpersand "&&"
206 %token AmpersandEqual "&="
208 %token CarrotEqual "^="
210 %token EqualEqual "=="
211 %token EqualEqualEqual "==="
212 %token EqualRight "=>"
213 %token EqualRight_ "\n=>"
214 %token Exclamation "!"
215 %token ExclamationEqual "!="
216 %token ExclamationEqualEqual "!=="
218 %token HyphenEqual "-="
219 %token HyphenHyphen "--"
220 %token HyphenHyphen_ "\n--"
221 %token HyphenRight "->"
223 %token LeftEqual "<="
225 %token LeftLeftEqual "<<="
227 %token PercentEqual "%="
229 %token PeriodPeriodPeriod "..."
231 %token PipeEqual "|="
234 %token PlusEqual "+="
236 %token PlusPlus_ "\n++"
238 %token RightEqual ">="
239 %token RightRight ">>"
240 %token RightRightEqual ">>="
241 %token RightRightRight ">>>"
242 %token RightRightRightEqual ">>>="
244 %token SlashEqual "/="
246 %token StarEqual "*="
258 %token CloseParen ")"
261 %token OpenBrace_ "\n{"
262 %token OpenBrace__ ";{"
263 %token CloseBrace "}"
265 %token OpenBracket "["
266 %token CloseBracket "]"
268 %token At_error_ "@error"
271 %token At_class_ "@class"
275 %token _typedef_ "typedef"
276 %token _unsigned_ "unsigned"
277 %token _signed_ "signed"
278 %token _extern_ "extern"
282 %token At_encode_ "@encode"
286 %token At_implementation_ "@implementation"
287 %token At_import_ "@import"
288 %token At_end_ "@end"
289 %token At_selector_ "@selector"
290 %token At_null_ "@null"
291 %token At_YES_ "@YES"
293 %token At_true_ "@true"
294 %token At_false_ "@false"
299 %token _false_ "false"
303 %token _break_ "break"
305 %token _catch_ "catch"
306 %token _class_ "class"
307 %token _class__ ";class"
308 %token _const_ "const"
309 %token _continue_ "continue"
310 %token _debugger_ "debugger"
311 %token _default_ "default"
312 %token _delete_ "delete"
316 %token _export_ "export"
317 %token _extends_ "extends"
318 %token _finally_ "finally"
320 %token _function_ "function"
321 %token _function__ ";function"
323 %token _import_ "import"
326 %token _instanceof_ "instanceof"
328 %token _return_ "return"
329 %token _return__ "!return"
330 %token _super_ "super"
331 %token _super__ "!super"
332 %token _switch_ "switch"
334 %token _throw_ "throw"
336 %token _typeof_ "typeof"
339 %token _while_ "while"
342 %token _abstract_ "abstract"
343 %token _await_ "await"
344 %token _boolean_ "boolean"
347 %token _constructor_ "constructor"
348 %token _double_ "double"
350 %token _final_ "final"
351 %token _float_ "float"
355 %token _implements_ "implements"
357 %token _interface_ "interface"
360 %token _native_ "native"
361 %token _package_ "package"
362 %token _private_ "private"
363 %token _protected_ "protected"
364 %token _prototype_ "prototype"
365 %token _public_ "public"
367 %token _short_ "short"
368 %token _static_ "static"
369 %token _synchronized_ "synchronized"
370 %token _throws_ "throws"
371 %token _transient_ "transient"
372 %token _volatile_ "volatile"
373 %token _yield_ "yield"
374 %token _yield__ "!yield"
376 %token _undefined_ "undefined"
392 %token _namespace_ "namespace"
399 %token <identifier_> Identifier_
400 %token <number_> NumericLiteral
401 %token <string_> StringLiteral
402 %token <literal_> RegularExpressionLiteral
404 %token <string_> NoSubstitutionTemplate
405 %token <string_> TemplateHead
406 %token <string_> TemplateMiddle
407 %token <string_> TemplateTail
409 %type <expression_> AdditiveExpression
410 %type <argument_> ArgumentList_
411 %type <argument_> ArgumentList
412 %type <argument_> ArgumentListOpt
413 %type <argument_> Arguments
414 %type <target_> ArrayComprehension
415 %type <literal_> ArrayLiteral
416 %type <expression_> ArrowFunction
417 %type <functionParameter_> ArrowParameters
418 %type <expression_> AssignmentExpression
419 %type <expression_> AssignmentExpressionOpt
420 %type <identifier_> BindingIdentifier
421 %type <identifier_> BindingIdentifierOpt
422 %type <declarations_> BindingList_
423 %type <declarations_> BindingList
424 %type <expression_> BitwiseANDExpression
425 %type <statement_> Block
426 %type <statement_> BlockStatement
427 %type <boolean_> BooleanLiteral
428 %type <declaration_> BindingElement
429 %type <expression_> BitwiseORExpression
430 %type <expression_> BitwiseXORExpression
431 %type <statement_> BreakStatement
432 %type <statement_> BreakableStatement
433 %type <expression_> CallExpression_
434 %type <target_> CallExpression
435 %type <clause_> CaseBlock
436 %type <clause_> CaseClause
437 %type <clause_> CaseClausesOpt
439 %type <identifier_> CatchParameter
440 %type <statement_> ClassDeclaration
441 %type <target_> ClassExpression
442 %type <classTail_> ClassHeritage
443 %type <classTail_> ClassHeritageOpt
444 %type <classTail_> ClassTail
445 %type <target_> Comprehension
446 %type <comprehension_> ComprehensionFor
447 %type <comprehension_> ComprehensionIf
448 %type <comprehension_> ComprehensionTail
449 %type <propertyName_> ComputedPropertyName
450 %type <expression_> ConditionalExpression
451 %type <statement_> ContinueStatement
452 %type <statement_> ConciseBody
453 %type <parenthetical_> CoverParenthesizedExpressionAndArrowParameterList
454 %type <statement_> DebuggerStatement
455 %type <statement_> Declaration__
456 %type <statement_> Declaration_
457 %type <statement_> Declaration
458 %type <clause_> DefaultClause
459 %type <element_> ElementList
460 %type <element_> ElementListOpt
461 %type <statement_> ElseStatementOpt
462 %type <statement_> EmptyStatement
463 %type <expression_> EqualityExpression
464 %type <expression_> Expression
465 %type <expression_> ExpressionOpt
466 %type <statement_> ExpressionStatement
467 %type <finally_> Finally
468 %type <declaration_> ForBinding
469 %type <forin_> ForDeclaration
470 %type <forin_> ForInStatementInitializer
471 %type <for_> ForStatementInitializer
472 %type <declaration_> FormalParameter
473 %type <functionParameter_> FormalParameterList_
474 %type <functionParameter_> FormalParameterList
475 %type <functionParameter_> FormalParameters
476 %type <statement_> FunctionBody
477 %type <statement_> FunctionDeclaration
478 %type <target_> FunctionExpression
479 %type <statement_> FunctionStatementList
480 %type <statement_> GeneratorBody
481 %type <statement_> GeneratorDeclaration
482 %type <target_> GeneratorExpression
483 %type <method_> GeneratorMethod
484 %type <statement_> HoistableDeclaration
485 %type <identifier_> Identifier
486 %type <identifier_> IdentifierType
487 %type <word_> IdentifierName
488 %type <variable_> IdentifierReference
489 %type <statement_> IfStatement
490 %type <expression_> Initializer
491 %type <expression_> InitializerOpt
492 %type <statement_> IterationStatement
493 %type <identifier_> LabelIdentifier
494 %type <statement_> LabelledItem
495 %type <statement_> LabelledStatement
496 %type <target_> LeftHandSideExpression
497 %type <bool_> LetOrConst
498 %type <declaration_> LexicalBinding
499 %type <statement_> LexicalDeclaration
500 %type <literal_> Literal
501 %type <propertyName_> LiteralPropertyName
502 %type <expression_> LogicalANDExpression
503 %type <expression_> LogicalORExpression
504 %type <access_> MemberAccess
505 %type <target_> MemberExpression
506 %type <method_> MethodDefinition
507 %type <module_> ModulePath
508 %type <expression_> MultiplicativeExpression
509 %type <target_> NewExpression
510 %type <null_> NullLiteral
511 %type <literal_> ObjectLiteral
512 %type <expression_> PostfixExpression
513 %type <target_> PrimaryExpression
514 %type <propertyName_> PropertyName
515 %type <property_> PropertyDefinition
516 %type <property_> PropertyDefinitionList_
517 %type <property_> PropertyDefinitionList
518 %type <property_> PropertyDefinitionListOpt
519 %type <declaration_> PropertySetParameterList
520 %type <expression_> RelationalExpression
521 %type <statement_> ReturnStatement
522 %type <rubyProc_> RubyProcExpression
523 %type <functionParameter_> RubyProcParameterList_
524 %type <functionParameter_> RubyProcParameterList
525 %type <functionParameter_> RubyProcParameters
526 %type <functionParameter_> RubyProcParametersOpt
527 %type <statement_> Script
528 %type <statement_> ScriptBody
529 %type <statement_> ScriptBodyOpt
530 %type <expression_> ShiftExpression
531 %type <declaration_> SingleNameBinding
532 %type <statement_> Statement__
533 %type <statement_> Statement_
534 %type <statement_> Statement
535 %type <statement_> StatementList
536 %type <statement_> StatementListOpt
537 %type <statement_> StatementListItem
538 %type <functionParameter_> StrictFormalParameters
539 %type <target_> SuperCall
540 %type <target_> SuperProperty
541 %type <statement_> SwitchStatement
542 %type <target_> TemplateLiteral
543 %type <span_> TemplateSpans
544 %type <statement_> ThrowStatement
545 %type <statement_> TryStatement
546 %type <expression_> UnaryExpression_
547 %type <expression_> UnaryExpression
548 %type <declaration_> VariableDeclaration
549 %type <declarations_> VariableDeclarationList_
550 %type <declarations_> VariableDeclarationList
551 %type <statement_> VariableStatement
552 %type <statement_> WithStatement
555 %type <word_> WordOpt
557 %type <expression_> YieldExpression
560 %type <specifier_> IntegerType
561 %type <specifier_> IntegerTypeOpt
562 %type <typedIdentifier_> PrefixedType
563 %type <specifier_> PrimitiveType
564 %type <typedIdentifier_> SuffixedType
565 %type <typedIdentifier_> TypeSignifier
566 %type <modifier_> TypeQualifierLeft
567 %type <typedIdentifier_> TypeQualifierRight
568 %type <typedIdentifier_> TypedIdentifier
569 %type <typedParameter_> TypedParameterList_
570 %type <typedParameter_> TypedParameterList
571 %type <typedParameter_> TypedParameterListOpt
575 %type <expression_> BoxableExpression
576 %type <statement_> CategoryStatement
577 %type <expression_> ClassSuperOpt
578 %type <implementationField_> ImplementationFieldListOpt
579 %type <implementationField_> ImplementationFields
580 %type <message_> ClassMessageDeclaration
581 %type <message_> ClassMessageDeclarationListOpt
582 %type <protocol_> ClassProtocolListOpt
583 %type <protocol_> ClassProtocols
584 %type <protocol_> ClassProtocolsOpt
585 %type <statement_> ImplementationStatement
586 %type <target_> MessageExpression
587 %type <messageParameter_> MessageParameter
588 %type <messageParameter_> MessageParameters
589 %type <messageParameter_> MessageParameterList
590 %type <messageParameter_> MessageParameterListOpt
591 %type <bool_> MessageScope
592 %type <argument_> SelectorCall_
593 %type <argument_> SelectorCall
594 %type <selector_> SelectorExpression_
595 %type <selector_> SelectorExpression
596 %type <selector_> SelectorExpressionOpt
597 %type <argument_> SelectorList
598 %type <word_> SelectorWordOpt
599 %type <typedIdentifier_> TypeOpt
600 %type <argument_> VariadicCall
604 %type <propertyIdentifier_> PropertyIdentifier_
605 %type <selector_> PropertySelector_
606 %type <selector_> PropertySelector
607 %type <identifier_> QualifiedIdentifier_
608 %type <identifier_> QualifiedIdentifier
609 %type <identifier_> WildcardIdentifier
610 %type <identifier_> XMLComment
611 %type <identifier_> XMLCDATA
612 %type <identifier_> XMLElement
613 %type <identifier_> XMLElementContent
614 %type <identifier_> XMLMarkup
615 %type <identifier_> XMLPI
617 %type <attribute_> AttributeIdentifier
618 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
619 %type <expression_> PropertyIdentifier
620 %type <expression_> XMLListInitialiser
621 %type <expression_> XMLInitialiser
624 /* Token Priorities {{{ */
643 /* Lexer State {{{ */
644 LexPushInOn: { driver.in_.push(true); };
645 LexPushInOff: { driver.in_.push(false); };
646 LexPopIn: { driver.in_.pop(); };
648 LexPushReturnOn: { driver.return_.push(true); };
649 LexPopReturn: { driver.return_.pop(); };
651 LexPushSuperOn: { driver.super_.push(true); };
652 LexPushSuperOff: { driver.super_.push(false); };
653 LexPopSuper: { driver.super_.pop(); };
655 LexPushYieldOn: { driver.yield_.push(true); };
656 LexPushYieldOff: { driver.yield_.push(false); };
657 LexPopYield: { driver.yield_.pop(); };
660 : { CYLEX(); if (yyla.type == yytranslate_(token::Slash)) { yyla.clear(); driver.SetRegEx(false); } else if (yyla.type == yytranslate_(token::SlashEqual)) { yyla.clear(); driver.SetRegEx(true); } }
664 : { if (!yyla.empty() && yyla.type_get() != yyeof_) CYERR(@$, "unexpected lookahead"); driver.next_ = true; }
668 : { CYMAP(YieldStar, Star); }
672 : { CYMAP(OpenBrace__, OpenBrace); CYMAP(OpenBrace__, OpenBrace_); }
676 : { CYMAP(_class__, _class_); }
680 : { CYMAP(_function__, _function_); }
684 : LexNoBrace LexNoClass LexNoFunction
687 /* Virtual Tokens {{{ */
698 /* 11.6 Names and Keywords {{{ */
701 | "for" { $$ = CYNew CYWord("for"); }
702 | "in" { $$ = CYNew CYWord("in"); }
703 | "instanceof" { $$ = CYNew CYWord("instanceof"); }
712 : Identifier { $$ = $1; }
713 | "auto" { $$ = CYNew CYWord("auto"); }
714 | "break" { $$ = CYNew CYWord("break"); }
715 | "case" { $$ = CYNew CYWord("case"); }
716 | "catch" { $$ = CYNew CYWord("catch"); }
717 | "class" { $$ = CYNew CYWord("class"); }
718 | ";class" { $$ = CYNew CYWord("class"); }
719 | "const" { $$ = CYNew CYWord("const"); }
720 | "continue" { $$ = CYNew CYWord("continue"); }
721 | "debugger" { $$ = CYNew CYWord("debugger"); }
722 | "default" { $$ = CYNew CYWord("default"); }
723 | "delete" LexSetRegExp { $$ = CYNew CYWord("delete"); }
724 | "do" { $$ = CYNew CYWord("do"); }
725 | "else" { $$ = CYNew CYWord("else"); }
726 | "enum" { $$ = CYNew CYWord("enum"); }
727 | "export" { $$ = CYNew CYWord("export"); }
728 | "extends" { $$ = CYNew CYWord("extends"); }
729 | "false" { $$ = CYNew CYWord("false"); }
730 | "finally" { $$ = CYNew CYWord("finally"); }
731 | "function" { $$ = CYNew CYWord("function"); }
732 | "if" { $$ = CYNew CYWord("if"); }
733 | "import" { $$ = CYNew CYWord("import"); }
734 | "!in" { $$ = CYNew CYWord("in"); }
735 | "new" LexSetRegExp { $$ = CYNew CYWord("new"); }
736 | "null" { $$ = CYNew CYWord("null"); }
737 | "return" { $$ = CYNew CYWord("return"); }
738 | "!return" { $$ = CYNew CYWord("return"); }
739 | "super" { $$ = CYNew CYWord("super"); }
740 | "!super" { $$ = CYNew CYWord("super"); }
741 | "switch" { $$ = CYNew CYWord("switch"); }
742 | "this" { $$ = CYNew CYWord("this"); }
743 | "throw" { $$ = CYNew CYWord("throw"); }
744 | "true" { $$ = CYNew CYWord("true"); }
745 | "try" { $$ = CYNew CYWord("try"); }
746 | "typeof" LexSetRegExp { $$ = CYNew CYWord("typeof"); }
747 | "var" { $$ = CYNew CYWord("var"); }
748 | "void" LexSetRegExp { $$ = CYNew CYWord("void"); }
749 | "while" { $$ = CYNew CYWord("while"); }
750 | "with" { $$ = CYNew CYWord("with"); }
751 | "yield" { $$ = CYNew CYIdentifier("yield"); }
753 | Yield LexSetRegExp NewLineOpt { $$ = CYNew CYIdentifier("yield"); }
755 // XXX: should be Identifier
756 | "let" { $$ = CYNew CYIdentifier("let"); }
766 /* 11.8.1 Null Literals {{{ */
768 : "null" { $$ = CYNew CYNull(); }
771 /* 11.8.2 Boolean Literals {{{ */
773 : "true" { $$ = CYNew CYTrue(); }
774 | "false" { $$ = CYNew CYFalse(); }
778 /* 11.9 Automatic Semicolon Insertion {{{ */
780 : { driver.Warning(@$, "warning, automatic semi-colon insertion required"); }
790 | error { if (yyla.type_get() != yyeof_ && yyla.type != yytranslate_(token::CloseBrace) && !driver.newline_) { CYERR(@1, "required semi-colon"); } else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
795 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
799 /* 12.1 Identifiers {{{ */
801 : Identifier { $$ = CYNew CYVariable($1); }
802 | "yield" { $$ = CYNew CYVariable(CYNew CYIdentifier("yield")); }
806 : Identifier { $$ = $1; }
807 | "yield" { $$ = CYNew CYIdentifier("yield"); }
811 : BindingIdentifier { $$ = $1; }
816 : Identifier { $$ = $1; }
817 | "yield" { $$ = CYNew CYIdentifier("yield"); }
821 : Identifier_ { $$ = $1; }
822 | "abstract" { $$ = CYNew CYIdentifier("abstract"); }
823 | "await" { $$ = CYNew CYIdentifier("await"); }
824 | "boolean" { $$ = CYNew CYIdentifier("boolean"); }
825 | "byte" { $$ = CYNew CYIdentifier("byte"); }
826 | "constructor" { $$ = CYNew CYIdentifier("constructor"); }
827 | "double" { $$ = CYNew CYIdentifier("double"); }
828 | "each" { $$ = CYNew CYIdentifier("each"); }
829 | "eval" { $$ = CYNew CYIdentifier("eval"); }
830 | "final" { $$ = CYNew CYIdentifier("final"); }
831 | "float" { $$ = CYNew CYIdentifier("float"); }
832 | "from" { $$ = CYNew CYIdentifier("from"); }
833 | "get" { $$ = CYNew CYIdentifier("get"); }
834 | "goto" { $$ = CYNew CYIdentifier("goto"); }
835 | "implements" { $$ = CYNew CYIdentifier("implements"); }
836 | "interface" { $$ = CYNew CYIdentifier("interface"); }
837 | "native" { $$ = CYNew CYIdentifier("native"); }
838 | "of" { $$ = CYNew CYIdentifier("of"); }
839 | "package" { $$ = CYNew CYIdentifier("package"); }
840 | "private" { $$ = CYNew CYIdentifier("private"); }
841 | "protected" { $$ = CYNew CYIdentifier("protected"); }
842 | "prototype" { $$ = CYNew CYIdentifier("prototype"); }
843 | "public" { $$ = CYNew CYIdentifier("public"); }
844 | "set" { $$ = CYNew CYIdentifier("set"); }
845 | "synchronized" { $$ = CYNew CYIdentifier("synchronized"); }
846 | "throws" { $$ = CYNew CYIdentifier("throws"); }
847 | "transient" { $$ = CYNew CYIdentifier("transient"); }
848 | "undefined" { $$ = CYNew CYIdentifier("undefined"); }
850 | "bool" { $$ = CYNew CYIdentifier("bool"); }
851 | "BOOL" { $$ = CYNew CYIdentifier("BOOL"); }
852 | "id" { $$ = CYNew CYIdentifier("id"); }
853 | "SEL" { $$ = CYNew CYIdentifier("SEL"); }
859 | "char" { $$ = CYNew CYIdentifier("char"); }
860 | "int" { $$ = CYNew CYIdentifier("int"); }
861 | "long" { $$ = CYNew CYIdentifier("long"); }
862 | "short" { $$ = CYNew CYIdentifier("short"); }
863 | "static" { $$ = CYNew CYIdentifier("static"); }
864 | "volatile" { $$ = CYNew CYIdentifier("volatile"); }
866 | "extern" { $$ = CYNew CYIdentifier("extern"); }
867 | "signed" { $$ = CYNew CYIdentifier("signed"); }
868 | "typedef" { $$ = CYNew CYIdentifier("typedef"); }
869 | "unsigned" { $$ = CYNew CYIdentifier("unsigned"); }
872 | "nil" { $$ = CYNew CYIdentifier("nil"); }
873 | "NO" { $$ = CYNew CYIdentifier("NO"); }
874 | "NULL" { $$ = CYNew CYIdentifier("NULL"); }
875 | "YES" { $$ = CYNew CYIdentifier("YES"); }
879 /* 12.2 Primary Expression {{{ */
881 : "this" { $$ = CYNew CYThis(); }
882 | IdentifierReference { $$ = $1; }
883 | Literal { $$ = $1; }
884 | ArrayLiteral { $$ = $1; }
885 | ObjectLiteral { $$ = $1; }
886 | FunctionExpression { $$ = $1; }
887 | ClassExpression { $$ = $1; }
888 | GeneratorExpression { $$ = $1; }
889 | RegularExpressionLiteral { $$ = $1; }
890 | TemplateLiteral { $$ = $1; }
891 | CoverParenthesizedExpressionAndArrowParameterList { if ($1 == NULL) CYERR(@1, "invalid parenthetical"); $$ = $1; }
892 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
895 CoverParenthesizedExpressionAndArrowParameterList
896 : "(" LexPushInOff Expression ")" LexPopIn { $$ = CYNew CYParenthetical($3); }
897 | "(" LexPushInOff LexSetRegExp ")" LexPopIn { $$ = NULL; }
898 | "(" LexPushInOff LexSetRegExp "..." BindingIdentifier ")" LexPopIn { CYNOT(@$); }
899 | "(" LexPushInOff Expression "," LexSetRegExp "..." BindingIdentifier ")" LexPopIn { CYNOT(@$); }
902 /* 12.2.4 Literals {{{ */
904 : NullLiteral { $$ = $1; }
905 | BooleanLiteral { $$ = $1; }
906 | NumericLiteral { $$ = $1; }
907 | StringLiteral { $$ = $1; }
910 /* 12.2.5 Array Initializer {{{ */
912 : "[" LexPushInOff ElementListOpt "]" LexPopIn { $$ = CYNew CYArray($3); }
916 : AssignmentExpressionOpt "," ElementListOpt { $$ = CYNew CYElementValue($1, $3); }
917 | LexSetRegExp "..." AssignmentExpression { $$ = CYNew CYElementSpread($3); }
918 | AssignmentExpression { $$ = CYNew CYElementValue($1, NULL); }
922 : ElementList { $$ = $1; }
923 | LexSetRegExp { $$ = NULL; }
926 /* 12.2.6 Object Initializer {{{ */
928 : BRACE LexPushInOff PropertyDefinitionListOpt "}" LexPopIn { $$ = CYNew CYObject($3); }
931 PropertyDefinitionList_
932 : "," PropertyDefinitionListOpt { $$ = $2; }
936 PropertyDefinitionList
937 : PropertyDefinition PropertyDefinitionList_ { $1->SetNext($2); $$ = $1; }
940 PropertyDefinitionListOpt
941 : LexSetRegExp PropertyDefinitionList { $$ = $2; }
942 | LexSetRegExp { $$ = NULL; }
946 : IdentifierReference { $$ = CYNew CYPropertyValue($1->name_, $1); }
947 | CoverInitializedName { CYNOT(@$); }
948 | PropertyName ":" AssignmentExpression { $$ = CYNew CYPropertyValue($1, $3); }
949 | MethodDefinition { $$ = $1; }
953 : LiteralPropertyName { $$ = $1; }
954 | ComputedPropertyName { $$ = $1; }
958 : IdentifierName { $$ = $1; }
959 | StringLiteral { $$ = $1; }
960 | NumericLiteral { $$ = $1; }
964 : "[" AssignmentExpression "]" { $$ = CYNew CYComputed($2); }
968 : IdentifierReference Initializer
972 : "=" AssignmentExpression { $$ = $2; }
976 : Initializer { $$ = $1; }
980 /* 12.2.9 Template Literals {{{ */
982 : NoSubstitutionTemplate { $$ = CYNew CYTemplate($1, NULL); }
983 | TemplateHead TemplateSpans { $$ = CYNew CYTemplate($1, $2); }
987 : Expression TemplateMiddle TemplateSpans { $$ = CYNew CYSpan($1, $2, $3); }
988 | Expression TemplateTail { $$ = CYNew CYSpan($1, $2, NULL); }
992 /* 12.3 Left-Hand-Side Expressions {{{ */
994 : "[" LexPushInOff Expression "]" LexPopIn { $$ = CYNew CYDirectMember(NULL, $3); }
995 | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
996 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
997 | TemplateLiteral { CYNOT(@$); }
1001 : LexSetRegExp PrimaryExpression { $$ = $2; }
1002 | MemberExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
1003 | SuperProperty { $$ = $1; }
1004 | MetaProperty { CYNOT(@$); }
1005 | LexSetRegExp "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($3, $4); }
1009 : LexSetRegExp "!super" "[" Expression "]" { $$ = CYNew CYSuperAccess($4); }
1010 | LexSetRegExp "!super" "." IdentifierName { $$ = CYNew CYSuperAccess(CYNew CYString($4)); }
1018 : LexSetRegExp "new" LexSetRegExp "." "target"
1022 : MemberExpression { $$ = $1; }
1023 | LexSetRegExp "new" NewExpression { $$ = CYNew cy::Syntax::New($3, NULL); }
1027 : MemberExpression { $$ = $1; }
1028 | CallExpression { $$ = $1; }
1032 : CallExpression_ Arguments { if (!$1->Eval()) $$ = CYNew CYCall($1, $2); else $$ = CYNew CYEval($2); }
1033 | SuperCall { $$ = $1; }
1034 | CallExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
1038 : LexSetRegExp "!super" Arguments { $$ = CYNew CYSuperCall($3); }
1042 : "(" LexPushInOff ArgumentListOpt ")" LexPopIn { $$ = $3; }
1046 : "," ArgumentList { $$ = $2; }
1051 : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
1052 | LexSetRegExp "..." AssignmentExpression { CYNOT(@$); }
1056 : ArgumentList { $$ = $1; }
1057 | LexSetRegExp { $$ = NULL; }
1060 LeftHandSideExpression
1061 : NewExpression { $$ = $1; }
1062 | CallExpression { $$ = $1; }
1065 /* 12.4 Postfix Expressions {{{ */
1067 : %prec "" LeftHandSideExpression { $$ = $1; }
1068 | LeftHandSideExpression "++" { $$ = CYNew CYPostIncrement($1); }
1069 | LeftHandSideExpression "--" { $$ = CYNew CYPostDecrement($1); }
1072 /* 12.5 Unary Operators {{{ */
1074 : "delete" UnaryExpression { $$ = CYNew CYDelete($2); }
1075 | "void" UnaryExpression { $$ = CYNew CYVoid($2); }
1076 | "typeof" UnaryExpression { $$ = CYNew CYTypeOf($2); }
1077 | "++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
1078 | "\n++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
1079 | "--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
1080 | "\n--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
1081 | "+" UnaryExpression { $$ = CYNew CYAffirm($2); }
1082 | "-" UnaryExpression { $$ = CYNew CYNegate($2); }
1083 | "~" UnaryExpression { $$ = CYNew CYBitwiseNot($2); }
1084 | "!" UnaryExpression { $$ = CYNew CYLogicalNot($2); }
1088 : %prec "" PostfixExpression { $$ = $1; }
1089 | LexSetRegExp UnaryExpression_ { $$ = $2; }
1092 /* 12.6 Multiplicative Operators {{{ */
1093 MultiplicativeExpression
1094 : UnaryExpression { $$ = $1; }
1095 | MultiplicativeExpression "*" UnaryExpression { $$ = CYNew CYMultiply($1, $3); }
1096 | MultiplicativeExpression "/" UnaryExpression { $$ = CYNew CYDivide($1, $3); }
1097 | MultiplicativeExpression "%" UnaryExpression { $$ = CYNew CYModulus($1, $3); }
1100 /* 12.7 Additive Operators {{{ */
1102 : MultiplicativeExpression { $$ = $1; }
1103 | AdditiveExpression "+" MultiplicativeExpression { $$ = CYNew CYAdd($1, $3); }
1104 | AdditiveExpression "-" MultiplicativeExpression { $$ = CYNew CYSubtract($1, $3); }
1107 /* 12.8 Bitwise Shift Operators {{{ */
1109 : AdditiveExpression { $$ = $1; }
1110 | ShiftExpression "<<" AdditiveExpression { $$ = CYNew CYShiftLeft($1, $3); }
1111 | ShiftExpression ">>" AdditiveExpression { $$ = CYNew CYShiftRightSigned($1, $3); }
1112 | ShiftExpression ">>>" AdditiveExpression { $$ = CYNew CYShiftRightUnsigned($1, $3); }
1115 /* 12.9 Relational Operators {{{ */
1116 RelationalExpression
1117 : ShiftExpression { $$ = $1; }
1118 | RelationalExpression "<" ShiftExpression { $$ = CYNew CYLess($1, $3); }
1119 | RelationalExpression ">" ShiftExpression { $$ = CYNew CYGreater($1, $3); }
1120 | RelationalExpression "<=" ShiftExpression { $$ = CYNew CYLessOrEqual($1, $3); }
1121 | RelationalExpression ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual($1, $3); }
1122 | RelationalExpression "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf($1, $3); }
1123 | RelationalExpression "in" ShiftExpression { $$ = CYNew CYIn($1, $3); }
1126 /* 12.10 Equality Operators {{{ */
1128 : RelationalExpression { $$ = $1; }
1129 | EqualityExpression "==" RelationalExpression { $$ = CYNew CYEqual($1, $3); }
1130 | EqualityExpression "!=" RelationalExpression { $$ = CYNew CYNotEqual($1, $3); }
1131 | EqualityExpression "===" RelationalExpression { $$ = CYNew CYIdentical($1, $3); }
1132 | EqualityExpression "!==" RelationalExpression { $$ = CYNew CYNotIdentical($1, $3); }
1135 /* 12.11 Binary Bitwise Operators {{{ */
1136 BitwiseANDExpression
1137 : EqualityExpression { $$ = $1; }
1138 | BitwiseANDExpression "&" EqualityExpression { $$ = CYNew CYBitwiseAnd($1, $3); }
1141 BitwiseXORExpression
1142 : BitwiseANDExpression { $$ = $1; }
1143 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = CYNew CYBitwiseXOr($1, $3); }
1147 : BitwiseXORExpression { $$ = $1; }
1148 | BitwiseORExpression "|" BitwiseXORExpression { $$ = CYNew CYBitwiseOr($1, $3); }
1151 /* 12.12 Binary Logical Operators {{{ */
1152 LogicalANDExpression
1153 : BitwiseORExpression { $$ = $1; }
1154 | LogicalANDExpression "&&" BitwiseORExpression { $$ = CYNew CYLogicalAnd($1, $3); }
1158 : LogicalANDExpression { $$ = $1; }
1159 | LogicalORExpression "||" LogicalANDExpression { $$ = CYNew CYLogicalOr($1, $3); }
1162 /* 12.13 Conditional Operator ( ? : ) {{{ */
1163 ConditionalExpression
1164 : LogicalORExpression { $$ = $1; }
1165 | LogicalORExpression "?" LexPushInOff AssignmentExpression ":" LexPopIn AssignmentExpression { $$ = CYNew CYCondition($1, $4, $7); }
1168 /* 12.14 Assignment Operators {{{ */
1169 AssignmentExpression
1170 : ConditionalExpression { $$ = $1; }
1171 | LexSetRegExp YieldExpression { $$ = $2; }
1172 | ArrowFunction { $$ = $1; }
1173 | LeftHandSideExpression "=" AssignmentExpression { $$ = CYNew CYAssign($1, $3); }
1174 | LeftHandSideExpression "*=" AssignmentExpression { $$ = CYNew CYMultiplyAssign($1, $3); }
1175 | LeftHandSideExpression "/=" AssignmentExpression { $$ = CYNew CYDivideAssign($1, $3); }
1176 | LeftHandSideExpression "%=" AssignmentExpression { $$ = CYNew CYModulusAssign($1, $3); }
1177 | LeftHandSideExpression "+=" AssignmentExpression { $$ = CYNew CYAddAssign($1, $3); }
1178 | LeftHandSideExpression "-=" AssignmentExpression { $$ = CYNew CYSubtractAssign($1, $3); }
1179 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = CYNew CYShiftLeftAssign($1, $3); }
1180 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = CYNew CYShiftRightSignedAssign($1, $3); }
1181 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = CYNew CYShiftRightUnsignedAssign($1, $3); }
1182 | LeftHandSideExpression "&=" AssignmentExpression { $$ = CYNew CYBitwiseAndAssign($1, $3); }
1183 | LeftHandSideExpression "^=" AssignmentExpression { $$ = CYNew CYBitwiseXOrAssign($1, $3); }
1184 | LeftHandSideExpression "|=" AssignmentExpression { $$ = CYNew CYBitwiseOrAssign($1, $3); }
1187 AssignmentExpressionOpt
1188 : AssignmentExpression { $$ = $1; }
1189 | LexSetRegExp { $$ = NULL; }
1192 /* 12.15 Comma Operator ( , ) {{{ */
1194 : AssignmentExpression { $$ = $1; }
1195 | Expression "," AssignmentExpression { $$ = CYNew CYCompound($1, $3); }
1199 : Expression { $$ = $1; }
1200 | LexSetRegExp { $$ = NULL; }
1204 /* 13 Statements and Declarations {{{ */
1206 : BlockStatement { $$ = $1; }
1207 | VariableStatement { $$ = $1; }
1208 | EmptyStatement { $$ = $1; }
1209 | IfStatement { $$ = $1; }
1210 | BreakableStatement { $$ = $1; }
1211 | ContinueStatement { $$ = $1; }
1212 | BreakStatement { $$ = $1; }
1213 | ReturnStatement { $$ = $1; }
1214 | WithStatement { $$ = $1; }
1215 | LabelledStatement { $$ = $1; }
1216 | ThrowStatement { $$ = $1; }
1217 | TryStatement { $$ = $1; }
1218 | DebuggerStatement { $$ = $1; }
1222 : LexSetRegExp Statement__ { $$ = $2; }
1223 | ExpressionStatement { $$ = $1; }
1227 : LexSetStatement Statement_ { $$ = $2; }
1231 : HoistableDeclaration { $$ = $1; }
1232 | ClassDeclaration { $$ = $1; }
1233 | LexicalDeclaration { $$ = $1; }
1237 : LexSetRegExp Declaration__ { $$ = $2; }
1241 : LexSetStatement Declaration_ { $$ = $2; }
1244 HoistableDeclaration
1245 : FunctionDeclaration { $$ = $1; }
1246 | GeneratorDeclaration { $$ = $1; }
1250 : IterationStatement { $$ = $1; }
1251 | SwitchStatement { $$ = $1; }
1254 /* 13.2 Block {{{ */
1256 : ";{" StatementListOpt "}" { $$ = CYNew CYBlock($2); }
1260 : BRACE StatementListOpt "}" { $$ = $2; }
1264 : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
1268 : StatementList { $$ = $1; }
1269 | LexSetStatement LexSetRegExp { $$ = NULL; }
1273 : Statement { $$ = $1; }
1274 | Declaration { $$ = $1; }
1277 /* 13.3 Let and Const Declarations {{{ */
1279 : LetOrConst BindingList Terminator { $$ = CYNew CYLet($1, $2); }
1283 : "let" { $$ = false; }
1284 | "const" { $$ = true; }
1288 : "," BindingList { $$ = $2; }
1293 : LexicalBinding BindingList_ { $$ = CYNew CYDeclarations($1, $2); }
1297 : BindingIdentifier InitializerOpt { $$ = CYNew CYDeclaration($1, $2); }
1298 | BindingPattern Initializer { CYNOT(@1); }
1301 /* 13.3.2 Variable Statement {{{ */
1303 : Var_ VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1306 VariableDeclarationList_
1307 : "," VariableDeclarationList { $$ = $2; }
1311 VariableDeclarationList
1312 : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
1316 : BindingIdentifier InitializerOpt { $$ = CYNew CYDeclaration($1, $2); }
1317 | BindingPattern Initializer { CYNOT(@1); }
1320 /* 13.3.3 Destructuring Binding Patterns {{{ */
1322 : ObjectBindingPattern
1323 | ArrayBindingPattern
1326 ObjectBindingPattern
1327 : BRACE BindingPropertyListOpt "}"
1331 : "[" { CYNOT(@$); }
1334 BindingPropertyList_
1335 : "," BindingPropertyListOpt
1340 : BindingProperty BindingPropertyList_
1343 BindingPropertyListOpt
1344 : BindingPropertyList
1350 | PropertyName ":" BindingElement
1354 : SingleNameBinding { $$ = $1; }
1355 | BindingPattern InitializerOpt { CYNOT(@$); }
1359 : BindingIdentifier InitializerOpt { $$ = CYNew CYDeclaration($1, $2); }
1363 : "..." BindingIdentifier
1366 /* 13.4 Empty Statement {{{ */
1368 : ";" { $$ = CYNew CYEmpty(); }
1371 /* 13.5 Expression Statement {{{ */
1373 : Expression Terminator { $$ = CYNew CYExpress($1); }
1376 /* 13.6 The if Statement {{{ */
1378 : "else" Statement { $$ = $2; }
1379 | %prec "if" { $$ = NULL; }
1383 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = CYNew CYIf($3, $5, $6); }
1386 /* 13.7 Iteration Statements {{{ */
1388 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
1389 | "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
1390 | "for" "(" LexPushInOn ForStatementInitializer ";" LexPopIn ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $7, $9, $11); }
1391 | "for" "(" LexPushInOn ForInStatementInitializer "!in" LexPopIn Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
1392 | "for" "(" LexPushInOn ForInStatementInitializer "of" LexPopIn AssignmentExpression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
1395 ForStatementInitializer
1396 : ExpressionOpt { $$ = $1; }
1397 | LexSetRegExp Var_ VariableDeclarationList { $$ = CYNew CYForDeclarations($3); }
1398 | LexSetRegExp LexicalDeclaration { CYNOT(@$); }
1401 ForInStatementInitializer
1402 : LeftHandSideExpression { $$ = $1; }
1403 | LexSetRegExp Var_ ForBinding { $$ = CYNew CYForVariable($3); }
1404 | LexSetRegExp ForDeclaration { $$ = $2; }
1408 : LetOrConst ForBinding { $$ = CYNew CYForLexical($1, $2); }
1412 : BindingIdentifier { $$ = CYNew CYDeclaration($1, NULL); }
1413 | BindingPattern { CYNOT(@1); }
1416 /* 13.8 The continue Statement {{{ */
1418 : "continue" LexNewLine
1422 : Continue TerminatorSoft { $$ = CYNew CYContinue(NULL); }
1423 | Continue Identifier Terminator { $$ = CYNew CYContinue($2); }
1426 /* 13.9 The break Statement {{{ */
1428 : "break" LexNewLine
1432 : Break TerminatorSoft { $$ = CYNew CYBreak(NULL); }
1433 | Break Identifier Terminator { $$ = CYNew CYBreak($2); }
1436 /* 13.10 The return Statement {{{ */
1438 : "!return" LexNewLine
1442 : Return LexSetRegExp TerminatorSoft { $$ = CYNew CYReturn(NULL); }
1443 | Return Expression Terminator { $$ = CYNew CYReturn($2); }
1446 /* 13.11 The with Statement {{{ */
1448 : "with" "(" Expression ")" Statement { $$ = CYNew CYWith($3, $5); }
1451 /* 13.12 The switch Statement {{{ */
1453 : "switch" "(" Expression ")" CaseBlock { $$ = CYNew CYSwitch($3, $5); }
1457 : BRACE CaseClausesOpt "}" { $$ = $2; }
1461 : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
1465 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1466 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1470 // XXX: the standard makes certain you can only have one of these
1472 : "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
1475 /* 13.13 Labelled Statements {{{ */
1477 : LabelIdentifier ":" LabelledItem { $$ = CYNew CYLabel($1, $3); }
1481 : Statement { $$ = $1; }
1482 | LexSetStatement LexSetRegExp FunctionDeclaration { $$ = $3; }
1485 /* 13.14 The throw Statement {{{ */
1487 : "throw" LexNewLine
1491 : Throw LexSetRegExp TerminatorSoft { CYERR(@1, "throw without exception"); }
1492 | Throw Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); }
1495 /* 13.15 The try Statement {{{ */
1497 : "try" Block Catch { $$ = CYNew cy::Syntax::Try($2, $3, NULL); }
1498 | "try" Block Finally { $$ = CYNew cy::Syntax::Try($2, NULL, $3); }
1499 | "try" Block Catch Finally { $$ = CYNew cy::Syntax::Try($2, $3, $4); }
1503 : "catch" "(" CatchParameter ")" Block { $$ = CYNew cy::Syntax::Catch($3, $5); }
1507 : "finally" Block { $$ = CYNew CYFinally($2); }
1511 : BindingIdentifier { $$ = $1; }
1512 | BindingPattern { CYNOT(@$); }
1515 /* 13.16 The debugger Statement {{{ */
1517 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1521 /* 14.1 Function Definitions {{{ */
1523 : ";function" BindingIdentifier "(" FormalParameters ")" BRACE LexPushSuperOff FunctionBody "}" LexPopSuper { $$ = CYNew CYFunctionStatement($2, $4, $8); }
1527 : "function" BindingIdentifierOpt "(" LexPushInOff FormalParameters ")" LexPopIn BRACE LexPushSuperOff LexPushInOff FunctionBody "}" LexPopIn LexPopSuper { $$ = CYNew CYFunctionExpression($2, $5, $11); }
1530 StrictFormalParameters
1531 : FormalParameters { $$ = $1; }
1536 | FormalParameterList
1539 FormalParameterList_
1540 : "," FormalParameterList { $$ = $2; }
1545 : FunctionRestParameter { CYNOT(@$); }
1546 | FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
1549 FunctionRestParameter
1550 : BindingRestElement
1554 : BindingElement { $$ = $1; }
1558 : LexPushYieldOff FunctionStatementList LexPopYield { $$ = $2; }
1561 FunctionStatementList
1562 : LexPushReturnOn StatementListOpt LexPopReturn { $$ = $2; }
1565 /* 14.2 Arrow Function Definitions {{{ */
1567 : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFatArrow($2, $5); }
1571 : BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
1572 | CoverParenthesizedExpressionAndArrowParameterList { if ($1 == NULL) $$ = NULL; else { $$ = $1->expression_->Parameter(); if ($$ == NULL) CYERR(@1, "invalid parameter list"); } }
1576 : AssignmentExpression { $$ = CYNew CYReturn($1); }
1577 | LexSetRegExp ";{" LexPushInOff FunctionBody "}" LexPopIn { $$ = $4; }
1580 /* 14.3 Method Definitions {{{ */
1582 : PropertyName "(" StrictFormalParameters ")" BRACE FunctionBody "}" { $$ = CYNew CYPropertyMethod($1, $3, $6); }
1583 | GeneratorMethod { $$ = $1; }
1584 | "get" PropertyName "(" ")" BRACE FunctionBody "}" { $$ = CYNew CYPropertyGetter($2, $6); }
1585 | "set" PropertyName "(" PropertySetParameterList ")" BRACE FunctionBody "}" { $$ = CYNew CYPropertySetter($2, CYNew CYFunctionParameter($4), $7); }
1588 PropertySetParameterList
1589 : FormalParameter { $$ = $1; }
1592 /* 14.4 Generator Function Definitions {{{ */
1594 : "*" PropertyName "(" StrictFormalParameters ")" BRACE GeneratorBody "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorMethod($2, $4, $7); */ }
1597 GeneratorDeclaration
1598 : ";function" "*" BindingIdentifier "(" FormalParameters ")" BRACE GeneratorBody "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorStatement($3, $5, $8); */ }
1602 : "function" "*" BindingIdentifierOpt "(" FormalParameters ")" BRACE GeneratorBody "}" { CYNOT(@$); /* $$ = CYNew CYGeneratorExpression($3, $5, $8); */ }
1606 : LexPushYieldOn FunctionStatementList LexPopYield { $$ = $2; }
1610 : "!yield" LexNewLine LexNoStar
1614 : Yield LexSetRegExp "\n" { CYNOT(@$); /* $$ = CYNew CYYieldValue(NULL); */ }
1615 | Yield AssignmentExpression { CYNOT(@$); /* $$ = CYNew CYYieldValue($2); */ }
1616 | Yield LexSetRegExp YieldStar AssignmentExpression { CYNOT(@$); /* $$ = CYNew CYYieldGenerator($4); */ }
1619 /* 14.5 Class Definitions {{{ */
1621 : ";class" BindingIdentifier ClassTail { $$ = CYNew CYClassStatement($2, $3); }
1625 : "class" BindingIdentifierOpt ClassTail { $$ = CYNew CYClassExpression($2, $3); }
1629 : ClassHeritageOpt { driver.class_.push($1); } BRACE LexPushSuperOn ClassBodyOpt "}" LexPopSuper { driver.class_.pop(); $$ = $1; }
1633 : "extends" LeftHandSideExpression { $$ = CYNew CYClassTail($2); }
1637 : ClassHeritage { $$ = $1; }
1638 | { $$ = CYNew CYClassTail(NULL); }
1651 : ClassElementListOpt ClassElement
1660 : MethodDefinition { if (CYFunctionExpression *constructor = $1->Constructor()) driver.class_.top()->constructor_ = constructor; else driver.class_.top()->instance_->*$1; }
1661 | "static" MethodDefinition { driver.class_.top()->static_->*$2; }
1666 /* 15.1 Scripts {{{ */
1668 : ScriptBodyOpt { driver.script_ = CYNew CYScript($1); }
1672 : StatementList { $$ = $1; }
1676 : ScriptBody { $$ = $1; }
1677 | LexSetStatement LexSetRegExp { $$ = NULL; }
1680 /* 15.2 Modules {{{ */
1695 : ModuleItemListOpt ModuleItem
1704 : LexSetStatement LexSetRegExp ImportDeclaration
1705 | LexSetStatement LexSetRegExp ExportDeclaration
1709 /* 15.2.2 Imports {{{ */
1711 : "import" ImportClause FromClause Terminator
1712 | "import" ModuleSpecifier Terminator
1716 : ImportedDefaultBinding
1719 | ImportedDefaultBinding "," NameSpaceImport
1720 | ImportedDefaultBinding "," NamedImports
1723 ImportedDefaultBinding
1728 : "*" "as" ImportedBinding
1732 : BRACE ImportsListOpt "}"
1736 : "from" ModuleSpecifier
1740 : "," ImportsListOpt
1745 : ImportSpecifier ImportsList_
1755 | IdentifierName "as" ImportedBinding
1766 /* 15.2.3 Exports {{{ */
1768 : "*" FromClause Terminator
1769 | ExportClause FromClause Terminator
1770 | ExportClause Terminator
1772 | "default" LexSetStatement LexSetRegExp HoistableDeclaration
1773 | "default" LexSetStatement LexSetRegExp ClassDeclaration
1774 | "default" LexSetStatement AssignmentExpression Terminator
1778 : "export" LexSetStatement LexSetRegExp ExportDeclaration_
1779 | "export" Declaration
1783 : ";{" ExportsListOpt "}"
1787 : "," ExportsListOpt
1792 : ExportSpecifier ExportsList_
1802 | IdentifierName "as" IdentifierName
1807 /* Cycript (C): Type Encoding {{{ */
1809 : IdentifierType { $$ = CYNew CYTypedIdentifier(@1, $1); }
1810 | "(" LexPushInOff "*" TypeQualifierRight ")" LexPopIn { $$ = $4; }
1814 : SuffixedType "[" NumericLiteral "]" { $$ = $1; $$->modifier_ = CYNew CYTypeArrayOf($3, $$->modifier_); }
1815 | "(" LexPushInOff "^" TypeQualifierRight ")" LexPopIn "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = $4; $$->modifier_ = CYNew CYTypeBlockWith($9, $$->modifier_); }
1816 | TypeSignifier "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = $1; $$->modifier_ = CYNew CYTypeFunctionWith($4, $$->modifier_); }
1817 | "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = CYNew CYTypedIdentifier(@1); $$->modifier_ = CYNew CYTypeFunctionWith($3, $$->modifier_); }
1818 | TypeSignifier { $$ = $1; }
1819 | { $$ = CYNew CYTypedIdentifier(@$); }
1823 : "*" TypeQualifierRight { $$ = $2; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
1828 | "const" TypeQualifierLeft { $$ = $2; CYSetLast($$) = CYNew CYTypeConstant(); }
1829 | "volatile" TypeQualifierLeft { $$ = $2; CYSetLast($$) = CYNew CYTypeVolatile(); }
1833 : PrefixedType { $$ = $1; }
1834 | SuffixedType { $$ = $1; }
1835 | "const" TypeQualifierRight { $$ = $2; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
1836 | "volatile" TypeQualifierRight { $$ = $2; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
1840 : "int" { $$ = CYNew CYTypeVariable("int"); }
1841 | "unsigned" IntegerTypeOpt { $$ = CYNew CYTypeUnsigned($2); }
1842 | "signed" IntegerTypeOpt { $$ = CYNew CYTypeSigned($2); }
1843 | "long" IntegerTypeOpt { $$ = CYNew CYTypeLong($2); }
1844 | "short" IntegerTypeOpt { $$ = CYNew CYTypeShort($2); }
1848 : IntegerType { $$ = $1; }
1849 | { $$ = CYNew CYTypeVariable("int"); }
1853 : IdentifierType { $$ = CYNew CYTypeVariable($1); }
1854 | IntegerType { $$ = $1; }
1855 | "void" { $$ = CYNew CYTypeVoid(); }
1856 | "char" { $$ = CYNew CYTypeVariable("char"); }
1857 | "signed" "char" { $$ = CYNew CYTypeSigned(CYNew CYTypeVariable("char")); }
1858 | "unsigned" "char" { $$ = CYNew CYTypeUnsigned(CYNew CYTypeVariable("char")); }
1862 : TypeQualifierLeft PrimitiveType TypeQualifierRight { $$ = $3; $$->specifier_ = $2; CYSetLast($1) = $$->modifier_; $$->modifier_ = $1; }
1866 : "@encode" "(" TypedIdentifier ")" { $$ = CYNew CYEncodedType($3); }
1872 /* Cycript (Objective-C): @class Declaration {{{ */
1874 /* XXX: why the hell did I choose MemberExpression? */
1875 : ":" LexSetRegExp MemberExpression { $$ = $3; }
1879 ImplementationFieldListOpt
1880 : TypedIdentifier ";" ImplementationFieldListOpt { $$ = CYNew CYImplementationField($1, $3); }
1881 | LexSetRegExp { $$ = NULL; }
1884 ImplementationFields
1885 : BRACE ImplementationFieldListOpt "}" { $$ = $2; }
1889 : "+" { $$ = false; }
1890 | "-" { $$ = true; }
1894 : "(" LexSetRegExp TypedIdentifier ")" { if ($3->identifier_ != NULL) CYERR($3->location_, "unexpected identifier"); $$ = $3; }
1895 | { $$ = CYNew CYTypedIdentifier(CYNew CYTypeVariable("id")); }
1899 : Word ":" TypeOpt Identifier { $3->identifier_ = $4; $$ = CYNew CYMessageParameter($1, $3); }
1902 MessageParameterList
1903 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1906 MessageParameterListOpt
1907 : MessageParameterList { $$ = $1; }
1912 : MessageParameterList { $$ = $1; }
1913 | Word { $$ = CYNew CYMessageParameter($1, NULL); }
1916 ClassMessageDeclaration
1917 : MessageScope TypeOpt MessageParameters BRACE LexPushSuperOn FunctionBody "}" LexPopSuper { $$ = CYNew CYMessage($1, $2, $3, $6); }
1920 ClassMessageDeclarationListOpt
1921 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1925 // XXX: this should be AssignmentExpressionNoRight
1927 : ShiftExpression ClassProtocolsOpt { $$ = CYNew CYProtocol($1, $2); }
1931 : "," ClassProtocols { $$ = $2; }
1935 ClassProtocolListOpt
1936 : "<" ClassProtocols ">" { $$ = $2; }
1940 ImplementationStatement
1941 : "@implementation" Identifier ClassSuperOpt ClassProtocolListOpt ImplementationFields ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYImplementation($2, $3, $4, $5, $6); }
1949 : "@implementation" Identifier CategoryName ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYCategory($2, $4); }
1953 : ImplementationStatement { $$ = $1; }
1954 | CategoryStatement { $$ = $1; }
1957 /* Cycript (Objective-C): Send Message {{{ */
1959 : "," AssignmentExpression VariadicCall { $$ = CYNew CYArgument(NULL, $2, $3); }
1964 : WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
1965 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
1969 : SelectorCall { $$ = $1; }
1970 | VariadicCall { $$ = $1; }
1974 : SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYWord(""), $3, $4); }
1978 : SelectorCall { $$ = $1; }
1979 | Word { $$ = CYNew CYArgument($1, NULL); }
1983 : "[" LexPushInOff AssignmentExpression { driver.contexts_.push_back($3); } SelectorList "]" LexPopIn { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
1984 | "[" LexPushInOff LexSetRegExp "!super" { driver.context_ = NULL; } SelectorList "]" LexPopIn { $$ = CYNew CYSendSuper($6); }
1988 : WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
1992 : SelectorExpression_ { $$ = $1; }
1993 | Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
1996 SelectorExpressionOpt
1997 : SelectorExpression_ { $$ = $1; }
2002 : MessageExpression { $$ = $1; }
2003 | "@selector" "(" LexPushInOff SelectorExpression ")" LexPopIn { $$ = CYNew CYSelector($4); }
2008 /* Cycript: @import Directive {{{ */
2010 : ModulePath "." Word { $$ = CYNew CYModule($3, $1); }
2011 | Word { $$ = CYNew CYModule($1); }
2015 : "@import" ModulePath { $$ = CYNew CYImport($2); }
2020 /* Cycript (Objective-C): Boxed Expressions {{{ */
2022 : NullLiteral { $$ = $1; }
2023 | BooleanLiteral { $$ = $1; }
2024 | NumericLiteral { $$ = $1; }
2025 | StringLiteral { $$ = $1; }
2026 | ArrayLiteral { $$ = $1; }
2027 | ObjectLiteral { $$ = $1; }
2028 | CoverParenthesizedExpressionAndArrowParameterList { $$ = $1; }
2029 | "YES" { $$ = CYNew CYTrue(); }
2030 | "NO" { $$ = CYNew CYFalse(); }
2034 : "@" BoxableExpression { $$ = CYNew CYBox($2); }
2035 | "@YES" { $$ = CYNew CYBox(CYNew CYTrue()); }
2036 | "@NO" { $$ = CYNew CYBox(CYNew CYFalse()); }
2037 | "@true" { $$ = CYNew CYBox(CYNew CYTrue()); }
2038 | "@false" { $$ = CYNew CYBox(CYNew CYFalse()); }
2039 | "@null" { $$ = CYNew CYBox(CYNew CYNull()); }
2042 /* Cycript (Objective-C): Block Expressions {{{ */
2044 : "^" TypedIdentifier { if ($2->identifier_ != NULL) CYERR($2->location_, "unexpected identifier"); } BRACE LexPushInOff FunctionBody "}" LexPopIn { if (CYTypeFunctionWith *function = $2->Function()) $$ = CYNew CYObjCBlock($2, function->parameters_, $6); else CYERR($2->location_, "expected parameters"); }
2047 /* Cycript (Objective-C): Instance Literals {{{ */
2049 : "#" NumericLiteral { $$ = CYNew CYInstanceLiteral($2); }
2055 /* Cycript (C): Pointer Indirection/Addressing {{{ */
2056 LeftHandSideExpression
2057 : LexSetRegExp "*" UnaryExpression { $$ = CYNew CYIndirect($3); }
2061 : "&" UnaryExpression { $$ = CYNew CYAddressOf($2); }
2065 : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); }
2066 | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); }
2067 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
2070 /* Cycript (C): auto Compatibility {{{ */
2075 /* Cycript (C): Lambda Expressions {{{ */
2077 : "," TypedParameterList { $$ = $2; }
2082 : TypedIdentifier TypedParameterList_ { $$ = CYNew CYTypedParameter($1, $2); }
2085 TypedParameterListOpt
2086 : TypedParameterList { $$ = $1; }
2091 : "[" LexPushInOff LexSetRegExp "&" LexSetRegExp "]" LexPopIn "(" LexPushInOff TypedParameterListOpt ")" LexPopIn "->" TypedIdentifier BRACE LexPushInOff FunctionBody "}" LexPopIn { $$ = CYNew CYLambda($14, $10, $17); }
2094 /* Cycript (C): Type Definitions {{{ */
2096 : "typedef" TypedIdentifier { if ($2->identifier_ == NULL) CYERR($2->location_, "expected identifier"); } Terminator { $$ = CYNew CYTypeDefinition($2); }
2099 /* Cycript (C): extern "C" {{{ */
2101 : "extern" StringLiteral { if (strcmp($2->Value(), "C") != 0) CYERR(@2, "unknown extern binding"); } TypedIdentifier { if ($4->identifier_ == NULL) CYERR($4->location_, "expected identifier"); } Terminator { $$ = CYNew CYExternal($2, $4); }
2108 /* Lexer State {{{ */
2110 : { driver.PushCondition(CYDriver::RegExpCondition); }
2114 : { driver.PushCondition(CYDriver::XMLContentCondition); }
2118 : { driver.PushCondition(CYDriver::XMLTagCondition); }
2122 : { driver.PopCondition(); }
2126 : { driver.SetCondition(CYDriver::XMLContentCondition); }
2130 : { driver.SetCondition(CYDriver::XMLTagCondition); }
2133 /* Virtual Tokens {{{ */
2140 /* 8.1 Context Keywords {{{ */
2142 : "namespace" { $$ = CYNew CYIdentifier("namespace"); }
2143 | "xml" { $$ = CYNew CYIdentifier("xml"); }
2146 /* 8.3 XML Initializer Input Elements {{{ */
2148 : XMLComment { $$ = $1; }
2149 | XMLCDATA { $$ = $1; }
2150 | XMLPI { $$ = $1; }
2154 /* 11.1 Primary Expressions {{{ */
2156 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
2157 | XMLInitialiser { $$ = $1; }
2158 | XMLListInitialiser { $$ = $1; }
2162 : AttributeIdentifier { $$ = $1; }
2163 | QualifiedIdentifier { $$ = $1; }
2164 | WildcardIdentifier { $$ = $1; }
2167 /* 11.1.1 Attribute Identifiers {{{ */
2169 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
2173 : PropertySelector { $$ = $1; }
2174 | "[" LexPushInOff Expression "]" LexPopIn { $$ = CYNew CYSelector($3); }
2178 : Identifier { $$ = CYNew CYSelector($1); }
2179 | WildcardIdentifier { $$ = $1; }
2182 /* 11.1.2 Qualified Identifiers {{{ */
2183 QualifiedIdentifier_
2184 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
2185 | QualifiedIdentifier { $$ = $1; }
2189 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
2192 /* 11.1.3 Wildcard Identifiers {{{ */
2194 : "*" { $$ = CYNew CYWildcard(); }
2197 /* 11.1.4 XML Initializer {{{ */
2199 : XMLMarkup { $$ = $1; }
2200 | XMLElement { $$ = $1; }
2204 : "<" LexPushInOff XMLTagContent LexPop "/>" LexPopIn
2205 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop ">" LexPopIn
2209 : LexPushXMLTag XMLTagName XMLAttributes
2213 : BRACE LexPushRegExp Expression LexPop "}"
2222 : XMLAttributes_ XMLAttribute
2227 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
2228 | XMLAttributes_ XMLWhitespaceOpt
2237 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
2241 : XMLExpression XMLElementContentOpt
2242 | XMLMarkup XMLElementContentOpt
2243 | XMLText XMLElementContentOpt
2244 | XMLElement XMLElementContentOpt
2247 XMLElementContentOpt
2252 /* 11.1.5 XMLList Initializer {{{ */
2254 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop "</>" LexPopIn { $$ = CYNew CYXMLList($4); }
2258 /* 11.2 Left-Hand-Side Expressions {{{ */
2260 : Identifier { $$ = $1; }
2261 | PropertyIdentifier { $$ = $1; }
2265 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
2266 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
2267 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
2270 /* 12.1 The default xml namespace Statement {{{ */
2271 /* XXX: DefaultXMLNamespaceStatement
2272 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
2276 : DefaultXMLNamespaceStatement { $$ = $1; }
2281 /* JavaScript FTL: Array Comprehensions {{{ */
2283 : AssignmentExpression ComprehensionFor ComprehensionTail { $$ = CYNew CYArrayComprehension($1, $2->Modify($3)); }
2287 : "for" "each" "(" LexPushInOn LexicalBinding "!in" LexPopIn Expression ")" { $$ = CYNew CYForOfComprehension($5, $8); }
2290 /* JavaScript FTL: for each {{{ */
2292 : "for" "each" "(" LexPushInOn ForInStatementInitializer "!in" LexPopIn Expression ")" Statement { $$ = CYNew CYForOf($5, $8, $10); }
2296 /* JavaScript FTW: Array Comprehensions {{{ */
2298 : ArrayComprehension
2302 : "[" LexPushInOff Comprehension "]" LexPopIn { $$ = $3; }
2306 : LexSetRegExp ComprehensionFor ComprehensionTail AssignmentExpression { $$ = CYNew CYArrayComprehension($4, $2->Modify($3)); }
2311 | ComprehensionFor ComprehensionTail { $$ = $1->Modify($2); }
2312 | ComprehensionIf ComprehensionTail { $$ = $1->Modify($2); }
2316 : "for" "(" LexPushInOn LexicalBinding "!in" LexPopIn Expression ")" { $$ = CYNew CYForInComprehension($4, $7); }
2317 | "for" "(" LexPushInOn LexicalBinding "of" LexPopIn Expression ")" { $$ = CYNew CYForOfComprehension($4, $7); }
2321 : "if" "(" AssignmentExpression ")" { $$ = CYNew CYIfComprehension($3); }
2324 /* JavaScript FTW: Coalesce Operator {{{ */
2325 ConditionalExpression
2326 : LogicalORExpression "?" LexPushInOff LexSetRegExp ":" LexPopIn AssignmentExpression { $$ = CYNew CYCondition($1, $1, $7); }
2329 /* JavaScript FTW: Named Arguments {{{ */
2331 : LexSetRegExp Word ":" AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument($2, $4, $5); }
2334 /* JavaScript FTW: Ruby Blocks {{{ */
2335 RubyProcParameterList_
2336 : "," RubyProcParameterList { $$ = $2; }
2340 RubyProcParameterList
2341 : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
2346 : LexSetRegExp "|" RubyProcParameterList "|" { $$ = $3; }
2347 | LexSetRegExp "||" { $$ = NULL; }
2350 RubyProcParametersOpt
2351 : RubyProcParameters { $$ = $1; }
2356 : "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
2360 : BRACE LexPushInOff RubyProcParameters StatementListOpt "}" LexPopIn { $$ = CYNew CYRubyProc($3, $4); }
2364 : PostfixExpression RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }
2370 bool CYDriver::Parse(CYMark mark) {
2372 CYLocal<CYPool> local(&pool_);
2373 cy::parser parser(*this);
2375 parser.set_debug_level(debug_);
2377 return parser.parse() != 0;
2380 void CYDriver::Warning(const cy::parser::location_type &location, const char *message) {
2384 CYDriver::Error error;
2385 error.warning_ = true;
2386 error.location_ = location;
2387 error.message_ = message;
2388 errors_.push_back(error);
2391 void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
2392 CYDriver::Error error;
2393 error.warning_ = false;
2394 error.location_ = location;
2395 error.message_ = message;
2396 driver.errors_.push_back(error);