RPA Toolkit
258c7d752590cc18a246d15cbb49518f8244d156
[rpatk.git] / rjs / ecma262.rpa
1 #!emitall
2 #!emitnone
3
4
5 #!emit DoKeyword
6 #!emit FunctionCallName
7 #!emit IterationDo
8 #!emit LogicalNotExpressionOp
9 #!emit PostfixExpressionOp
10 #!emit PrefixExpressionOp
11 #!emit dqstring
12 #!emit sqstring
13
14 #!emitid UnaryOperator                                  UID_UNARYOPERATOR                                       1
15 #!emitid AdditiveOperator                               UID_BINARYOPERATOR                                      2
16 #!emitid AdditiveOperator                               UID_ADDITIVEOPERATOR                            2
17 #!emitid MultiplicativeOperator                 UID_MULTIPLICATIVEOPERATOR                      2
18 #!emitid AssignmentOperator                             UID_ASSIGNMENTOPERATOR                          2
19 #!emitid BitwiseANDOperator                             UID_BITWISEANDOPERATOR                          2
20 #!emitid BitwiseNotExpressionOp                 UID_BITWISENOTEXPRESSIONOP                      2
21 #!emitid BitwiseNotOperator                             UID_BITWISENOTOPERATOR                          2
22 #!emitid BitwiseOROperator                              UID_BITWISEOROPERATOR                           2
23 #!emitid BitwiseXOROperator                             UID_BITWISEXOROPERATOR                          2
24 #!emitid LogicalNotOperator                             UID_LOGICALNOTOPERATOR                          2
25 #!emitid LogicalOROperator                              UID_LOGICALOROPERATOR                           2
26 #!emitid LogicalANDOperator                             UID_LOGICALANDOPERATOR                          2
27 #!emitid RelationalOperator                             UID_RELATIONALOPERATOR                          2
28 #!emitid PostfixOperator                                UID_POSTFIXOPERATOR                                     2
29 #!emitid PrefixOperator                                 UID_PREFIXOPERATOR                                      2
30 #!emitid ShiftOperator                                  UID_SHIFTOPERATOR                                       2
31 #!emitid EqualityOperator                               UID_EQUALITYOPERATOR                            2
32 #!emitid Program                                                UID_PROGRAM                                             3
33 #!emitid This                                                   UID_THIS                                                        4
34 #!emitid Expression                                             UID_EXPRESSION                                          5
35 #!emitid LeftHandSideExpression                 UID_LEFTHANDSIDEEXPRESSION                      6
36 #!emitid LeftHandSideExpressionAddr             UID_LEFTHANDSIDEEXPRESSIONADDR          7
37 #!emitid AdditiveExpressionOp                   UID_ADDITIVEEXPRESSIONOP                        8
38 #!emitid MultiplicativeExpressionOp             UID_MULTIPLICATIVEEXPRESSIONOP          9
39 #!emitid BitwiseANDOp                                   UID_BITWISEANDOP                                        10
40 #!emitid BitwiseXOROp                                   UID_BITWISEXOROP                                        11
41 #!emitid BitwiseOROp                                    UID_BITWISEOROP                                         12
42 #!emitid ShiftExpressionOp                              UID_SHIFTEXPRESSIONOP                           13
43 #!emitid EqualityExpressionOp                   UID_EQUALITYEXPRESSIONOP                        14
44 #!emitid RelationalExpressionOp                 UID_RELATIONALEXPRESSIONOP                      15
45 #!emitid LogicalOROp                                    UID_LOGICALOROP                                         16
46 #!emitid LogicalANDOp                                   UID_LOGICALANDOP                                        17
47 #!emitid VariableAllocate                               UID_VARIABLEALLOCATE                            18
48 #!emitid VariableAllocateAndInit                UID_VARIABLEALLOCATEANDINIT                     19
49 #!emitid IdentifierName                                 UID_IDENTIFIERNAME                                      20
50 #!emitid Identifier                                             UID_IDENTIFIER                                          21
51 #!emitid Initialiser                                    UID_INITIALISER                                         22
52 #!emitid AssignmentExpressionOp                 UID_ASSIGNMENTEXPRESSIONOP                      23
53 #!emitid NewArrayExpression                             UID_NEWARRAYEXPRESSION                          24
54 #!emitid MemberExpressionDotOp                  UID_MEMBEREXPRESSIONDOTOP                       25
55 #!emitid MemberExpressionIndexOp                UID_MEMBEREXPRESSIONINDEXOP                     26
56 #!emitid FunctionName                                   UID_FUNCTIONNAME                                        27
57 #!emitid FunctionDeclaration                    UID_FUNCTIONDECLARATION                         28
58 #!emitid FunctionParameter                              UID_FUNCTIONPARAMETER                           29
59 #!emitid FormalParameterList                    UID_FORMALPARAMETERLIST                         30
60 #!emitid CallExpression                                 UID_CALLEXPRESSION                                      31
61 #!emitid FunctionCall                                   UID_FUNCTIONCALL                                        32
62 #!emitid Argument                                               UID_ARGUMENT                                            33
63 #!emitid Arguments                                              UID_ARGUMENTS                                           34
64 #!emitid ReturnStatement                                UID_RETURNSTATEMENT                                     35
65 #!emitid DoubleStringCharacters                 UID_STRINGCHARACTERS                            36
66 #!emitid SingleStringCharacters                 UID_STRINGCHARACTERS                            36
67 #!emitid IfStatement                                    UID_IFSTATEMENT                                         37
68 #!emitid IfConditionOp                                  UID_IFCONDITIONOP                                       38
69 #!emitid IfTrueStatement                                UID_IFTRUESTATEMENT                                     39
70 #!emitid IfFalseStatement                               UID_IFFALSESTATEMENT                            40
71 #!emitid Block                                                  UID_BLOCK                                                       41
72 #!emitid IterationFor                                   UID_ITERATIONFOR                                        42
73 #!emitid ForExpressionInit                              UID_FOREXPRESSIONINIT                           43
74 #!emitid ForExpressionCompare                   UID_FOREXPRESSIONCOMPARE                        44
75 #!emitid ForExpressionIncrement                 UID_FOREXPRESSIONINCREMENT                      45
76 #!emitid ForIterationStatement                  UID_FORITERATIONSTATEMENT                       46
77 #!emitid PostfixExpressionOp                    UID_POSTFIXEXPRESSIONOP                         47
78 #!emitid PrefixExpressionOp                             UID_PREFIXEXPRESSIONOP                          48
79 #!emitid NewExpressionCall                              UID_NEWEXPRESSIONCALL                           49
80 #!emitid FunctionExpression                             UID_FUNCTIONEXPRESSION                          50
81 #!emitid UnaryExpressionOp                              UID_UNARYEXPRESSIONOP                           51
82 #!emitid DecimalIntegerLiteral                  UID_DECIMALINTEGERLITERAL                       52
83 #!emitid DecimalNonIntegerLiteral               UID_DECIMALNONINTEGERLITERAL            53
84 #!emitid BreakStatement                                 UID_BREAKSTATEMENT                                      54
85 #!emitid ContinueStatement                              UID_CONTINUESTATEMENT                           55
86
87
88 # 6 Source Text
89 SourceCharacter                 ::= .
90
91 # 7.2 White space
92 WhiteSpace                              ::= [#0x0009] | [#0x000B] | [#0x000C] | [#0x0020] | [#0x00A0] | [#0xFEFF]
93
94 # 7.3 Line Terminators
95 LineTerminator                  ::= [#0x000D] [#0x000A] | ([#0x000A] | [#0x000D] | [#0x2028] | [#0x2029])
96 LineTerminatorSequence  ::= [#0x000D] [#0x000A] | [#0x000A] | [#0x000D] | [#0x2028] | [#0x2029]
97 S                                               ::= ( <WhiteSpace> | <LineTerminator> )+
98 SC                                              ::= <S>? ';' <S>?
99 COMMA                                   ::= <S>? ',' <S>?
100 EQ                                              ::= <S>? '=' <S>?
101
102 # 7.4 Comments
103 Comment                                 ::= <MultiLineComment> | <SingleLineComment>
104 MultiLineComment                ::= '/*' <MultiLineCommentChar>* '*/'
105 MultiLineCommentChar    ::= . - '*/'
106 SingleLineComment               ::= '#' <SingleLineCommentChar>*
107 SingleLineCommentChar   ::= <SourceCharacter> - <LineTerminator>
108
109 # 7.5 Tokens
110 Token                                   ::= <IdentifierName> |
111                                                 <NumericLiteral> |
112                                                 <StringLiteral>
113
114 # 7.6 Identifier Names and Identifiers
115
116 Identifier                              ::= <IdentifierNameNoEmit> - (<ReservedWord> - <ReservedWord> <IdentifierPart>)
117 IdentifierNoEmit                ::= <IdentifierNameNoEmit> - (<ReservedWord> - <ReservedWord> <IdentifierPart>)
118 IdentifierName                  ::= <IdentifierStart> <IdentifierPart>*
119 IdentifierNameNoEmit    ::= <IdentifierStart> <IdentifierPart>*
120 IdentifierStart                 ::= <UnicodeLetter> | '$' | '_' | '\' <UnicodeLetter>
121 UnicodeLetter                   ::= [#0x0041-#0x005A] | [#0x00C0-#0x00DE] | [#0x0100-#0x0232] | [#0x0061-#0x007A] | [#0x00C0-#0x00DE]       # <Lu> | <Ll>
122
123 Lu                                              ::= [#0x0041-#0x005A] | [#0x00C0-#0x00DE] | [#0x0100-#0x0232]   # TBD
124 Ll                                              ::= [#0x0061-#0x007A] | [#0x00C0-#0x00DE]                                               # TBD
125 IdentifierPart                  ::= <IdentifierStart> | 
126                                                 <UnicodeDigit> 
127 UnicodeDigit                    ::= [0-9] | [#0x0660-#0x0669]                                   # TBD
128
129 ReservedWord                    ::= <NullLiteral> |
130                                                         <BooleanLiteral> |
131                                                         <Keyword> |
132                                                         <FutureReservedWord>
133
134 Keyword                                 ::= 'instanceof' | 'typeof'     | 'break' |
135                                                 'do' | 'new' | 'var' |
136                                                 'case' | 'else' | 'return' | 'void' | 
137                                                 'catch' | 'finally' | 'continue' | 'for' | 
138                                                 'switch' | 'while' | 'this' | 'with' | 
139                                                 'debugger' | 'function' | 'throw' | 'default' |  
140                                                 'if' | 'try' | 'delete' | 'in'
141
142 FutureReservedWord                      ::= 'class' | 'enum' | 'extends' | 'import' | 'const' | 'export' |
143                                                         'implements' | 'let' | 'private' | 'public' |
144                                 'static' | 'interface' | 'package' | 'protected'
145
146 NullLiteral                                     ::= 'null'
147 BooleanLiteral                          ::= 'true' | 'false'
148 Literal                                         ::= <NullLiteral> |
149                                                         <BooleanLiteral> |
150                                                         <NumericLiteral> |
151                                                         <StringLiteral>
152                                                         
153 LiteralOp                                       ::= <Literal>
154
155 # 7.8.3 Numeric Literals
156
157 NumericLiteral                                  ::= <HexIntegerLiteral> | <DecimalNonIntegerLiteral> | <DecimalIntegerLiteral>
158 DecimalNonIntegerLiteral                ::= ('0' | <NonZeroDigit> <DecimalDigits>?) '.' <DecimalDigits>? <ExponentPart>? |
159                                                                 '.' <DecimalDigits> <ExponentPart>? 
160 DecimalIntegerLiteral                   ::= '0' | <NonZeroDigit> <DecimalDigits>? <ExponentPart>?
161 DecimalDigits                                   ::= <DecimalDigit>+
162 DecimalDigit                                    ::= [0-9]
163 NonZeroDigit                                    ::= [1-9]
164 ExponentPart                                    ::= <ExponentIndicator> <SignedInteger>
165 ExponentIndicator                               ::= [eE]
166 SignedInteger                                   ::= '-' <DecimalDigits> |
167                                                                 '+' <DecimalDigits> |
168                                                                 <DecimalDigits>
169 HexIntegerLiteral                               ::= '0' [xX] <HexDigit>+
170 HexDigit                                                ::= [0-9a-fA-F]
171
172 # 7.8.4 String Literals
173 StringLiteral                                   ::= '"' <DoubleStringCharacters>? '"' |
174                                                                 "'" <SingleStringCharacters>? "'"
175
176 DoubleStringCharacters                  ::= <DoubleStringCharacter>+
177 SingleStringCharacters                  ::= <SingleStringCharacter>+
178
179 DoubleStringCharacter                   ::= <SourceCharacter> - ('"' | '\\' | <LineTerminator>)
180
181 SingleStringCharacter                   ::= <SourceCharacter> - ("'" | '\\' | <LineTerminator>)
182 This                                                    ::= 'this'
183
184 PrimaryExpression                               ::= <This> | 
185                                                                 '(' <S>? <Expression> <S>? ')' |
186                                                                 <Literal> |
187                                                                 <Identifier>
188
189
190
191
192 ArrayLiteral                                    ::= '[' <S>? <Elision>? <S>? ']' |
193                                                                 '[' <S>? <ElementList> <S>? ']' |
194                                                                 '[' <S>? <ElementList> <S>? ',' <S>? <Elision> <S>? ']'
195 ElementList                                             ::= <Elision>? <S>? <AssignmentExpression> (<S>? ',' <S>? <Elision>? <S>? <AssignmentExpression> )*
196 Elision                                                 ::= ',' <S>? <Elision> | <S>? ','
197
198
199 # 11.2 Left-Hand-Side Expressions
200 LSB                                                             ::= <S>? '[' <S>?
201 RSB                                                             ::= <S>? ']' <S>?
202 MemberExpressionBase                    ::= <MemberExpression>
203 MemberExpressionIndexOp                 ::= <MemberExpressionBase> <LSB> <Expression> <RSB>
204 MemberExpressionDotOp                   ::= <MemberExpressionBase> '.' <IdentifierName>
205
206 MemberExpression                                ::= <MemberExpressionIndexOp>  |
207                                                                         <MemberExpressionDotOp> |
208                                                                         <FunctionExpression> |
209                                                                         <PrimaryExpression>
210                                                                         
211 NewKeyword                                              ::= 'new' - 'new' <IdentifierPart>
212 NewExpressionCall                               ::= <NewKeyword> <S>? <MemberExpression> <S>? <Arguments>?
213
214 NewExpression                                   ::= <NewExpressionCall> |
215                                                                         <MemberExpression>
216
217 # NewExpression                                         ::= <NewKeyword> <S>? <NewExpression> |
218 #                                                                       <MemberExpression>
219
220
221 FunctionCallName                                ::= <CallExpression> | <MemberExpression>
222 FunctionCall                                    ::= <FunctionCallName> <S>? <Arguments>
223 CallExpression                                  ::= <CallExpression> <S>? '[' <S>? Expression <S>? ']' |
224                                                                         <CallExpression> '.' <IdentifierName> |
225                                                                         <FunctionCall>
226
227 Arguments                                               ::= '(' <S>? ')' |
228                                                                 '(' <S>? <ArgumentList> <S>? ')'
229 Argument                                                ::= <AssignmentExpression>
230 ArgumentList                                    ::= <ArgumentList> <S>? ',' <S>? <Argument> |
231                                                                         <Argument>
232 LeftHandSideExpression                  ::= <CallExpression> | <NewExpression>
233 LeftHandSideExpressionAddr              ::= <CallExpression> | <NewExpression>
234
235
236 # 11.3 Postfix Expressions
237 # RULE: LeftHandSideExpression always ends up in R0 (Let see if this would work)
238 PostfixOperator                                 ::= '++' | '--'
239 PostfixExpressionOp                     ::= <LeftHandSideExpressionAddr> <PostfixOperator>
240 PostfixExpression                               ::= <PostfixExpressionOp> | <LeftHandSideExpression> 
241
242 PrefixOperator                                  ::= '++' | '--'
243 PrefixExpressionOp                              ::= <PrefixOperator> <LeftHandSideExpressionAddr>
244 PrefixExpression                                ::= <PrefixExpressionOp> | <PostfixExpression>
245
246 # 11.4 Unary Operators
247 UnaryOperator                                   ::= '~' | '!' | ('+' - '++') | ('-' - '--') | 'delete' | 'void' | 'typeof'
248 UnaryExpressionOp                       ::=     <S>? <UnaryOperator> <S>? <UnaryExpression>
249 UnaryExpression                         ::=     <UnaryExpressionOp> | <PrefixExpression>
250
251
252 # 11.5 Multiplicative Operators
253 MultiplicativeOperator                  ::= '*' | '/' | '%'
254 MultiplicativeExpressionOp              ::= <MultiplicativeExpression> <S>? <MultiplicativeOperator> <S>? <UnaryExpression>
255 MultiplicativeExpression                ::= <MultiplicativeExpressionOp> | 
256                                                                         <UnaryExpression>
257
258 # 11.6 Additive Operators
259 AdditiveOperator                                ::= '+' | '-'
260 AdditiveExpressionOp                    ::= <AdditiveExpression> <S>? <AdditiveOperator> <S>? <MultiplicativeExpression>
261 AdditiveExpression                              ::= <AdditiveExpressionOp> | 
262                                                                         <MultiplicativeExpression>
263
264
265 11.7 Bitwise Shift Operators
266 ShiftOperator                                   ::= '>>>' | '<<' | '>>'
267 ShiftExpressionOp                               ::= <ShiftExpression> <S>? <ShiftOperator> <S>? <AdditiveExpression>
268 ShiftExpression                                 ::= <ShiftExpressionOp> |
269                                                                 <AdditiveExpression> 
270
271
272 # 11.8 Relational Operators
273 RelationalOperator                              ::= '<=' | '>=' | '<' | '>' | 'instanceof'
274 RelationalExpressionOp                  ::= <RelationalExpression> <S>? <RelationalOperator> <S>? <ShiftExpression>
275 RelationalExpression                    ::= <RelationalExpressionOp> |
276                                                                 <ShiftExpression>
277
278 # 11.9 Equality Operators
279 EqualityOperator                                ::= '===' | '==' | '!==' | '!='
280 EqualityExpressionOp                    ::= <EqualityExpression> <S>? <EqualityOperator> <S>? <RelationalExpression> 
281 EqualityExpression                              ::= <EqualityExpressionOp> |
282                                                                 <RelationalExpression>
283
284 BitwiseANDOperator                              ::= '&' - '&&'
285 BitwiseANDOp                                    ::= <BitwiseANDExpression> <S>? <BitwiseANDOperator> <S>? <EqualityExpression>
286 BitwiseANDExpression                    ::= <BitwiseANDOp> |
287                                                                 <EqualityExpression>
288
289 BitwiseXOROperator                              ::= '^'
290 BitwiseXOROp                                    ::= <BitwiseXORExpression> <S>? <BitwiseXOROperator> <S>? <BitwiseANDExpression>
291 BitwiseXORExpression                    ::= <BitwiseXOROp> |
292                                                                 <BitwiseANDExpression>
293
294 BitwiseOROperator                               ::= '|' - '||'
295 BitwiseOROp                                             ::= <BitwiseORExpression> <S>? <BitwiseOROperator> <S>? <BitwiseXORExpression>
296 BitwiseORExpression                     ::= <BitwiseOROp> |
297                                                                 <BitwiseXORExpression>
298
299 # 11.11 Binary Logical Operators
300 LogicalANDOperator                              ::= '&&'
301 LogicalANDOp                                    ::= <LogicalANDExpression> <S>? <LogicalANDOperator>  <S>? <BitwiseORExpression>
302 LogicalANDExpression                    ::= <LogicalANDOp> |
303                                                                 <BitwiseORExpression>
304
305 LogicalOROperator                               ::= '||'
306 LogicalOROp                                             ::= <LogicalORExpression> <S>? <LogicalOROperator> <S>? <LogicalANDExpression>
307 LogicalORExpression                     ::= <LogicalOROp> |
308                                                                 <LogicalANDExpression>
309
310
311 # 11.12 Conditional Operator ( ? : )
312 ConditionalExpression                   ::= <LogicalORExpression> ( <S>? '?' <S>? <AssignmentExpression> <S>? ':' <S>? <AssignmentExpression> )?
313
314 # 11.13 Assignment Operators
315 AssignmentExpressionOp                  ::= <LeftHandSideExpressionAddr> <S>? <AssignmentOperator> <S>? <AssignmentExpression>
316 AssignmentExpression                    ::= <AssignmentExpressionOp> | <ConditionalExpression>
317 AssignmentOperator                              ::= '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '>>>=' | '&=' | '^=' | '|='
318
319
320 # 11.14 Comma Operator  ( , )
321 Expression                                      ::= <AssignmentExpression> ( <S>? ',' <S>? <AssignmentExpression> )*
322
323
324 # 12 Statements
325 Statement                                               ::= <FunctionDeclarationStatement> |
326                                                                 <ExpressionStatement> |
327                                                                         <ContinueStatement> |
328                                                                         <Block> |
329                                                                 <Comment> |
330                                                                 <VariableStatement> |
331                                                                 <EmptyStatement> |
332                                                                 <IfStatement> |
333                                                                 <IterationStatement> |
334                                                                 <ContinueStatement> |
335                                                                 <BreakStatement> |
336                                                                 <ReturnStatement> |
337                                                                 <WithStatement> |
338                                                                 <SwitchStatementOp>
339
340 # 12.1 Block
341 Block                                                           ::= <S>? '{' <S>? <StatementList>? <S>? '}' <S>?
342 StatementList                                           ::= (<S>? <Statement>)+
343
344 # 12.2 Variable Statement
345 VariableStatement                                       ::= 'var' <S>? <VariableDeclarationList> <SC>
346 VariableDeclarationList                         ::= <VariableDeclaration> (<COMMA> <VariableDeclaration> )*
347 VariableAllocate                                        ::= <IdentifierNoEmit>
348 VariableAllocateAndInit                         ::= <IdentifierNoEmit>
349 VariableDeclaration                                     ::= <VariableAllocateAndInit> <Initialiser> | <VariableAllocate>
350 Initialiser                                                     ::= <EQ> <AssignmentExpression>
351
352
353 # 12.3 Empty Statement
354 EmptyStatement                                          ::= <SC>
355
356 # 12.4 Expression Statement
357 ExpressionStatement                             ::= (<Expression> - ('function' | '{')) <SC>
358
359
360 # 12.5 The if Statement
361 IfConditionOp                                           ::= 'if' <S>? '(' <S>? <Expression> <S>? ')'
362 IfTrueStatement                                         ::= <Statement>
363 IfFalseStatement                                        ::= <Statement>
364 IfStatement                                                     ::= <IfConditionOp> <S>? <IfTrueStatement> <S>? 'else' <S>? <IfFalseStatement> |
365                                                                         <IfConditionOp> <S>? <IfTrueStatement> 
366
367 # 12.6 Iteration Statements
368 # 12.6a Iteration do ... while() 
369 WhileKeyword                                            ::= 'while'
370 WhileExpression                                         ::= <WhileKeyword> <S>? '(' <S>? <Expression> <S>? ')'
371 DoKeyword                                                       ::= 'do'
372 IterationDo                                                     ::= <DoKeyword> <S>? <Statement> <S>? <WhileExpression> (<S>? ';')
373
374 # 12.6b Iteration while()
375 WhileConditionOp                                        ::= 'while' <S>? '(' <S>? <Expression> <S>? ')'
376 IterationWhileOp                                        ::= <WhileConditionOp> <S>? <Statement>
377
378 # 12.6c Iteration for ( ; ; )
379 ExpressionNoIn                                          ::= <Expression>
380 ForExpressionInit                                       ::= ('var' <S>? <VariableDeclarationList>) | <ExpressionNoIn>
381 ForExpressionCompare                            ::= <Expression>
382 ForExpressionIncrement                          ::= <Expression>
383 ForIterationStatement                           ::= <Statement>
384 IterationFor                                            ::= 'for' <S>? '(' <S>? <ForExpressionInit>? <S>? ';' <S>? <ForExpressionCompare>? <S>? ';' <S>? <ForExpressionIncrement>? <S>? ')' <S>? <ForIterationStatement>
385
386
387 IterationStatement                                      ::= <IterationWhileOp> |
388                                                                                 <IterationFor> |
389                                                                         <IterationDo>
390
391 # 12.9 The return Statement
392 ReturnOp                                                        ::= ('return' - 'return' <IdentifierPart>) <WhiteSpace>* <AssignmentExpression>? (<S>? ';')
393 ReturnStatement                                         ::= ('return' - 'return' <IdentifierPart>) <WhiteSpace>* <AssignmentExpression>? (<S>? ';')
394
395 # The Break Statement
396 BreakOp                                                         ::= 'break' - 'break' <IdentifierPart>
397 BreakStatement                                          ::= <S>? <BreakOp> <SC>
398
399 # The Continue Statement
400 ContinueOp                                                      ::= 'continue' - 'continue' <IdentifierPart>
401 ContinueStatement                                       ::= <S>? <ContinueOp> <SC>
402
403
404
405 # 12.10 The with Statement
406 WithStatement                                           ::= 'with' <S>? '(' <S>? <Expression> <S>? ')' <S>? <Statement>
407
408
409 # 12.11 The switch Statement
410 SwitchExpressionOp                                      ::= ('switch' - 'switch' <IdentifierPart>) <S>? '(' <S>? <Expression> <S>? ')'
411 SwitchStatementOp                                       ::= <SwitchExpressionOp> <S>? <CaseBlock>
412
413 CaseBlock                                                       ::= '{' <S>? <CaseClauses>? <S>? <DefaultClauseOp>? <S>? <CaseClauses>? <S>? '}' |
414                                                                         '{' <S>? <CaseClauses>? <S>? '}'
415
416
417
418 CaseClauses                                             ::= (<S>? <CaseClauseOp>)+
419 CaseExpressionOp                                        ::= ('case' - 'case' <IdentifierPart>) <S>? <Expression> <S>? ':'
420 CaseClauseOp                                            ::= <CaseExpressionOp> <S>? <StatementList>?
421 DefaultKeywordOp                                        ::= 'default' - 'default' <IdentifierPart>
422 DefaultClauseOp                                         ::= <DefaultKeywordOp> <S>? ':' <S>? <StatementList>?
423
424
425 # 13 Function Definition
426 FunctionName                                            ::= <IdentifierNoEmit>
427 FunctionDeclaration                                     ::= ('function'-'function'<IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
428 FunctionExpression                                      ::= ('function'-'function'<IdentifierPart>)<S>?<FunctionName>?<S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
429 FormalParameterList                             ::= <FunctionParameter> ( <S>? ',' <S>? <FunctionParameter> )*
430 FunctionParameter                                       ::= <IdentifierNoEmit>
431 FunctionBody                                            ::= <SourceElements>
432 FunctionDeclarationStatement            ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')' <SC>
433
434 # FunctionName                                          ::= <IdentifierNoEmit>
435 # FunctionNameLookupAlloc                       ::= <IdentifierNoEmit>
436 # FunctionDefinition                            ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')'
437 # FunctionDeclaration                           ::= <FunctionDefinition><S>?'{'<S>?<FunctionBody>?<S>?'}'
438 # FunctionExpression                            ::= ('function' - 'function'<IdentifierPart>)<S>?<FunctionName>?<S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
439 # FunctionParameter                             ::= <Identifier>
440 # FormalParameterList                           ::= <FunctionParameter> ( <S>? ',' <S>? <FunctionParameter> )*
441 # FunctionDefinitionStatement           ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionNameLookupAlloc><S>?'('<S>?<FormalParameterList>?<S>?')' <SC>
442 # FunctionBody                                          ::= <SourceElements>
443
444
445 # 14 Program
446 SourceElements                                  ::= (<S>? <SourceElement>)+
447 SourceElement                                           ::= <FunctionDeclaration> |
448                                                                         <Statement>
449 Program                                                 ::= <SourceElements>
450 # The root rule, it is anonymous
451 <Program>
452
453