@@ -125,9 +125,9 @@ import qualified Language.JavaScript.Parser.AST as AST
125
125
-- ---------------------------------------------------------------------
126
126
-- Sort out automatically inserted semi-colons
127
127
128
- AutoSemi :: { AST.JSNode }
129
- AutoSemi : ' ;' { AST.NT (AST.JSLiteral " ;" ) (ss $1 ) (gc $1 )}
130
- | { AST.NT (AST.JSLiteral " " ) tokenPosnEmpty []}
128
+ MaybeSemi :: { AST.JSNode }
129
+ MaybeSemi : ' ;' { AST.NT (AST.JSLiteral " ;" ) (ss $1 ) (gc $1 )}
130
+ | { AST.NT (AST.JSLiteral " " ) tokenPosnEmpty []}
131
131
132
132
-- ---------------------------------------------------------------------
133
133
@@ -865,8 +865,8 @@ StatementList : Statement { [$1] {- StatementList1 -} }
865
865
-- VariableStatement : See 12.2
866
866
-- var VariableDeclarationList ;
867
867
VariableStatement :: { AST.JSNode }
868
- VariableStatement : Var VariableDeclarationList AutoSemi { fp (AST.NN (AST.JSVariables $1 $2 $3 ))}
869
- | Const VariableDeclarationList AutoSemi { fp (AST.NN (AST.JSVariables $1 $2 $3 ))}
868
+ VariableStatement : Var VariableDeclarationList MaybeSemi { fp (AST.NN (AST.JSVariables $1 $2 $3 ))}
869
+ | Const VariableDeclarationList MaybeSemi { fp (AST.NN (AST.JSVariables $1 $2 $3 ))}
870
870
871
871
-- VariableDeclarationList : See 12.2
872
872
-- VariableDeclaration
@@ -943,9 +943,9 @@ StatementSemi : StatementNoEmpty Semi { [$1,$2] {- StatementSemi1 -}}
943
943
-- for ( LeftHandSideExpression in Expression ) Statement
944
944
-- for ( var VariableDeclarationNoIn in Expression ) Statement
945
945
IterationStatement :: { AST.JSNode }
946
- IterationStatement : Do Statement While LParen Expression RParen AutoSemi
946
+ IterationStatement : Do Statement While LParen Expression RParen MaybeSemi
947
947
{ fp (AST.NN (AST.JSDoWhile $1 $2 $3 $4 $5 $6 $7 )) }
948
- | Do Expression AutoSemi While LParen Expression RParen AutoSemi
948
+ | Do Expression MaybeSemi While LParen Expression RParen MaybeSemi
949
949
{ fp (AST.NN (AST.JSDoWhile $1 $2 $4 $5 $6 $7 $8 )) }
950
950
| While LParen Expression RParen Statement
951
951
{ fp (AST.NN (AST.JSWhile $1 $2 $3 $4 $5 )) }
@@ -962,27 +962,27 @@ IterationStatement : Do Statement While LParen Expression RParen AutoSemi
962
962
-- continue [no LineTerminator here] Identifieropt ;
963
963
-- TODO: deal with [no LineTerminator here]
964
964
ContinueStatement :: { AST.JSNode }
965
- ContinueStatement : Continue AutoSemi { fp (AST.NN (AST.JSContinue $1 [] $2 )) }
966
- | Continue Identifier AutoSemi { fp (AST.NN (AST.JSContinue $1 [$2 ] $3 )) }
965
+ ContinueStatement : Continue MaybeSemi { fp (AST.NN (AST.JSContinue $1 [] $2 )) }
966
+ | Continue Identifier MaybeSemi { fp (AST.NN (AST.JSContinue $1 [$2 ] $3 )) }
967
967
968
968
-- BreakStatement : See 12.8
969
969
-- break [no LineTerminator here] Identifieropt ;
970
970
-- TODO: deal with [no LineTerminator here]
971
971
BreakStatement :: { AST.JSNode }
972
- BreakStatement : Break AutoSemi { fp (AST.NN (AST.JSBreak $1 [] $2 )) }
973
- | Break Identifier AutoSemi { fp (AST.NN (AST.JSBreak $1 [$2 ] $3 )) }
972
+ BreakStatement : Break MaybeSemi { fp (AST.NN (AST.JSBreak $1 [] $2 )) }
973
+ | Break Identifier MaybeSemi { fp (AST.NN (AST.JSBreak $1 [$2 ] $3 )) }
974
974
975
975
-- ReturnStatement : See 12.9
976
976
-- return [no LineTerminator here] Expressionopt ;
977
977
-- TODO: deal with [no LineTerminator here]
978
978
ReturnStatement :: { AST.JSNode }
979
- ReturnStatement : Return AutoSemi { fp (AST.NN (AST.JSReturn $1 [] $2 )) }
980
- | Return Expression AutoSemi { fp (AST.NN (AST.JSReturn $1 [$2 ] $3 )) }
979
+ ReturnStatement : Return MaybeSemi { fp (AST.NN (AST.JSReturn $1 [] $2 )) }
980
+ | Return Expression MaybeSemi { fp (AST.NN (AST.JSReturn $1 [$2 ] $3 )) }
981
981
982
982
-- WithStatement : See 12.10
983
983
-- with ( Expression ) Statement
984
984
WithStatement :: { AST.JSNode }
985
- WithStatement : With LParen Expression RParen Statement AutoSemi { fp (AST.NN (AST.JSWith $1 $2 $3 $4 [$5 ,$6 ])) }
985
+ WithStatement : With LParen Expression RParen Statement MaybeSemi { fp (AST.NN (AST.JSWith $1 $2 $3 $4 [$5 ,$6 ])) }
986
986
987
987
-- SwitchStatement : See 12.11
988
988
-- switch ( Expression ) CaseBlock
@@ -1060,7 +1060,7 @@ Finally : FinallyL Block { fp (AST.NN (AST.JSFinally $1 $2)) }
1060
1060
-- DebuggerStatement : See 12.15
1061
1061
-- debugger ;
1062
1062
DebuggerStatement :: { AST.JSNode }
1063
- DebuggerStatement : ' debugger' AutoSemi { fp (AST.NT (AST.JSLiteral " debugger" ) (ss $1 ) (gc $1 )) }
1063
+ DebuggerStatement : ' debugger' MaybeSemi { fp (AST.NT (AST.JSLiteral " debugger" ) (ss $1 ) (gc $1 )) }
1064
1064
1065
1065
-- FunctionDeclaration : See clause 13
1066
1066
-- function Identifier ( FormalParameterListopt ) { FunctionBody }
0 commit comments