|
115 | 115 | exception RescriptParsingErrors of locErrInfo list
|
116 | 116 |
|
117 | 117 | module ErrorRet = struct
|
118 |
| - type err = |
119 |
| - | SyntaxErr of locErrInfo array |
120 |
| - | TypecheckErr of locErrInfo array |
121 |
| - | WarningFlagErr of string * string (* warning, warning_error flags *) |
122 |
| - | WarningErrs of LocWarnInfo.t array |
123 |
| - | UnexpectedErr of string |
124 |
| - |
125 | 118 | let locErrorAttributes ~(type_: string) ~(fullMsg: string) ~(shortMsg: string) (loc: Location.t) =
|
126 | 119 | let (_file,line,startchar) = Location.get_pos_info loc.Location.loc_start in
|
127 | 120 | let (_file,endline,endchar) = Location.get_pos_info loc.Location.loc_end in
|
@@ -226,16 +219,6 @@ let lexbuf_from_string ~filename str =
|
226 | 219 | lexbuf.lex_curr_p <- { lexbuf.lex_curr_p with pos_fname = filename };
|
227 | 220 | lexbuf
|
228 | 221 |
|
229 |
| -(* We need this for a specific parsing issue in Reason: Whenever you are |
230 |
| - * parsing a source where the last line is a comment (and not a \n) the parser |
231 |
| - * enters an infinite loop. To prevent this, we need to make sure to append a |
232 |
| - * newline before doing any parsing attempt *) |
233 |
| -let maybe_add_newline str = |
234 |
| - let last = (String.length str) - 1 in |
235 |
| - match String.get str last with |
236 |
| - | '\n' -> str |
237 |
| - | _ -> str ^ "\n" |
238 |
| - |
239 | 222 | let ocaml_parse ~filename str =
|
240 | 223 | lexbuf_from_string ~filename str |> Parse.implementation
|
241 | 224 |
|
@@ -410,7 +393,6 @@ module Compile = struct
|
410 | 393 | let collectTypeHints typed_tree =
|
411 | 394 | let open Typedtree in
|
412 | 395 | let createTypeHintObj loc kind hint =
|
413 |
| - let open Lexing in |
414 | 396 | let open Location in
|
415 | 397 | let (_ , startline, startcol) = Location.get_pos_info loc.loc_start in
|
416 | 398 | let (_ , endline, endcol) = Location.get_pos_info loc.loc_end in
|
@@ -531,7 +513,6 @@ module Compile = struct
|
531 | 513 | | _ -> handle_err e;;
|
532 | 514 |
|
533 | 515 | let syntax_format ?(filename: string option) ~(from:Lang.t) ~(to_:Lang.t) (src: string) =
|
534 |
| - let open Lang in |
535 | 516 | let filename = get_filename ~lang:from filename in
|
536 | 517 | try
|
537 | 518 | let code = match (from, to_) with
|
@@ -691,7 +672,6 @@ module Export = struct
|
691 | 672 | end
|
692 | 673 |
|
693 | 674 | let () =
|
694 |
| - let open Lang in |
695 | 675 | export "rescript_compiler"
|
696 | 676 | (Js.Unsafe.(obj
|
697 | 677 | [|
|
|
0 commit comments