@@ -125,9 +125,9 @@ import qualified Language.JavaScript.Parser.AST as AST
125125-- ---------------------------------------------------------------------
126126-- Sort out automatically inserted semi-colons
127127
128- AutoSemi  :: { AST.JSNode }
129- AutoSemi  : ' ;' " ;" $1 ) (gc $1 )}
130-          |      { AST.NT (AST.JSLiteral " " 
128+ MaybeSemi  :: { AST.JSNode }
129+ MaybeSemi  : ' ;' " ;" $1 ) (gc $1 )}
130+            |      { AST.NT (AST.JSLiteral " " 
131131
132132-- ---------------------------------------------------------------------
133133
@@ -865,8 +865,8 @@ StatementList : Statement               { [$1]       {- StatementList1 -} }
865865-- VariableStatement  :                                            See  12.2 
866866--         var  VariableDeclarationList  ;
867867VariableStatement  :: { 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 ))}
870870
871871-- VariableDeclarationList  :                                      See  12.2 
872872--         VariableDeclaration 
@@ -943,9 +943,9 @@ StatementSemi : StatementNoEmpty Semi { [$1,$2] {- StatementSemi1 -}}
943943--         for  ( LeftHandSideExpression in Expression ) Statement
944944--         for  ( var VariableDeclarationNoIn in Expression ) Statement
945945IterationStatement :: { AST.JSNode }
946- IterationStatement : Do Statement While LParen Expression RParen AutoSemi 
946+ IterationStatement : Do Statement While LParen Expression RParen MaybeSemi 
947947                     { 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 
949949                     { fp (AST.NN (AST.JSDoWhile $1  $2  $4  $5  $6  $7  $8 )) }
950950                   | While LParen Expression RParen Statement
951951                     { fp (AST.NN (AST.JSWhile $1  $2  $3  $4  $5 )) }
@@ -962,27 +962,27 @@ IterationStatement : Do Statement While LParen Expression RParen AutoSemi
962962--         continue  [no LineTerminator here] Identifieropt ;
963963-- TODO: deal with [no LineTerminator here]
964964ContinueStatement :: { 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 )) }
967967
968968-- BreakStatement :                                                                         See 12.8 
969969--         break  [no LineTerminator here] Identifieropt ;
970970-- TODO: deal with [no LineTerminator here]
971971BreakStatement :: { 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 )) }
974974
975975-- ReturnStatement :                                                                        See 12.9 
976976--         return  [no LineTerminator here] Expressionopt ;
977977-- TODO: deal with [no LineTerminator here]
978978ReturnStatement :: { 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 )) }
981981
982982-- WithStatement :                                                                          See 12.10 
983983--         with ( Expression ) Statement
984984WithStatement :: { 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 ])) }
986986
987987-- SwitchStatement :                                                                        See 12.11 
988988--         switch  ( Expression ) CaseBlock
@@ -1060,7 +1060,7 @@ Finally : FinallyL Block { fp (AST.NN (AST.JSFinally $1 $2)) }
10601060-- DebuggerStatement :                                                        See 12.15 
10611061--        debugger ;
10621062DebuggerStatement :: { AST.JSNode }
1063- DebuggerStatement : ' debugger' AutoSemi  { fp (AST.NT (AST.JSLiteral " debugger" $1 ) (gc $1 )) }
1063+ DebuggerStatement : ' debugger' MaybeSemi  { fp (AST.NT (AST.JSLiteral " debugger" $1 ) (gc $1 )) }
10641064
10651065-- FunctionDeclaration :                                                      See clause 13 
10661066--        function Identifier  ( FormalParameterListopt ) { FunctionBody }
0 commit comments