diff --git a/compiler/lib/js_parser.mly b/compiler/lib/js_parser.mly index 3217ef963c..21d4339c1c 100644 --- a/compiler/lib/js_parser.mly +++ b/compiler/lib/js_parser.mly @@ -172,6 +172,7 @@ T_BACKQUOTE %token T_VIRTUAL_SEMICOLON %token T_VIRTUAL_SEMICOLON_DO_WHILE +%token T_VIRTUAL_SEMICOLON_EXPORT_DEFAULT %token T_LPAREN_ARROW %token T_INCR_NB T_DECR_NB @@ -399,7 +400,7 @@ export_decl: let k = ExportDefaultExpression e in let pos = $symbolstartpos in Export (k,pi pos), p pos } - | T_EXPORT T_DEFAULT e=export_fun_class + | T_EXPORT T_DEFAULT e=export_fun_class endrule(sc | T_VIRTUAL_SEMICOLON_EXPORT_DEFAULT { () } ) { let k = match e with | EFun (id, decl) -> diff --git a/compiler/lib/js_token.ml b/compiler/lib/js_token.ml index 09ade47e68..9e3780b056 100644 --- a/compiler/lib/js_token.ml +++ b/compiler/lib/js_token.ml @@ -154,6 +154,7 @@ type t = | T_EOF | T_VIRTUAL_SEMICOLON | T_VIRTUAL_SEMICOLON_DO_WHILE + | T_VIRTUAL_SEMICOLON_EXPORT_DEFAULT | T_DECR_NB | T_INCR_NB | T_LPAREN_ARROW @@ -266,6 +267,7 @@ let to_string = function | T_VOID -> "void" | T_VIRTUAL_SEMICOLON -> ";" | T_VIRTUAL_SEMICOLON_DO_WHILE -> ";" + | T_VIRTUAL_SEMICOLON_EXPORT_DEFAULT -> ";" | T_ARROW -> "=>" | T_AT -> "@" | T_POUND -> "#" @@ -319,6 +321,7 @@ let to_string_extra x = | T_DECR -> " (DECR)" | T_VIRTUAL_SEMICOLON -> " (virtual)" | T_VIRTUAL_SEMICOLON_DO_WHILE -> " (virtual-do-while)" + | T_VIRTUAL_SEMICOLON_EXPORT_DEFAULT -> " (virtual-export-default)" | TAnnot _ -> "(annot)" | T_ERROR _ -> "(error)" | T_LPAREN_ARROW -> "(arrow)" diff --git a/compiler/lib/js_token.mli b/compiler/lib/js_token.mli index a3a8898868..df389d9b6e 100644 --- a/compiler/lib/js_token.mli +++ b/compiler/lib/js_token.mli @@ -153,6 +153,7 @@ type t = | T_EOF | T_VIRTUAL_SEMICOLON | T_VIRTUAL_SEMICOLON_DO_WHILE + | T_VIRTUAL_SEMICOLON_EXPORT_DEFAULT | T_DECR_NB | T_INCR_NB | T_LPAREN_ARROW diff --git a/compiler/lib/parse_js.ml b/compiler/lib/parse_js.ml index e150ee7b60..40e3013477 100644 --- a/compiler/lib/parse_js.ml +++ b/compiler/lib/parse_js.ml @@ -453,6 +453,8 @@ let recover error_checkpoint previous_checkpoint = State.Cursor.insert_token rest semicolon dummy_loc |> State.try_recover | T_RPAREN when acceptable previous_checkpoint Js_token.T_VIRTUAL_SEMICOLON_DO_WHILE + -> State.Cursor.insert_token rest semicolon dummy_loc |> State.try_recover | T_RCURLY + when acceptable previous_checkpoint Js_token.T_VIRTUAL_SEMICOLON_EXPORT_DEFAULT -> State.Cursor.insert_token rest semicolon dummy_loc |> State.try_recover | _ -> error_checkpoint)))