Skip to content

Commit d95f6d2

Browse files
committed
WIP
1 parent 06e6548 commit d95f6d2

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

compiler/tests-compiler/js_parser_printer.ml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -813,11 +813,6 @@ let parse_print_token ?(invalid = false) ?(extra = false) s =
813813
| true -> Printf.printf "\n%2d: " pos.Parse_info.line
814814
| false -> ());
815815
if pos.Parse_info.line <> 0 then prev := pos.Parse_info.line;
816-
let s =
817-
match tok with
818-
| T_STRING _ -> Str.global_replace (Str.regexp {|\\r\\n|}) {|\n|} s
819-
| _ -> s
820-
in
821816
Printf.printf "%d:%s, " pos.Parse_info.col s;
822817
loop xs
823818
in
@@ -878,37 +873,38 @@ let%expect_test "string" =
878873
5: 4:var, 8:a, 10:=, 12:"munpi\207\128\207\128\207\128qtex", 26:;, |}]
879874

880875
let%expect_test "multiline string" =
881-
parse_print_token ~invalid:true {|
876+
let clean s = Str.global_replace (Str.regexp "\n") "\n" s in
877+
parse_print_token ~invalid:true (clean {|
882878
42;
883879
"
884880
";
885881
42
886-
|};
882+
|});
887883
[%expect
888884
{|
889885
2: 4:42, 6:;,
890886
3: 4:"\n ",
891887
4: 5:;,
892888
5: 4:42, 0:;,
893889
Lexer error: fake:3:5: Unexpected token ILLEGAL |}];
894-
parse_print_token {|
890+
parse_print_token (clean {|
895891
42;
896892
"\
897893
";
898894
42
899-
|};
895+
|});
900896
[%expect {|
901897
2: 4:42, 6:;,
902898
3: 4:" ",
903899
4: 5:;,
904900
5: 4:42, 0:;, |}];
905-
parse_print_token ~invalid:true {|
901+
parse_print_token ~invalid:true (clean {|
906902
42;
907903
"
908904
909905
";
910906
42
911-
|};
907+
|});
912908
[%expect
913909
{|
914910
2: 4:42, 6:;,

0 commit comments

Comments
 (0)