]> git.saurik.com Git - cycript.git/blob - Cycript.yy.in
Drastically improve syntax support for @encode().
[cycript.git] / Cycript.yy.in
1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2013 Jay Freeman (saurik)
3 */
4
5 /* GNU General Public License, Version 3 {{{ */
6 /*
7 * Cycript is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation, either version 3 of the License,
10 * or (at your option) any later version.
11 *
12 * Cycript is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Cycript. If not, see <http://www.gnu.org/licenses/>.
19 **/
20 /* }}} */
21
22 @if Bison23 %{
23
24 @if Bison24 %code top {
25 #define cyscanner driver.scanner_
26 #define YYSTACKEXPANDABLE 1
27 @if Bison23 #define yyerrok (yyerrstatus_ = 0)
28 @if Bison24 }
29
30 @if Bison24 %code requires {
31 #include "Driver.hpp"
32 #include "Parser.hpp"
33 #define CYNew new($pool)
34
35 @begin ObjectiveC
36 #include "ObjectiveC/Syntax.hpp"
37 @end
38
39 @begin E4X
40 #include "E4X/Syntax.hpp"
41 @end
42
43 #include "Highlight.hpp"
44
45 typedef struct {
46 bool newline_;
47 hi::Value highlight_;
48
49 union {
50 bool bool_;
51
52 CYDriver::Condition condition_;
53
54 CYArgument *argument_;
55 CYAssignment *assignment_;
56 CYBoolean *boolean_;
57 CYClause *clause_;
58 cy::Syntax::Catch *catch_;
59 CYComment *comment_;
60 CYComprehension *comprehension_;
61 CYCompound *compound_;
62 CYDeclaration *declaration_;
63 CYDeclarations *declarations_;
64 CYElement *element_;
65 CYExpression *expression_;
66 CYFalse *false_;
67 CYFinally *finally_;
68 CYForInitialiser *for_;
69 CYForInInitialiser *forin_;
70 CYFunctionParameter *functionParameter_;
71 CYIdentifier *identifier_;
72 CYInfix *infix_;
73 CYLiteral *literal_;
74 CYMember *member_;
75 CYNull *null_;
76 CYNumber *number_;
77 CYProgram *program_;
78 CYProperty *property_;
79 CYPropertyName *propertyName_;
80 CYRubyProc *rubyProc_;
81 CYStatement *statement_;
82 CYString *string_;
83 CYThis *this_;
84 CYTrue *true_;
85 CYWord *word_;
86
87 @begin ObjectiveC
88 CYClassName *className_;
89 CYField *field_;
90 CYMessage *message_;
91 CYMessageParameter *messageParameter_;
92 CYProtocol *protocol_;
93 CYSelectorPart *selector_;
94 CYTypeModifier *type_;
95 CYTypedIdentifier *typedIdentifier_;
96 CYTypedParameter *typedParameter_;
97 @end
98
99 @begin E4X
100 CYAttribute *attribute_;
101 CYPropertyIdentifier *propertyIdentifier_;
102 CYSelector *selector_;
103 @end
104 };
105 } YYSTYPE;
106
107 #define YYSTYPE YYSTYPE
108 @if Bison24 }
109
110 @if Bison24 %code provides {
111 int cylex(YYSTYPE *, cy::location *, void *);
112 @if Bison24 }
113
114 @if Bison23 %}
115
116 %name-prefix="cy"
117
118 @if Bison23 %skeleton "lalr1.cc"
119 @if Bison24 %language "C++"
120
121 %initial-action {
122 @$.begin.filename = @$.end.filename = &driver.filename_;
123 };
124
125 %locations
126 %defines
127
128 //%glr-parser
129 //%expect 1
130
131 %error-verbose
132
133 %parse-param { CYDriver &driver }
134 %lex-param { void *cyscanner }
135
136 /* Token Declarations {{{ */
137 @begin E4X
138 %token XMLCDATA
139 %token XMLComment
140 %token XMLPI
141
142 %token XMLAttributeValue
143 %token XMLName
144 %token XMLTagCharacters
145 %token XMLText
146 %token XMLWhitespace
147 @end
148
149 @begin E4X
150 %token LeftRight "<>"
151 %token LeftSlashRight "</>"
152
153 %token SlashRight "/>"
154 %token LeftSlash "</"
155
156 %token ColonColon "::"
157 %token PeriodPeriod ".."
158 @end
159
160 @begin E4X ObjectiveC
161 %token At "@"
162 @end
163
164 %token Ampersand "&"
165 %token AmpersandAmpersand "&&"
166 %token AmpersandEqual "&="
167 %token Carrot "^"
168 %token CarrotEqual "^="
169 %token Equal "="
170 %token EqualEqual "=="
171 %token EqualEqualEqual "==="
172 %token EqualRight "=>"
173 %token Exclamation "!"
174 %token ExclamationEqual "!="
175 %token ExclamationEqualEqual "!=="
176 %token Hyphen "-"
177 %token HyphenEqual "-="
178 %token HyphenHyphen "--"
179 %token HyphenHyphen_ "\n--"
180 %token HyphenRight "->"
181 %token Left "<"
182 %token LeftEqual "<="
183 %token LeftLeft "<<"
184 %token LeftLeftEqual "<<="
185 %token Percent "%"
186 %token PercentEqual "%="
187 %token Period "."
188 %token PeriodPeriodPeriod "..."
189 %token Pipe "|"
190 %token PipeEqual "|="
191 %token PipePipe "||"
192 %token Plus "+"
193 %token PlusEqual "+="
194 %token PlusPlus "++"
195 %token PlusPlus_ "\n++"
196 %token Right ">"
197 %token RightEqual ">="
198 %token RightRight ">>"
199 %token RightRightEqual ">>="
200 %token RightRightRight ">>>"
201 %token RightRightRightEqual ">>>="
202 %token Slash "/"
203 %token SlashEqual "/="
204 %token Star "*"
205 %token StarEqual "*="
206 %token Tilde "~"
207
208 %token Colon ":"
209 %token Comma ","
210 %token Question "?"
211 %token SemiColon ";"
212 %token NewLine "\n"
213
214 %token <comment_> Comment
215
216 %token OpenParen "("
217 %token CloseParen ")"
218
219 %token OpenBrace "{"
220 %token OpenBrace_ "\n{"
221 %token OpenBrace__ ";{"
222 %token CloseBrace "}"
223
224 %token OpenBracket "["
225 %token CloseBracket "]"
226
227 %token AtError "@error"
228
229 @begin Java
230 %token AtClass "@class"
231 @end
232
233 @begin C
234 %token <identifier_> Typedef "typedef"
235 @end
236
237 @begin ObjectiveC
238 %token AtImplementation "@implementation"
239 %token AtImplementation_ ";@implementation"
240 %token AtImport "@import"
241 %token AtEncode "@encode"
242 %token AtEnd "@end"
243 %token AtSelector "@selector"
244 @end
245
246 %token <false_> False "false"
247 %token <null_> Null "null"
248 %token <true_> True "true"
249
250 // ES3/ES5/WIE/JSC Reserved
251 %token <word_> Auto "auto"
252 %token <word_> Break "break"
253 %token <word_> Case "case"
254 %token <word_> Catch "catch"
255 %token <word_> Continue "continue"
256 %token <word_> Default "default"
257 %token <word_> Delete "delete"
258 %token <word_> Do "do"
259 %token <word_> Else "else"
260 %token <word_> Finally "finally"
261 %token <word_> For "for"
262 %token <word_> Function "function"
263 %token <word_> Function_ ";function"
264 %token <word_> If "if"
265 %token <word_> In "in"
266 %token <word_> In_ "!in"
267 %token <word_> InstanceOf "instanceof"
268 %token <word_> New "new"
269 %token <word_> Return "return"
270 %token <word_> Switch "switch"
271 %token <this_> This "this"
272 %token <word_> Throw "throw"
273 %token <word_> Try "try"
274 %token <word_> TypeOf "typeof"
275 %token <word_> Var "var"
276 %token <word_> Void "void"
277 %token <word_> While "while"
278 %token <word_> With "with"
279
280 // ES3/IE6 Future, ES5/JSC Reserved
281 %token <word_> Debugger "debugger"
282
283 // ES3/ES5/IE6 Future, JSC Reserved
284 %token <word_> Const "const"
285
286 // ES3/ES5/IE6/JSC Future
287 %token <word_> Class "class"
288 %token <word_> Enum "enum"
289 %token <word_> Export "export"
290 %token <word_> Extends "extends"
291 %token <word_> Import "import"
292 %token <word_> Super "super"
293
294 // ES3 Future, ES5 Strict Future
295 %token <identifier_> Implements "implements"
296 %token <identifier_> Interface "interface"
297 %token <identifier_> Package "package"
298 %token <identifier_> Private "private"
299 %token <identifier_> Protected "protected"
300 %token <identifier_> Public "public"
301 %token <identifier_> Static "static"
302
303 // ES3 Future
304 %token <identifier_> Abstract "abstract"
305 %token <identifier_> Boolean "boolean"
306 %token <identifier_> Byte "byte"
307 %token <identifier_> Char "char"
308 %token <identifier_> Double "double"
309 %token <identifier_> Final "final"
310 %token <identifier_> Float "float"
311 %token <identifier_> Goto "goto"
312 %token <identifier_> Int "int"
313 %token <identifier_> Long "long"
314 %token <identifier_> Native "native"
315 %token <identifier_> Short "short"
316 %token <identifier_> Synchronized "synchronized"
317 %token <identifier_> Throws "throws"
318 %token <identifier_> Transient "transient"
319 %token <identifier_> Volatile "volatile"
320
321 // ES5 Strict
322 %token <identifier_> Let "let"
323 %token <identifier_> Yield "yield"
324
325 // Woah?!
326 %token <identifier_> Each "each"
327 %token <identifier_> Of "of"
328
329 @begin E4X
330 // E4X Conditional
331 %token <identifier_> Namespace "namespace"
332 %token <identifier_> XML "xml"
333 @end
334
335 %token AutoComplete
336
337 %token <identifier_> Identifier_
338 %token <number_> NumericLiteral
339 %token <string_> StringLiteral
340 %token <literal_> RegularExpressionLiteral
341
342 %type <expression_> AdditiveExpression
343 %type <argument_> ArgumentList_
344 %type <argument_> ArgumentList
345 %type <argument_> ArgumentListOpt
346 %type <argument_> Arguments
347 %type <literal_> ArrayLiteral
348 %type <expression_> ArrowFunction
349 %type <functionParameter_> ArrowParameters
350 %type <expression_> AssignmentExpression
351 %type <identifier_> Binding
352 %type <identifier_> BindingIdentifier
353 %type <expression_> BitwiseANDExpression
354 %type <statement_> Block_
355 %type <statement_> Block
356 %type <boolean_> BooleanLiteral
357 %type <declaration_> BindingElement
358 %type <expression_> BitwiseORExpression
359 %type <expression_> BitwiseXORExpression
360 %type <statement_> BreakStatement
361 %type <statement_> BreakableStatement
362 %type <expression_> CallExpression_
363 %type <expression_> CallExpression
364 %type <clause_> CaseBlock
365 %type <clause_> CaseClause
366 %type <clause_> CaseClausesOpt
367 %type <catch_> CatchOpt
368 %type <comprehension_> ComprehensionForList
369 %type <comprehension_> ComprehensionForListOpt
370 %type <comprehension_> ComprehensionList
371 %type <comprehension_> ComprehensionListOpt
372 %type <expression_> ConditionalExpression
373 %type <statement_> ContinueStatement
374 %type <statement_> ConciseBody
375 %type <statement_> DebuggerStatement
376 %type <statement_> Declaration__
377 %type <statement_> Declaration_
378 %type <statement_> Declaration
379 %type <clause_> DefaultClause
380 %type <expression_> Element
381 %type <expression_> ElementOpt
382 %type <element_> ElementList
383 %type <element_> ElementListOpt
384 %type <statement_> ElseStatementOpt
385 %type <statement_> EmptyStatement
386 %type <expression_> EqualityExpression
387 %type <compound_> Expression_
388 %type <compound_> Expression
389 %type <expression_> ExpressionOpt
390 %type <statement_> ExpressionStatement
391 %type <finally_> FinallyOpt
392 %type <comprehension_> ForComprehension
393 %type <for_> ForStatementInitialiser
394 %type <forin_> ForInStatementInitialiser
395 %type <declaration_> FormalParameter
396 %type <functionParameter_> FormalParameterList_
397 %type <functionParameter_> FormalParameterList
398 %type <functionParameter_> FormalParameterListOpt
399 %type <statement_> FunctionBody
400 %type <statement_> FunctionDeclaration
401 %type <expression_> FunctionExpression
402 %type <identifier_> Identifier
403 %type <identifier_> IdentifierOpt
404 %type <word_> IdentifierName
405 %type <comprehension_> IfComprehension
406 %type <statement_> IfStatement
407 %type <expression_> Initialiser
408 %type <expression_> InitialiserOpt
409 %type <statement_> IterationStatement
410 %type <statement_> LabelledStatement
411 %type <expression_> LeftHandSideExpression
412 %type <statement_> LetStatement
413 %type <statement_> LexicalDeclaration
414 %type <literal_> Literal
415 %type <literal_> ValueLiteral
416 %type <expression_> LogicalANDExpression
417 %type <expression_> LogicalORExpression
418 %type <member_> MemberAccess
419 %type <expression_> MemberExpression_
420 %type <expression_> MemberExpression
421 %type <expression_> MultiplicativeExpression
422 %type <expression_> NewExpression
423 %type <null_> NullLiteral
424 %type <literal_> ObjectLiteral
425 %type <compound_> Parenthetical
426 %type <compound_> ParentheticalOpt
427 %type <expression_> PostfixExpression
428 %type <expression_> PrimaryExpression
429 %type <statement_> Program
430 %type <statement_> ProgramBody
431 %type <statement_> ProgramBodyOpt
432 %type <propertyName_> PropertyName_
433 %type <propertyName_> PropertyName
434 %type <property_> PropertyDefinition
435 %type <property_> PropertyDefinitionList_
436 %type <property_> PropertyDefinitionList
437 %type <property_> PropertyDefinitionListOpt
438 %type <expression_> RelationalExpression
439 %type <statement_> ReturnStatement
440 %type <rubyProc_> RubyProcExpression
441 %type <functionParameter_> RubyProcParameterList_
442 %type <functionParameter_> RubyProcParameterList
443 %type <functionParameter_> RubyProcParameters
444 %type <functionParameter_> RubyProcParametersOpt
445 %type <expression_> ShiftExpression
446 %type <declaration_> SingleNameBinding
447 %type <statement_> Statement__
448 %type <statement_> Statement_
449 %type <statement_> Statement
450 %type <statement_> StatementList
451 %type <statement_> StatementListOpt
452 %type <statement_> StatementListItem
453 %type <statement_> SwitchStatement
454 %type <statement_> ThrowStatement
455 %type <statement_> TryStatement
456 %type <expression_> UnaryExpression_
457 %type <expression_> UnaryExpression
458 %type <declaration_> VariableDeclaration
459 %type <declarations_> VariableDeclarationList_
460 %type <declarations_> VariableDeclarationList
461 %type <statement_> VariableStatement
462 %type <statement_> WithStatement
463 %type <word_> Word
464 %type <word_> WordOpt
465 %type <expression_> Variable
466
467 @begin ObjectiveC
468 %type <typedIdentifier_> ArrayedType
469 %type <expression_> BoxableExpression
470 %type <statement_> CategoryStatement
471 %type <expression_> ClassExpression
472 %type <field_> ClassFieldListOpt
473 %type <field_> ClassFields
474 %type <statement_> ClassStatement
475 %type <expression_> ClassSuperOpt
476 %type <message_> ClassMessageDeclaration
477 %type <message_> ClassMessageDeclarationListOpt
478 %type <className_> ClassName
479 %type <className_> ClassNameOpt
480 %type <protocol_> ClassProtocolListOpt
481 %type <protocol_> ClassProtocols
482 %type <protocol_> ClassProtocolsOpt
483 %type <type_> ConcreteType
484 %type <expression_> EncodedType
485 %type <expression_> MessageExpression
486 %type <messageParameter_> MessageParameter
487 %type <messageParameter_> MessageParameters
488 %type <messageParameter_> MessageParameterList
489 %type <messageParameter_> MessageParameterListOpt
490 %type <bool_> MessageScope
491 %type <type_> ModifiedType_
492 %type <type_> ModifiedType
493 %type <typedIdentifier_> PrefixedType
494 %type <expression_> PrimitiveType
495 %type <argument_> SelectorCall_
496 %type <argument_> SelectorCall
497 %type <selector_> SelectorExpression_
498 %type <selector_> SelectorExpression
499 %type <selector_> SelectorExpressionOpt
500 %type <argument_> SelectorList
501 %type <word_> SelectorWordOpt
502 %type <typedIdentifier_> SuffixedType
503 %type <expression_> TypeOpt
504 %type <typedIdentifier_> TypeParenthetical
505 %type <type_> TypeQualifierLeft
506 %type <type_> TypeQualifierRight
507 %type <typedIdentifier_> TypeSignifier
508 %type <typedIdentifier_> TypedIdentifier
509 %type <typedParameter_> TypedParameterList_
510 %type <typedParameter_> TypedParameterList
511 %type <typedParameter_> TypedParameterListOpt
512 %type <argument_> VariadicCall
513 @end
514
515 @begin E4X
516 %type <propertyIdentifier_> PropertyIdentifier_
517 %type <selector_> PropertySelector_
518 %type <selector_> PropertySelector
519 %type <identifier_> QualifiedIdentifier_
520 %type <identifier_> QualifiedIdentifier
521 %type <identifier_> WildcardIdentifier
522 %type <identifier_> XMLComment
523 %type <identifier_> XMLCDATA
524 %type <identifier_> XMLElement
525 %type <identifier_> XMLElementContent
526 %type <identifier_> XMLMarkup
527 %type <identifier_> XMLPI
528
529 %type <attribute_> AttributeIdentifier
530 /* XXX: %type <statement_> DefaultXMLNamespaceStatement */
531 %type <expression_> PropertyIdentifier
532 %type <expression_> XMLListInitialiser
533 %type <expression_> XMLInitialiser
534 @end
535 /* }}} */
536 /* Token Priorities {{{ */
537 %nonassoc ""
538 %left "++" "--"
539
540 %nonassoc "if"
541 %nonassoc "else"
542 /* }}} */
543
544 %start Program
545
546 %%
547
548 /* Lexer State {{{ */
549 LexPushInOn
550 : { driver.in_.push(true); }
551 ;
552
553 LexPushInOff
554 : { driver.in_.push(false); }
555 ;
556
557 LexPopIn
558 : { driver.in_.pop(); }
559 ;
560
561 LexSetRegExp
562 : { driver.SetCondition(CYDriver::RegExpCondition); }
563 ;
564
565 LexNoBrace
566 : { if (yychar == yyempty_) driver.no_.OpenBrace = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; }
567 ;
568
569 LexNoFunction
570 : { if (yychar == yyempty_) driver.no_.Function = true; else if (yychar == token::Function) yychar = token::Function_; }
571 ;
572
573 LexNoAtImplementation :
574 @begin ObjectiveC
575 { if (yychar == yyempty_) driver.no_.AtImplementation = true; else if (yychar == token::AtImplementation) yychar = token::AtImplementation_; }
576 @end
577 ;
578
579 LexSetStatement
580 : LexNoBrace LexNoFunction LexNoAtImplementation
581 ;
582 /* }}} */
583 /* Virtual Tokens {{{ */
584 BRACE
585 : "{"
586 | "\n{"
587 ;
588
589 Var_
590 : "var"
591 ;
592 /* }}} */
593
594 /* 7.6 Identifier Names and Identifiers {{{ */
595 IdentifierName
596 : Word { $$ = $1; }
597 ;
598
599 NewLineOpt
600 : "\n"
601 |
602 ;
603
604 Word
605 : Identifier { $$ = $1; }
606 | "auto" { $$ = $1; }
607 | "break" NewLineOpt { $$ = $1; }
608 | "case" { $$ = $1; }
609 | "catch" { $$ = $1; }
610 | "class" { $$ = $1; }
611 | "const" { $$ = $1; }
612 | "continue" NewLineOpt { $$ = $1; }
613 | "debugger" { $$ = $1; }
614 | "default" { $$ = $1; }
615 | "delete" { $$ = $1; }
616 | "do" { $$ = $1; }
617 | "else" { $$ = $1; }
618 | "enum" { $$ = $1; }
619 | "export" { $$ = $1; }
620 | "extends" { $$ = $1; }
621 | "false" { $$ = $1; }
622 | "finally" { $$ = $1; }
623 /* XXX: | "for" { $$ = $1; } */
624 | "function" { $$ = $1; }
625 | "if" { $$ = $1; }
626 | "import" { $$ = $1; }
627 /* XXX: | "in" { $$ = $1; } */
628 | "!in" { $$ = $1; }
629 /* XXX: | "instanceof" { $$ = $1; } */
630
631 // XXX: as it currently is not an Identifier
632 | "let" { $$ = $1; }
633
634 | "new" { $$ = $1; }
635 | "null" { $$ = $1; }
636 | "return" NewLineOpt { $$ = $1; }
637 | "super" { $$ = $1; }
638 | "switch" { $$ = $1; }
639 | "this" { $$ = $1; }
640 | "throw" NewLineOpt { $$ = $1; }
641 | "true" { $$ = $1; }
642 | "try" { $$ = $1; }
643 | "typeof" { $$ = $1; }
644 | "var" { $$ = $1; }
645 | "void" { $$ = $1; }
646 | "while" { $$ = $1; }
647 | "with" { $$ = $1; }
648 ;
649
650 WordOpt
651 : Word { $$ = $1; }
652 | { $$ = NULL; }
653 ;
654
655 Identifier
656 : Identifier_ { $$ = $1; }
657
658 @begin C
659 | "typedef" { $$ = $1; }
660 @end
661
662 | "implements" { $$ = $1; }
663 | "interface" { $$ = $1; }
664 | "package" { $$ = $1; }
665 | "private" { $$ = $1; }
666 | "protected" { $$ = $1; }
667 | "public" { $$ = $1; }
668 | "static" { $$ = $1; }
669
670 | "abstract" { $$ = $1; }
671 | "boolean" { $$ = $1; }
672 | "byte" { $$ = $1; }
673 | "char" { $$ = $1; }
674 | "double" { $$ = $1; }
675 | "final" { $$ = $1; }
676 | "float" { $$ = $1; }
677 | "goto" { $$ = $1; }
678 | "int" { $$ = $1; }
679 | "long" { $$ = $1; }
680 | "native" { $$ = $1; }
681 | "short" { $$ = $1; }
682 | "synchronized" { $$ = $1; }
683 | "throws" { $$ = $1; }
684 | "transient" { $$ = $1; }
685 | "volatile" { $$ = $1; }
686
687 // XXX: currently I only have this as Word
688 // | "let" { $$ = $1; }
689
690 | "yield" { $$ = $1; }
691
692 | "each" { $$ = $1; }
693 | "of" { $$ = $1; }
694 ;
695
696 IdentifierOpt
697 : Identifier { $$ = $1; }
698 | { $$ = NULL; }
699 ;
700 /* }}} */
701
702 /* 7.8 Literals {{{ */
703 Literal
704 : NullLiteral { $$ = $1; }
705 | ValueLiteral { $$ = $1; }
706 ;
707
708 ValueLiteral
709 : BooleanLiteral { $$ = $1; }
710 | NumericLiteral { $$ = $1; }
711 | StringLiteral { $$ = $1; }
712 | RegularExpressionLiteral { $$ = $1; }
713 ;
714 /* }}} */
715 /* 7.8.1 Null Literals {{{ */
716 NullLiteral
717 : "null" { $$ = $1; }
718 ;
719 /* }}} */
720 /* 7.8.2 Boolean Literals {{{ */
721 BooleanLiteral
722 : "true" { $$ = $1; }
723 | "false" { $$ = $1; }
724 ;
725 /* }}} */
726
727 /* 7.9 Automatic Semicolon Insertion {{{ */
728 StrictSemi
729 : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); }
730 ;
731
732 Terminator
733 : ";"
734 | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi
735 ;
736
737 TerminatorOpt
738 : ";"
739 | error { yyerrok; driver.errors_.pop_back(); } StrictSemi
740 ;
741 /* }}} */
742
743 /* 11.1 Primary Expressions {{{ */
744 Parenthetical
745 : "(" LexPushInOff Expression ")" LexPopIn { $$ = $3; }
746 ;
747
748 ParentheticalOpt
749 : Parenthetical { $$ = $1; }
750 | { $$ = NULL; }
751 ;
752
753 Variable
754 : Identifier { $$ = CYNew CYVariable($1); }
755 ;
756
757 PrimaryExpression
758 : "this" { $$ = $1; }
759 | Variable { $$ = $1; }
760 | Literal { $$ = $1; }
761 | ArrayLiteral { $$ = $1; }
762 | ObjectLiteral { $$ = $1; }
763 | Parenthetical { $$ = $1; }
764 | AutoComplete { driver.mode_ = CYDriver::AutoPrimary; YYACCEPT; }
765 ;
766 /* }}} */
767 /* 11.1.4.1 Array Initialiser {{{ */
768 ArrayLiteral
769 : "[" LexPushInOff ElementListOpt "]" LexPopIn { $$ = CYNew CYArray($3); }
770 ;
771
772 Element
773 : AssignmentExpression { $$ = $1; }
774 ;
775
776 ElementOpt
777 : Element { $$ = $1; }
778 | LexSetRegExp { $$ = NULL; }
779 ;
780
781 ElementList
782 : ElementOpt "," ElementListOpt { $$ = CYNew CYElement($1, $3); }
783 | Element { $$ = CYNew CYElement($1, NULL); }
784 ;
785
786 ElementListOpt
787 : ElementList { $$ = $1; }
788 | LexSetRegExp { $$ = NULL; }
789 ;
790 /* }}} */
791 /* 11.1.4.2 Array Comprehension {{{ */
792 PrimaryExpression
793 : "[" LexPushInOff AssignmentExpression ComprehensionForList "]" LexPopIn { $$ = CYNew CYArrayComprehension($3, $4); }
794 ;
795
796 ComprehensionForList
797 : "for" Binding "in" Expression ComprehensionForListOpt { $$ = CYNew CYForInComprehension($2, $4, $5); }
798 | "for" Binding "of" Expression ComprehensionForListOpt { $$ = CYNew CYForOfComprehension($2, $4, $5); }
799 ;
800
801 ComprehensionForListOpt
802 : ComprehensionForList { $$ = $1; }
803 | "if" Expression { $$ = CYNew CYIfComprehension($2); }
804 | { $$ = NULL; }
805 ;
806 /* }}} */
807 /* 11.1.5 Object Initialiser {{{ */
808 ObjectLiteral
809 : BRACE LexPushInOff PropertyDefinitionListOpt "}" LexPopIn { $$ = CYNew CYObject($3); }
810 ;
811
812 PropertyDefinitionList_
813 : "," PropertyDefinitionList { $$ = $2; }
814 | "," LexSetRegExp { $$ = NULL; }
815 | { $$ = NULL; }
816 ;
817
818 PropertyDefinitionList
819 : PropertyDefinition PropertyDefinitionList_ { $1->SetNext($2); $$ = $1; }
820 ;
821
822 PropertyDefinitionListOpt
823 : PropertyDefinitionList { $$ = $1; }
824 | LexSetRegExp { $$ = NULL; }
825 ;
826
827 PropertyDefinition
828 // XXX: this should be IdentifierName
829 : LexSetRegExp Identifier { $$ = CYNew CYProperty($2, CYNew CYVariable($2)); }
830 | PropertyName ":" AssignmentExpression { $$ = CYNew CYProperty($1, $3); }
831 //| MethodDefinition
832 ;
833
834 PropertyName_
835 : IdentifierName { $$ = $1; }
836 | StringLiteral { $$ = $1; }
837 | NumericLiteral { $$ = $1; }
838 ;
839
840 PropertyName
841 : LexSetRegExp PropertyName_ { $$ = $2; }
842 ;
843 /* }}} */
844
845 /* 11.2 Left-Hand-Side Expressions {{{ */
846 MemberAccess
847 : "[" LexPushInOff Expression "]" LexPopIn { $$ = CYNew CYDirectMember(NULL, $3); }
848 | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); }
849 | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
850 ;
851
852 MemberExpression_
853 : MemberExpression { $$ = $1; }
854 //| "super" { $$ = $1; }
855 ;
856
857 MemberExpression
858 : LexSetRegExp PrimaryExpression { $$ = $2; }
859 | LexSetRegExp FunctionExpression { $$ = $2; }
860 | MemberExpression_ { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
861 | LexSetRegExp "new" MemberExpression Arguments { $$ = CYNew cy::Syntax::New($3, $4); }
862 ;
863
864 NewExpression
865 : MemberExpression { $$ = $1; }
866 | LexSetRegExp "new" NewExpression { $$ = CYNew cy::Syntax::New($3, NULL); }
867 ;
868
869 CallExpression_
870 : MemberExpression_
871 | CallExpression
872 ;
873
874 CallExpression
875 : CallExpression_ Arguments { $$ = CYNew CYCall($1, $2); }
876 | CallExpression { driver.context_ = $1; } MemberAccess { $3->SetLeft($1); $$ = $3; }
877 ;
878
879 Arguments
880 : "(" LexPushInOff ArgumentListOpt ")" LexPopIn { $$ = $3; }
881 ;
882
883 ArgumentList_
884 : "," ArgumentList { $$ = $2; }
885 | { $$ = NULL; }
886 ;
887
888 ArgumentList
889 : AssignmentExpression ArgumentList_ { $$ = CYNew CYArgument(NULL, $1, $2); }
890 ;
891
892 ArgumentListOpt
893 : ArgumentList { $$ = $1; }
894 | LexSetRegExp { $$ = NULL; }
895 ;
896
897 LeftHandSideExpression
898 : NewExpression { $$ = $1; }
899 | CallExpression { $$ = $1; }
900 ;
901 /* }}} */
902 /* 11.3 Postfix Expressions {{{ */
903 PostfixExpression
904 : %prec "" LeftHandSideExpression { $$ = $1; }
905 | LeftHandSideExpression "++" { $$ = CYNew CYPostIncrement($1); }
906 | LeftHandSideExpression "--" { $$ = CYNew CYPostDecrement($1); }
907 ;
908 /* }}} */
909 /* 11.4 Unary Operators {{{ */
910 UnaryExpression_
911 : "delete" UnaryExpression { $$ = CYNew CYDelete($2); }
912 | "void" UnaryExpression { $$ = CYNew CYVoid($2); }
913 | "typeof" UnaryExpression { $$ = CYNew CYTypeOf($2); }
914 | "++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
915 | "\n++" UnaryExpression { $$ = CYNew CYPreIncrement($2); }
916 | "--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
917 | "\n--" UnaryExpression { $$ = CYNew CYPreDecrement($2); }
918 | "+" UnaryExpression { $$ = CYNew CYAffirm($2); }
919 | "-" UnaryExpression { $$ = CYNew CYNegate($2); }
920 | "~" UnaryExpression { $$ = CYNew CYBitwiseNot($2); }
921 | "!" UnaryExpression { $$ = CYNew CYLogicalNot($2); }
922 ;
923
924 UnaryExpression
925 : PostfixExpression { $$ = $1; }
926 | LexSetRegExp UnaryExpression_ { $$ = $2; }
927 ;
928 /* }}} */
929 /* 11.5 Multiplicative Operators {{{ */
930 MultiplicativeExpression
931 : UnaryExpression { $$ = $1; }
932 | MultiplicativeExpression "*" UnaryExpression { $$ = CYNew CYMultiply($1, $3); }
933 | MultiplicativeExpression "/" UnaryExpression { $$ = CYNew CYDivide($1, $3); }
934 | MultiplicativeExpression "%" UnaryExpression { $$ = CYNew CYModulus($1, $3); }
935 ;
936 /* }}} */
937 /* 11.6 Additive Operators {{{ */
938 AdditiveExpression
939 : MultiplicativeExpression { $$ = $1; }
940 | AdditiveExpression "+" MultiplicativeExpression { $$ = CYNew CYAdd($1, $3); }
941 | AdditiveExpression "-" MultiplicativeExpression { $$ = CYNew CYSubtract($1, $3); }
942 ;
943 /* }}} */
944 /* 11.7 Bitwise Shift Operators {{{ */
945 ShiftExpression
946 : AdditiveExpression { $$ = $1; }
947 | ShiftExpression "<<" AdditiveExpression { $$ = CYNew CYShiftLeft($1, $3); }
948 | ShiftExpression ">>" AdditiveExpression { $$ = CYNew CYShiftRightSigned($1, $3); }
949 | ShiftExpression ">>>" AdditiveExpression { $$ = CYNew CYShiftRightUnsigned($1, $3); }
950 ;
951 /* }}} */
952 /* 11.8 Relational Operators {{{ */
953 RelationalExpression
954 : ShiftExpression { $$ = $1; }
955 | RelationalExpression "<" ShiftExpression { $$ = CYNew CYLess($1, $3); }
956 | RelationalExpression ">" ShiftExpression { $$ = CYNew CYGreater($1, $3); }
957 | RelationalExpression "<=" ShiftExpression { $$ = CYNew CYLessOrEqual($1, $3); }
958 | RelationalExpression ">=" ShiftExpression { $$ = CYNew CYGreaterOrEqual($1, $3); }
959 | RelationalExpression "instanceof" ShiftExpression { $$ = CYNew CYInstanceOf($1, $3); }
960 | RelationalExpression "in" ShiftExpression { $$ = CYNew CYIn($1, $3); }
961 ;
962 /* }}} */
963 /* 11.9 Equality Operators {{{ */
964 EqualityExpression
965 : RelationalExpression { $$ = $1; }
966 | EqualityExpression "==" RelationalExpression { $$ = CYNew CYEqual($1, $3); }
967 | EqualityExpression "!=" RelationalExpression { $$ = CYNew CYNotEqual($1, $3); }
968 | EqualityExpression "===" RelationalExpression { $$ = CYNew CYIdentical($1, $3); }
969 | EqualityExpression "!==" RelationalExpression { $$ = CYNew CYNotIdentical($1, $3); }
970 ;
971 /* }}} */
972 /* 11.10 Binary Bitwise Operators {{{ */
973 BitwiseANDExpression
974 : EqualityExpression { $$ = $1; }
975 | BitwiseANDExpression "&" EqualityExpression { $$ = CYNew CYBitwiseAnd($1, $3); }
976 ;
977
978 BitwiseXORExpression
979 : BitwiseANDExpression { $$ = $1; }
980 | BitwiseXORExpression "^" BitwiseANDExpression { $$ = CYNew CYBitwiseXOr($1, $3); }
981 ;
982
983 BitwiseORExpression
984 : BitwiseXORExpression { $$ = $1; }
985 | BitwiseORExpression "|" BitwiseXORExpression { $$ = CYNew CYBitwiseOr($1, $3); }
986 ;
987 /* }}} */
988 /* 11.11 Binary Logical Operators {{{ */
989 LogicalANDExpression
990 : BitwiseORExpression { $$ = $1; }
991 | LogicalANDExpression "&&" BitwiseORExpression { $$ = CYNew CYLogicalAnd($1, $3); }
992 ;
993
994 LogicalORExpression
995 : LogicalANDExpression { $$ = $1; }
996 | LogicalORExpression "||" LogicalANDExpression { $$ = CYNew CYLogicalOr($1, $3); }
997 ;
998 /* }}} */
999 /* 11.12 Conditional Operator ( ? : ) {{{ */
1000 ConditionalExpression
1001 : LogicalORExpression { $$ = $1; }
1002 | LogicalORExpression "?" LexPushInOff AssignmentExpression ":" LexPopIn AssignmentExpression { $$ = CYNew CYCondition($1, $4, $7); }
1003 ;
1004 /* }}} */
1005 /* 11.13 Assignment Operators {{{ */
1006 AssignmentExpression
1007 : ConditionalExpression { $$ = $1; }
1008 | ArrowFunction { $$ = $1; }
1009 | LeftHandSideExpression "=" AssignmentExpression { $$ = CYNew CYAssign($1, $3); }
1010 | LeftHandSideExpression "*=" AssignmentExpression { $$ = CYNew CYMultiplyAssign($1, $3); }
1011 | LeftHandSideExpression "/=" AssignmentExpression { $$ = CYNew CYDivideAssign($1, $3); }
1012 | LeftHandSideExpression "%=" AssignmentExpression { $$ = CYNew CYModulusAssign($1, $3); }
1013 | LeftHandSideExpression "+=" AssignmentExpression { $$ = CYNew CYAddAssign($1, $3); }
1014 | LeftHandSideExpression "-=" AssignmentExpression { $$ = CYNew CYSubtractAssign($1, $3); }
1015 | LeftHandSideExpression "<<=" AssignmentExpression { $$ = CYNew CYShiftLeftAssign($1, $3); }
1016 | LeftHandSideExpression ">>=" AssignmentExpression { $$ = CYNew CYShiftRightSignedAssign($1, $3); }
1017 | LeftHandSideExpression ">>>=" AssignmentExpression { $$ = CYNew CYShiftRightUnsignedAssign($1, $3); }
1018 | LeftHandSideExpression "&=" AssignmentExpression { $$ = CYNew CYBitwiseAndAssign($1, $3); }
1019 | LeftHandSideExpression "^=" AssignmentExpression { $$ = CYNew CYBitwiseXOrAssign($1, $3); }
1020 | LeftHandSideExpression "|=" AssignmentExpression { $$ = CYNew CYBitwiseOrAssign($1, $3); }
1021 ;
1022 /* }}} */
1023 /* 11.14 Comma Operator {{{ */
1024 Expression_
1025 : "," Expression { $$ = $2; }
1026 | { $$ = CYNew CYCompound(); }
1027 ;
1028
1029 Expression
1030 : AssignmentExpression Expression_ { $2->AddPrev($1); $$ = $2; }
1031 ;
1032
1033 ExpressionOpt
1034 : Expression { $$ = $1; }
1035 | LexSetRegExp { $$ = NULL; }
1036 ;
1037 /* }}} */
1038
1039 /* 12 Statements {{{ */
1040 Statement__
1041 : Block { $$ = $1; }
1042 | VariableStatement { $$ = $1; }
1043 | EmptyStatement { $$ = $1; }
1044 | IfStatement { $$ = $1; }
1045 | BreakableStatement { $$ = $1; }
1046 | ContinueStatement { $$ = $1; }
1047 | BreakStatement { $$ = $1; }
1048 | ReturnStatement { $$ = $1; }
1049 | WithStatement { $$ = $1; }
1050 | LabelledStatement { $$ = $1; }
1051 | ThrowStatement { $$ = $1; }
1052 | TryStatement { $$ = $1; }
1053 | DebuggerStatement { $$ = $1; }
1054 ;
1055
1056 Statement_
1057 : LexSetRegExp Statement__ { $$ = $2; }
1058 | ExpressionStatement { $$ = $1; }
1059 ;
1060
1061 Statement
1062 : LexSetStatement Statement_ { $$ = $2; }
1063 ;
1064
1065 Declaration__
1066 : FunctionDeclaration { $$ = $1; }
1067 | LexicalDeclaration { $$ = $1; }
1068 ;
1069
1070 Declaration_
1071 : LexSetRegExp Declaration__ { $$ = $2; }
1072 ;
1073
1074 Declaration
1075 : LexSetStatement Declaration_ { $$ = $2; }
1076 ;
1077
1078 BreakableStatement
1079 : IterationStatement { $$ = $1; }
1080 | SwitchStatement { $$ = $1; }
1081 ;
1082 /* }}} */
1083 /* 12.1 Block {{{ */
1084 Block_
1085 : BRACE StatementListOpt "}" { $$ = $2; }
1086 ;
1087
1088 Block
1089 : ";{" StatementListOpt "}" { $$ = CYNew CYBlock($2); }
1090 ;
1091
1092 StatementList
1093 : StatementListItem StatementListOpt { $1->SetNext($2); $$ = $1; }
1094 ;
1095
1096 StatementListOpt
1097 : StatementList { $$ = $1; }
1098 | LexSetStatement LexSetRegExp { $$ = NULL; }
1099 ;
1100
1101 StatementListItem
1102 : Statement { $$ = $1; }
1103 | Declaration { $$ = $1; }
1104 ;
1105 /* }}} */
1106
1107 /* 12.2 Declarations {{{ */
1108 BindingIdentifier
1109 : Identifier { $$ = $1; }
1110 ;
1111
1112 Binding
1113 : BindingIdentifier
1114 ;
1115
1116 // XXX: BindingPattern
1117 /* }}} */
1118 /* 12.2.1 Let and Const Declarations {{{ */
1119 LexicalDeclaration
1120 : LetOrConst VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1121 ;
1122
1123 LetOrConst
1124 : "let"
1125 | "const"
1126 ;
1127 /* }}} */
1128 /* 12.2.2 Variable Statement {{{ */
1129 VariableStatement
1130 : Var_ VariableDeclarationList Terminator { $$ = CYNew CYVar($2); }
1131 ;
1132
1133 VariableDeclarationList_
1134 : "," VariableDeclarationList { $$ = $2; }
1135 | { $$ = NULL; }
1136 ;
1137
1138 VariableDeclarationList
1139 : VariableDeclaration VariableDeclarationList_ { $$ = CYNew CYDeclarations($1, $2); }
1140 ;
1141
1142 VariableDeclaration
1143 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1144 // XXX: | BindingPattern Initialiser { $$ = CYNew CYDeclaration($1, $2); }
1145 ;
1146
1147 Initialiser
1148 : "=" AssignmentExpression { $$ = $2; }
1149 ;
1150
1151 InitialiserOpt
1152 : Initialiser { $$ = $1; }
1153 | { $$ = NULL; }
1154 ;
1155 /* }}} */
1156 /* 12.2.4 Destructuring Binding Patterns {{{ */
1157 // XXX: *
1158
1159 BindingElement
1160 : SingleNameBinding { $$ = $1; }
1161 ;
1162
1163 SingleNameBinding
1164 : BindingIdentifier InitialiserOpt { $$ = CYNew CYDeclaration($1, $2); }
1165 ;
1166 /* }}} */
1167
1168 /* 12.3 Empty Statement {{{ */
1169 EmptyStatement
1170 : ";" { $$ = CYNew CYEmpty(); }
1171 ;
1172 /* }}} */
1173 /* 12.4 Expression Statement {{{ */
1174 ExpressionStatement
1175 : Expression Terminator { $$ = CYNew CYExpress($1); }
1176 ;
1177 /* }}} */
1178 /* 12.5 The if Statement {{{ */
1179 ElseStatementOpt
1180 : "else" Statement { $$ = $2; }
1181 | %prec "if" { $$ = NULL; }
1182 ;
1183
1184 IfStatement
1185 : "if" "(" Expression ")" Statement ElseStatementOpt { $$ = CYNew CYIf($3, $5, $6); }
1186 ;
1187 /* }}} */
1188
1189 /* 12.6.1 The do-while Statement {{{ */
1190 IterationStatement
1191 : "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
1192 ;
1193 /* }}} */
1194 /* 12.6.2 The while Statement {{{ */
1195 IterationStatement
1196 : "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
1197 ;
1198 /* }}} */
1199 /* 12.6.3 The for Statement {{{ */
1200 IterationStatement
1201 : "for" "(" LexPushInOn ForStatementInitialiser ";" LexPopIn ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $7, $9, $11); }
1202 ;
1203
1204 ForStatementInitialiser
1205 : ExpressionOpt { $$ = $1; }
1206 | LexSetRegExp Var_ VariableDeclarationList { $$ = CYNew CYForDeclarations($3); }
1207 ;
1208 /* }}} */
1209 /* 12.6.4 The for-in and for-of Statements {{{ */
1210 IterationStatement
1211 : "for" "(" LexPushInOn ForInStatementInitialiser "!in" LexPopIn Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
1212 | "for" "(" LexPushInOn ForInStatementInitialiser "of" LexPopIn Expression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
1213 ;
1214
1215 ForInStatementInitialiser
1216 : LeftHandSideExpression { $$ = $1; }
1217 | LexSetRegExp Var_ VariableDeclaration { $$ = $3; }
1218 ;
1219 /* }}} */
1220
1221 /* 12.7 The continue Statement {{{ */
1222 ContinueStatement
1223 : "continue" "\n" StrictSemi { $$ = CYNew CYContinue(NULL); }
1224 | "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); }
1225 ;
1226 /* }}} */
1227 /* 12.8 The break Statement {{{ */
1228 BreakStatement
1229 : "break" "\n" StrictSemi { $$ = CYNew CYBreak(NULL); }
1230 | "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); }
1231 ;
1232 /* }}} */
1233 /* 12.9 The return Statement {{{ */
1234 ReturnStatement
1235 : "return" LexSetRegExp "\n" StrictSemi { $$ = CYNew CYReturn(NULL); }
1236 | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); }
1237 ;
1238 /* }}} */
1239 /* 12.10 The with Statement {{{ */
1240 WithStatement
1241 : "with" "(" Expression ")" Statement { $$ = CYNew CYWith($3, $5); }
1242 ;
1243 /* }}} */
1244
1245 /* 12.11 The switch Statement {{{ */
1246 SwitchStatement
1247 : "switch" "(" Expression ")" CaseBlock { $$ = CYNew CYSwitch($3, $5); }
1248 ;
1249
1250 CaseBlock
1251 : BRACE CaseClausesOpt "}" { $$ = $2; }
1252 ;
1253
1254 CaseClause
1255 : "case" Expression ":" StatementListOpt { $$ = CYNew CYClause($2, $4); }
1256 ;
1257
1258 CaseClausesOpt
1259 : CaseClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1260 | DefaultClause CaseClausesOpt { $1->SetNext($2); $$ = $1; }
1261 | { $$ = NULL; }
1262 ;
1263
1264 DefaultClause
1265 : "default" ":" StatementListOpt { $$ = CYNew CYClause(NULL, $3); }
1266 ;
1267 /* }}} */
1268 /* 12.12 Labelled Statements {{{ */
1269 LabelledStatement
1270 : Identifier ":" Statement { $$ = CYNew CYLabel($1, $3); }
1271 ;
1272 /* }}} */
1273 /* 12.13 The throw Statement {{{ */
1274 ThrowStatement
1275 : "throw" LexSetRegExp "\n" StrictSemi { YYABORT; }
1276 | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); }
1277 ;
1278 /* }}} */
1279 /* 12.14 The try Statement {{{ */
1280 TryStatement
1281 : "try" Block_ CatchOpt FinallyOpt { $$ = CYNew cy::Syntax::Try($2, $3, $4); }
1282 ;
1283
1284 CatchOpt
1285 : "catch" "(" Identifier ")" Block_ { $$ = CYNew cy::Syntax::Catch($3, $5); }
1286 | { $$ = NULL; }
1287 ;
1288
1289 FinallyOpt
1290 : "finally" Block_ { $$ = CYNew CYFinally($2); }
1291 | { $$ = NULL; }
1292 ;
1293 /* }}} */
1294 /* 12.14 The debugger Statement {{{ */
1295 DebuggerStatement
1296 : "debugger" Terminator { $$ = CYNew CYDebugger(); }
1297 ;
1298 /* }}} */
1299
1300 /* 13.1 Function Definitions {{{ */
1301 FunctionDeclaration
1302 : ";function" Identifier "(" FormalParameterListOpt ")" BRACE FunctionBody "}" { $$ = CYNew CYFunctionStatement($2, $4, $7); }
1303 ;
1304
1305 FunctionExpression
1306 : "function" IdentifierOpt "(" LexPushInOff FormalParameterListOpt ")" LexPopIn BRACE LexPushInOff FunctionBody "}" LexPopIn { $$ = CYNew CYFunctionExpression($2, $5, $10); }
1307 ;
1308
1309 FormalParameterList_
1310 : "," FormalParameterList { $$ = $2; }
1311 | { $$ = NULL; }
1312 ;
1313
1314 FormalParameterList
1315 // XXX: : FunctionRestParameter { $$ = $1; }
1316 : FormalParameter FormalParameterList_ { $$ = CYNew CYFunctionParameter($1, $2); }
1317 ;
1318
1319 FormalParameterListOpt
1320 : FormalParameterList
1321 | { $$ = NULL; }
1322 ;
1323
1324 /* XXX: FunctionRestParameter
1325 : "..." BindingIdentifier { $$ = CYNew CYFunctionRestParameter($2); }
1326 ;*/
1327
1328 FormalParameter
1329 : BindingElement { $$ = $1; }
1330 ;
1331
1332 FunctionBody
1333 : StatementListOpt { $$ = $1; }
1334 ;
1335 /* }}} */
1336 /* 13.2 Arrow Function Definitions {{{ */
1337 ArrowFunction
1338 : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFatArrow($2, $5); }
1339 ;
1340
1341 ArrowParameters
1342 : BindingIdentifier { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1)); }
1343 //| ParentheticalOpt { $$ = $1; }
1344 ;
1345
1346 ConciseBody
1347 : AssignmentExpression { $$ = CYNew CYReturn($1); }
1348 | LexSetRegExp ";{" LexPushInOff FunctionBody "}" LexPopIn { $$ = $4; }
1349 ;
1350 /* }}} */
1351 /* 14 Program {{{ */
1352 Program
1353 : ProgramBodyOpt { driver.program_ = CYNew CYProgram($1); }
1354 ;
1355
1356 ProgramBody
1357 : StatementList { $$ = $1; }
1358 ;
1359
1360 ProgramBodyOpt
1361 : ProgramBody { $$ = $1; }
1362 | LexSetStatement LexSetRegExp { $$ = NULL; }
1363 ;
1364 /* }}} */
1365
1366 @begin ObjectiveC
1367 /* Cycript (Objective-C): Type Encoding {{{ */
1368 TypeParenthetical
1369 : "(" PrefixedType ")" { $$ = $2; }
1370 ;
1371
1372 TypeSignifier
1373 : Identifier { $$ = CYNew CYTypedIdentifier($1); }
1374 | TypeParenthetical
1375 ;
1376
1377 ArrayedType
1378 : ArrayedType "[" NumericLiteral "]" { $$ = $1; CYSetLast($$->type_) = CYNew CYTypeArrayOf($3); }
1379 | TypeSignifier { $$ = $1; }
1380 | { $$ = CYNew CYTypedIdentifier(NULL); }
1381 ;
1382
1383 SuffixedType
1384 : ArrayedType { $$ = $1; }
1385 | TypeParenthetical "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = $1; CYSetLast($$->type_) = CYNew CYTypeFunctionWith($4); }
1386 ;
1387
1388 PrefixedType
1389 : "*" TypeQualifierRight PrefixedType { $$ = $3; CYSetLast($$->type_) = $2; CYSetLast($$->type_) = CYNew CYTypePointerTo(); }
1390 | SuffixedType { $$ = $1; }
1391 ;
1392
1393 TypeQualifierLeft
1394 : "const" TypeQualifierLeft { $$ = CYNew CYTypeConstant(); CYSetLast($$) = $2; }
1395 | { $$ = NULL; }
1396 ;
1397
1398 TypeQualifierRight
1399 : TypeQualifierRight "const" { $$ = CYNew CYTypeConstant($1); }
1400 | { $$ = NULL; }
1401 ;
1402
1403 ConcreteType
1404 : TypeQualifierLeft PrimitiveType TypeQualifierRight { $$ = $3; CYSetLast($$) = $1; CYSetLast($$) = CYNew CYTypeVariable($2); }
1405 ;
1406
1407 PrimitiveType
1408 : Variable { $$ = $1; }
1409 | "void" { $$ = CYNew cy::Syntax::New(CYNew CYVariable(CYNew CYIdentifier("Type")), CYNew CYArgument(CYNew CYString("v"))); }
1410 ;
1411
1412 TypedIdentifier
1413 : ConcreteType PrefixedType { $$ = $2; CYSetLast($$->type_) = $1; }
1414 ;
1415
1416 EncodedType
1417 : TypedIdentifier { $$ = CYNew CYEncodedType($1->type_); }
1418 ;
1419
1420 ModifiedType_
1421 : TypeQualifierLeft PrimitiveType { $$ = $1; CYSetLast($$) = CYNew CYTypeVariable($2); }
1422 | ModifiedType "*" { $$ = CYNew CYTypePointerTo($1); }
1423 ;
1424
1425 ModifiedType
1426 : ModifiedType_ TypeQualifierRight { $$ = $2; CYSetLast($$) = $1; }
1427 ;
1428
1429 PrimaryExpression
1430 : AtEncode "(" EncodedType ")" { $$ = $3; }
1431 ;
1432 /* }}} */
1433 /* Cycript (Objective-C): @class Declaration {{{ */
1434 ClassSuperOpt
1435 /* XXX: why the hell did I choose MemberExpression? */
1436 : ":" LexSetRegExp MemberExpression { $$ = $3; }
1437 | { $$ = NULL; }
1438 ;
1439
1440 ClassFieldListOpt
1441 : Expression Identifier ";" ClassFieldListOpt { $$ = CYNew CYField($1, $2, $4); }
1442 | LexSetRegExp { $$ = NULL; }
1443 ;
1444
1445 ClassFields
1446 : BRACE ClassFieldListOpt "}" { $$ = $2; }
1447 ;
1448
1449 MessageScope
1450 : "+" { $$ = false; }
1451 | "-" { $$ = true; }
1452 ;
1453
1454 TypeOpt
1455 : "(" LexSetRegExp EncodedType ")" { $$ = $3; }
1456 | { $$ = NULL; }
1457 ;
1458
1459 MessageParameter
1460 : Word ":" TypeOpt Identifier { $$ = CYNew CYMessageParameter($1, $3, $4); }
1461 ;
1462
1463 MessageParameterList
1464 : MessageParameter MessageParameterListOpt { $1->SetNext($2); $$ = $1; }
1465 ;
1466
1467 MessageParameterListOpt
1468 : MessageParameterList { $$ = $1; }
1469 | { $$ = NULL; }
1470 ;
1471
1472 MessageParameters
1473 : MessageParameterList { $$ = $1; }
1474 | Word { $$ = CYNew CYMessageParameter($1, NULL, NULL); }
1475 ;
1476
1477 ClassMessageDeclaration
1478 : MessageScope TypeOpt MessageParameters BRACE FunctionBody "}" { $$ = CYNew CYMessage($1, $2, $3, $5); }
1479 ;
1480
1481 ClassMessageDeclarationListOpt
1482 : ClassMessageDeclarationListOpt ClassMessageDeclaration { $2->SetNext($1); $$ = $2; }
1483 | ClassMessageDeclarationListOpt Comment { $$ = $1; }
1484 | { $$ = NULL; }
1485 ;
1486
1487 ClassName
1488 : Identifier { $$ = $1; }
1489 | "(" AssignmentExpression ")" { $$ = $2; }
1490 ;
1491
1492 ClassNameOpt
1493 : ClassName { $$ = $1; }
1494 | { $$ = NULL; }
1495 ;
1496
1497 // XXX: this should be AssignmentExpressionNoRight
1498 ClassProtocols
1499 : ShiftExpression ClassProtocolsOpt { $$ = CYNew CYProtocol($1, $2); }
1500 ;
1501
1502 ClassProtocolsOpt
1503 : "," ClassProtocols { $$ = $2; }
1504 | { $$ = NULL; }
1505 ;
1506
1507 ClassProtocolListOpt
1508 : "<" ClassProtocols ">" { $$ = $2; }
1509 | { $$ = NULL; }
1510 ;
1511
1512 ClassExpression
1513 : "@implementation" LexPushInOff ClassNameOpt ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt "@end" LexPopIn { $$ = CYNew CYClassExpression($3, $4, $5, $6, $7); }
1514 ;
1515
1516 ClassStatement
1517 : ";@implementation" ClassName ClassSuperOpt ClassProtocolListOpt ClassFields ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYClassStatement($2, $3, $4, $5, $6); }
1518 ;
1519
1520 CategoryName
1521 : "(" WordOpt ")"
1522 ;
1523
1524 CategoryStatement
1525 : ";@implementation" ClassName CategoryName ClassMessageDeclarationListOpt "@end" { $$ = CYNew CYCategory($2, $4); }
1526 ;
1527
1528 PrimaryExpression
1529 : ClassExpression { $$ = $1; }
1530 ;
1531
1532 Statement__
1533 : ClassStatement { $$ = $1; }
1534 | CategoryStatement { $$ = $1; }
1535 ;
1536 /* }}} */
1537 /* Cycript (Objective-C): Send Message {{{ */
1538 VariadicCall
1539 : "," AssignmentExpression VariadicCall { $$ = CYNew CYArgument(NULL, $2, $3); }
1540 | { $$ = NULL; }
1541 ;
1542
1543 SelectorWordOpt
1544 : WordOpt { driver.contexts_.back().words_.push_back($1); } { $$ = $1; }
1545 | AutoComplete { driver.mode_ = CYDriver::AutoMessage; YYACCEPT; }
1546 ;
1547
1548 SelectorCall_
1549 : SelectorCall { $$ = $1; }
1550 | VariadicCall { $$ = $1; }
1551 ;
1552
1553 SelectorCall
1554 : SelectorWordOpt ":" AssignmentExpression SelectorCall_ { $$ = CYNew CYArgument($1 ?: CYNew CYBlank(), $3, $4); }
1555 ;
1556
1557 SelectorList
1558 : SelectorCall { $$ = $1; }
1559 | Word { $$ = CYNew CYArgument($1, NULL); }
1560 ;
1561
1562 MessageExpression
1563 : "[" LexPushInOff AssignmentExpression { driver.contexts_.push_back($3); } SelectorList "]" LexPopIn { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
1564 | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList "]" LexPopIn { $$ = CYNew CYSendSuper($6); }
1565 ;
1566
1567 SelectorExpression_
1568 : WordOpt ":" SelectorExpressionOpt { $$ = CYNew CYSelectorPart($1, true, $3); }
1569 ;
1570
1571 SelectorExpression
1572 : SelectorExpression_ { $$ = $1; }
1573 | Word { $$ = CYNew CYSelectorPart($1, false, NULL); }
1574 ;
1575
1576 SelectorExpressionOpt
1577 : SelectorExpression_ { $$ = $1; }
1578 | { $$ = NULL; }
1579 ;
1580
1581 PrimaryExpression
1582 : MessageExpression { $$ = $1; }
1583 | "@selector" "(" LexPushInOff SelectorExpression ")" LexPopIn { $$ = CYNew CYSelector($4); }
1584 ;
1585 /* }}} */
1586 /* Cycript (Objective-C): @import Directive {{{ */
1587 PathName
1588 : "/" PathName
1589 | "." PathName
1590 | Word PathName
1591 |
1592 ;
1593
1594 ImportPath
1595 : "<" PathName ">"
1596 | StringLiteral
1597 ;
1598
1599 StatementListItem
1600 : LexSetStatement LexSetRegExp "@import" ImportPath { $$ = CYNew CYImport(); }
1601 ;
1602 /* }}} */
1603 /* Cycript (Objective-C): Boxed Expressions {{{ */
1604 BoxableExpression
1605 : NullLiteral { $$ = $1; }
1606 | BooleanLiteral { $$ = $1; }
1607 | NumericLiteral { $$ = $1; }
1608 | StringLiteral { $$ = $1; }
1609 | ArrayLiteral { $$ = $1; }
1610 | ObjectLiteral { $$ = $1; }
1611 | Parenthetical { $$ = $1; }
1612 ;
1613
1614 PrimaryExpression
1615 : "@" BoxableExpression { $$ = CYNew CYBox($2); }
1616 ;
1617 /* }}} */
1618 /* Cycript (Objective-C): Block Expressions {{{ */
1619 PrimaryExpression
1620 : "^" ModifiedType "(" LexPushInOff TypedParameterListOpt ")" LexPopIn BRACE LexPushInOff FunctionBody "}" LexPopIn { $$ = CYNew CYObjCBlock($2, $5, $10); }
1621 ;
1622 /* }}} */
1623 @end
1624
1625 @begin C
1626 /* Cycript (C): Pointer Indirection/Addressing {{{ */
1627 LeftHandSideExpression
1628 : LexSetRegExp "*" UnaryExpression { $$ = CYNew CYIndirect($3); }
1629 ;
1630
1631 UnaryExpression_
1632 : "&" UnaryExpression { $$ = CYNew CYAddressOf($2); }
1633 ;
1634
1635 MemberAccess
1636 : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); }
1637 | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); }
1638 | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; }
1639 ;
1640 /* }}} */
1641 /* Cycript (C): auto Compatibility {{{ */
1642 Var_
1643 : "auto"
1644 ;
1645 /* }}} */
1646 /* Cycript (C): Lambda Expressions {{{ */
1647 TypedParameterList_
1648 : "," TypedParameterList { $$ = $2; }
1649 | { $$ = NULL; }
1650 ;
1651
1652 TypedParameterList
1653 : TypedIdentifier TypedParameterList_ { $$ = CYNew CYTypedParameter($1, $2); }
1654 ;
1655
1656 TypedParameterListOpt
1657 : TypedParameterList { $$ = $1; }
1658 | { $$ = NULL; }
1659 ;
1660
1661 PrimaryExpression
1662 : "[" LexPushInOff LexSetRegExp "&" LexSetRegExp "]" LexPopIn "(" LexPushInOff TypedParameterListOpt ")" LexPopIn "->" TypedIdentifier BRACE LexPushInOff FunctionBody "}" LexPopIn { $$ = CYNew CYLambda($14->type_, $10, $17); }
1663 ;
1664 /* }}} */
1665 /* Cycript (C): Type Definitions {{{ */
1666 Statement__
1667 : "typedef" TypedIdentifier Terminator { $$ = CYNew CYTypeDefinition($2); }
1668 ;
1669 /* }}} */
1670 @end
1671
1672 /* YUI: Documentation Comments {{{ */
1673 Statement__
1674 : Comment { $$ = $1; }
1675 ;
1676 /* }}} */
1677
1678 @begin E4X
1679 /* Lexer State {{{ */
1680 LexPushRegExp
1681 : { driver.PushCondition(CYDriver::RegExpCondition); }
1682 ;
1683
1684 LexPushXMLContent
1685 : { driver.PushCondition(CYDriver::XMLContentCondition); }
1686 ;
1687
1688 LexPushXMLTag
1689 : { driver.PushCondition(CYDriver::XMLTagCondition); }
1690 ;
1691
1692 LexPop
1693 : { driver.PopCondition(); }
1694 ;
1695
1696 LexSetXMLContent
1697 : { driver.SetCondition(CYDriver::XMLContentCondition); }
1698 ;
1699
1700 LexSetXMLTag
1701 : { driver.SetCondition(CYDriver::XMLTagCondition); }
1702 ;
1703 /* }}} */
1704 /* Virtual Tokens {{{ */
1705 XMLWhitespaceOpt
1706 : XMLWhitespace
1707 |
1708 ;
1709 /* }}} */
1710
1711 /* 8.1 Context Keywords {{{ */
1712 Identifier
1713 : "namespace" { $$ = $1; }
1714 | "xml" { $$ = $1; }
1715 ;
1716 /* }}} */
1717 /* 8.3 XML Initialiser Input Elements {{{ */
1718 XMLMarkup
1719 : XMLComment { $$ = $1; }
1720 | XMLCDATA { $$ = $1; }
1721 | XMLPI { $$ = $1; }
1722 ;
1723 /* }}} */
1724
1725 /* 11.1 Primary Expressions {{{ */
1726 PrimaryExpression
1727 : PropertyIdentifier { $$ = CYNew CYPropertyVariable($1); }
1728 | XMLInitialiser { $$ = $1; }
1729 | XMLListInitialiser { $$ = $1; }
1730 ;
1731
1732 PropertyIdentifier
1733 : AttributeIdentifier { $$ = $1; }
1734 | QualifiedIdentifier { $$ = $1; }
1735 | WildcardIdentifier { $$ = $1; }
1736 ;
1737 /* }}} */
1738 /* 11.1.1 Attribute Identifiers {{{ */
1739 AttributeIdentifier
1740 : "@" QualifiedIdentifier_ { $$ = CYNew CYAttribute($2); }
1741 ;
1742
1743 PropertySelector_
1744 : PropertySelector { $$ = $1; }
1745 | "[" LexPushInOff Expression "]" LexPopIn { $$ = CYNew CYSelector($3); }
1746 ;
1747
1748 PropertySelector
1749 : Identifier { $$ = CYNew CYSelector($1); }
1750 | WildcardIdentifier { $$ = $1; }
1751 ;
1752 /* }}} */
1753 /* 11.1.2 Qualified Identifiers {{{ */
1754 QualifiedIdentifier_
1755 : PropertySelector_ { $$ = CYNew CYQualified(NULL, $1); }
1756 | QualifiedIdentifier { $$ = $1; }
1757 ;
1758
1759 QualifiedIdentifier
1760 : PropertySelector "::" PropertySelector_ { $$ = CYNew CYQualified($1, $3); }
1761 ;
1762 /* }}} */
1763 /* 11.1.3 Wildcard Identifiers {{{ */
1764 WildcardIdentifier
1765 : "*" { $$ = CYNew CYWildcard(); }
1766 ;
1767 /* }}} */
1768 /* 11.1.4 XML Initialiser {{{ */
1769 XMLInitialiser
1770 : XMLMarkup { $$ = $1; }
1771 | XMLElement { $$ = $1; }
1772 ;
1773
1774 XMLElement
1775 : "<" LexPushInOff XMLTagContent LexPop "/>" LexPopIn
1776 | "<" LexPushInOff XMLTagContent ">" LexSetXMLContent XMLElementContentOpt "</" LexSetXMLTag XMLTagName XMLWhitespaceOpt LexPop ">" LexPopIn
1777 ;
1778
1779 XMLTagContent
1780 : LexPushXMLTag XMLTagName XMLAttributes
1781 ;
1782
1783 XMLExpression
1784 : BRACE LexPushRegExp Expression LexPop "}"
1785 ;
1786
1787 XMLTagName
1788 : XMLExpression
1789 | XMLName
1790 ;
1791
1792 XMLAttributes_
1793 : XMLAttributes_ XMLAttribute
1794 |
1795 ;
1796
1797 XMLAttributes
1798 : XMLAttributes_ XMLWhitespace XMLExpression XMLWhitespaceOpt
1799 | XMLAttributes_ XMLWhitespaceOpt
1800 ;
1801
1802 XMLAttributeValue_
1803 : XMLExpression
1804 | XMLAttributeValue
1805 ;
1806
1807 XMLAttribute
1808 : XMLWhitespace XMLName XMLWhitespaceOpt "=" XMLWhitespaceOpt XMLAttributeValue_
1809 ;
1810
1811 XMLElementContent
1812 : XMLExpression XMLElementContentOpt
1813 | XMLMarkup XMLElementContentOpt
1814 | XMLText XMLElementContentOpt
1815 | XMLElement XMLElementContentOpt
1816 ;
1817
1818 XMLElementContentOpt
1819 : XMLElementContent
1820 |
1821 ;
1822 /* }}} */
1823 /* 11.1.5 XMLList Initialiser {{{ */
1824 XMLListInitialiser
1825 : "<>" LexPushInOff LexPushXMLContent XMLElementContent LexPop "</>" LexPopIn { $$ = CYNew CYXMLList($4); }
1826 ;
1827 /* }}} */
1828
1829 /* 11.2 Left-Hand-Side Expressions {{{ */
1830 PropertyIdentifier_
1831 : Identifier { $$ = $1; }
1832 | PropertyIdentifier { $$ = $1; }
1833 ;
1834
1835 MemberAccess
1836 : "." PropertyIdentifier { $$ = CYNew CYPropertyMember(NULL, $2); }
1837 | ".." PropertyIdentifier_ { $$ = CYNew CYDescendantMember(NULL, $2); }
1838 | "." "(" Expression ")" { $$ = CYNew CYFilteringPredicate(NULL, $3); }
1839 ;
1840 /* }}} */
1841 /* 12.1 The default xml namespace Statement {{{ */
1842 /* XXX: DefaultXMLNamespaceStatement
1843 : "default" "xml" "namespace" "=" Expression Terminator { $$ = CYNew CYDefaultXMLNamespace($5); }
1844 ;
1845
1846 Statement__
1847 : DefaultXMLNamespaceStatement { $$ = $1; }
1848 ; */
1849 /* }}} */
1850 @end
1851
1852 /* JavaScript 1.7: Array Comprehensions {{{ */
1853 IfComprehension
1854 : "if" "(" Expression ")" { $$ = CYNew CYIfComprehension($3); }
1855 ;
1856
1857 ForComprehension
1858 : "for" "(" Identifier "in" Expression ")" { $$ = CYNew CYForInComprehension($3, $5); }
1859 | "for" "each" "(" Identifier "in" Expression ")" { $$ = CYNew CYForOfComprehension($4, $6); }
1860 ;
1861
1862 ComprehensionList
1863 : ForComprehension ComprehensionListOpt { $1->SetNext($2); $$ = $1; }
1864 ;
1865
1866 ComprehensionListOpt
1867 : ComprehensionList { $$ = $1; }
1868 | IfComprehension { $$ = $1; }
1869 | { $$ = NULL; }
1870 ;
1871
1872 PrimaryExpression
1873 : "[" LexPushInOff AssignmentExpression ComprehensionList "]" LexPopIn { $$ = CYNew CYArrayComprehension($3, $4); }
1874 ;
1875 /* }}} */
1876 /* JavaScript 1.7: for each {{{ */
1877 IterationStatement
1878 : "for" "each" "(" LexPushInOn ForInStatementInitialiser "!in" LexPopIn Expression ")" Statement { $$ = CYNew CYForOf($5, $8, $10); }
1879 ;
1880 /* }}} */
1881 /* JavaScript 1.7: let Statements {{{ */
1882 LetStatement
1883 : "let" "(" VariableDeclarationList ")" Statement { $$ = CYNew CYLetStatement($3, $5); }
1884 ;
1885
1886 Statement__
1887 : LetStatement
1888 ;
1889 /* }}} */
1890
1891 /* JavaScript FTW: Ruby Blocks {{{ */
1892 RubyProcParameterList_
1893 : "," RubyProcParameterList { $$ = $2; }
1894 | { $$ = NULL; }
1895 ;
1896
1897 RubyProcParameterList
1898 : Identifier RubyProcParameterList_ { $$ = CYNew CYFunctionParameter(CYNew CYDeclaration($1), $2); }
1899 | { $$ = NULL; }
1900 ;
1901
1902 RubyProcParameters
1903 : "|" RubyProcParameterList "|" { $$ = $2; }
1904 | "||" { $$ = NULL; }
1905 ;
1906
1907 RubyProcParametersOpt
1908 : RubyProcParameters
1909 | { $$ = NULL; }
1910 ;
1911
1912 RubyProcExpression
1913 : "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
1914 ;
1915
1916 PrimaryExpression
1917 : "{" LexPushInOff RubyProcParameters StatementListOpt "}" LexPopIn { $$ = CYNew CYRubyProc($3, $4); }
1918 ;
1919
1920 CallExpression
1921 : CallExpression_ RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }
1922 ;
1923 /* }}} */
1924
1925 %%