Program
[SourceElement+]
SourceElement
Statement | FunctionDeclaration
FunctionDeclaration
function Identifier FormalParameterList FunctionBody
FunctionExpression
function Identifier? FormalParameterList FunctionBody
FormalParameterList
'(' [Identifier ( ',' Identifier)*] ')'
FunctionBody
'{' [SourceElement+] '}'
Statement
Block VariableStatement |
EmptyStatement | ExpressionStatement |
IfStatement |
IterationStatement
ContinueStatement |
BreakStatement |
ReturnStatement | WithStatement |
LabelledStatement |
SwitchStatement ThrowStatement |
TryStatement | DebuggerStatement
Block
'{' StatementList '}'
StatementList
[Statement+]
VariableStatement
var VariableDeclarationList ';'
VariableDeclarationList
VariableDeclaration (',' VariableDeclaration)*
VariableDeclarationListNoIn
VariableDeclarationNoIn (',' VariableDeclarationNoIn)*
VariableDeclaration
Identifier Initialiser?
VariableDeclarationNoIn
Identifier InitialiserNoIn?
Initialiser
'=' AssignmentExpression
InitialiserNoIn
'=' AssignmentExpressionNoIn
EmptyStatement
';'
ExpressionStatement
[lookahead 'nao pertence' '{''{'',' function'}'] Expression ';'
IfStatement
if '(' Expression ')' Statement [else Statement]
IterationStatement
do Statement while '(' Expression ')' ';' | while '(' Expression ')' Statement |
for '(' (ExpressionNoIn? | var VariableDeclarationListNoIn)
';' Expression? ';' Expression? ')' Statement |
for '('(LeftHandSideExpression | var VariableDeclarationNoIn)in Expression ')' Statement
ContinueStatement
continue [no LineTerminator here] Identifier? ';'
BreakStatement
break [no LineTerminator here] Identifier? ';'
ReturnStatement
return [no LineTerminator here] Expression? ';'
WithStatement
with '(' Expression ')' Statement
SwitchStatement
switch '(' Expression ')' CaseBlock
CaseBlock
'{' CaseClauses [DefaultClause CaseClauses] '}'
CaseClauses
[CaseClause+]
DefaultClause
default ':' StatementList
LabelledStatement
Identifier ':' Statement
ThrowStatement
throw [no LineTerminator here] Expression ';'
TryStatement
try Block (Catch | Finally | Catch Finally)
Catch
catch'(' Identifier ')' Block
Finally
finally Block
DebuggerStatement
debugger ';'