Skip to content

Commit c3df9f6

Browse files
committed
feat(syntax/printer): print regex extension in literal form
1 parent ad6e663 commit c3df9f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

jscomp/syntax/src/res_printer.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,6 +3075,16 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
30753075
Doc.soft_line;
30763076
Doc.rbrace;
30773077
])
3078+
| ( {txt = "re"},
3079+
PStr
3080+
[
3081+
{
3082+
pstr_desc =
3083+
Pstr_eval
3084+
({pexp_desc = Pexp_constant (Pconst_string (expr, _))}, []);
3085+
};
3086+
] ) ->
3087+
Doc.text expr
30783088
| extension ->
30793089
print_extension ~state ~at_module_lvl:false extension cmt_tbl)
30803090
| Pexp_apply (e, [(Nolabel, {pexp_desc = Pexp_array sub_lists})])

0 commit comments

Comments
 (0)