File tree 4 files changed +50
-0
lines changed
4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ Console .log ("ppx test" )
2
+
3
+ type t = [ #A | #B ]
4
+
5
+ let a : t = #A
6
+ let b : t = #B
Original file line number Diff line number Diff line change
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+ 'use strict';
3
+
4
+
5
+ console.log("ppx test");
6
+
7
+ console.log("ppx test");
8
+
9
+ let a = "A";
10
+
11
+ let b = "B";
12
+
13
+ exports.a = a;
14
+ exports.b = b;
15
+ /* Not a pure module */
Original file line number Diff line number Diff line change @@ -7,6 +7,15 @@ for file in src/*.{res,resi}; do
7
7
fi
8
8
done
9
9
10
+ for file in ppx/* .res; do
11
+ output=" src/expected/$( basename $file ) .jsout"
12
+ ../../cli/bsc -ppx " ../../_build/install/default/bin/rescript-tools ppx" $file > $output
13
+ # # CI. We use LF, and the CI OCaml fork prints CRLF. Convert.
14
+ if [ " $RUNNER_OS " == " Windows" ]; then
15
+ perl -pi -e ' s/\r\n/\n/g' -- $output
16
+ fi
17
+ done
18
+
10
19
warningYellow=' \033[0;33m'
11
20
successGreen=' \033[0;32m'
12
21
reset=' \033[0m'
Original file line number Diff line number Diff line change @@ -56,6 +56,26 @@ let main () =
56
56
(Tools. extractEmbedded
57
57
~extension Points:(extPointNames |> String. split_on_char ',' )
58
58
~filename ))
59
+ | [" ppx" ; file_in; file_out] ->
60
+ let ic = open_in_bin file_in in
61
+ let magic =
62
+ really_input_string ic (String. length Config. ast_impl_magic_number)
63
+ in
64
+ let loc = input_value ic in
65
+ let ast0 : Parsetree0.structure = input_value ic in
66
+ let prefix =
67
+ match ast0 with
68
+ | c1 :: c2 :: _ -> [c1; c2]
69
+ | _ -> []
70
+ in
71
+ let ast = prefix @ ast0 in
72
+ close_in ic;
73
+ let oc = open_out_bin file_out in
74
+ output_string oc magic;
75
+ output_value oc loc;
76
+ output_value oc ast;
77
+ close_out oc;
78
+ exit 0
59
79
| [" -h" ] | [" --help" ] -> logAndExit (Ok help)
60
80
| [" -v" ] | [" --version" ] -> logAndExit (Ok version)
61
81
| _ -> logAndExit (Error help)
You can’t perform that action at this time.
0 commit comments