Skip to content

Commit 81a1aa8

Browse files
committed
feat(syntax/printer): print regex extension in literal form
1 parent 484471c commit 81a1aa8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

jscomp/syntax/src/res_printer.ml

+10
Original file line numberDiff line numberDiff line change
@@ -3014,6 +3014,16 @@ and printExpression ~state (e : Parsetree.expression) cmtTbl =
30143014
Doc.softLine;
30153015
Doc.rbrace;
30163016
])
3017+
| ( {txt = "re"},
3018+
PStr
3019+
[
3020+
{
3021+
pstr_desc =
3022+
Pstr_eval
3023+
({pexp_desc = Pexp_constant (Pconst_string (expr, _))}, []);
3024+
};
3025+
] ) ->
3026+
Doc.text expr
30173027
| extension -> printExtension ~state ~atModuleLvl:false extension cmtTbl)
30183028
| Pexp_apply (e, [(Nolabel, {pexp_desc = Pexp_array subLists})])
30193029
when ParsetreeViewer.isSpreadBeltArrayConcat e ->

0 commit comments

Comments
 (0)