@@ -49796,7 +49796,7 @@ let operatorPrecedence operator =
49796
49796
| "+" | "+." | "-" | "-." | "^" -> 5
49797
49797
| "*" | "*." | "/" | "/." -> 6
49798
49798
| "**" -> 7
49799
- | "#" | "##" | "|." -> 8
49799
+ | "#" | "##" | "|." | "|.u" -> 8
49800
49800
| _ -> 0
49801
49801
49802
49802
let isUnaryOperator operator =
@@ -49818,7 +49818,7 @@ let isBinaryOperator operator =
49818
49818
match operator with
49819
49819
| ":=" | "||" | "&&" | "=" | "==" | "<" | ">" | "!=" | "!==" | "<=" | ">="
49820
49820
| "|>" | "+" | "+." | "-" | "-." | "^" | "*" | "*." | "/" | "/." | "**" | "|."
49821
- | "<>" ->
49821
+ | "|.u" | " <>" ->
49822
49822
true
49823
49823
| _ -> false
49824
49824
@@ -50184,14 +50184,14 @@ let isSinglePipeExpr expr =
50184
50184
let isPipeExpr expr =
50185
50185
match expr.pexp_desc with
50186
50186
| Pexp_apply
50187
- ( {pexp_desc = Pexp_ident {txt = Longident.Lident ("|." | "|>")}},
50187
+ ( {pexp_desc = Pexp_ident {txt = Longident.Lident ("|." | "|.u" | "| >")}},
50188
50188
[(Nolabel, _operand1); (Nolabel, _operand2)] ) ->
50189
50189
true
50190
50190
| _ -> false
50191
50191
in
50192
50192
match expr.pexp_desc with
50193
50193
| Pexp_apply
50194
- ( {pexp_desc = Pexp_ident {txt = Longident.Lident ("|." | "|>")}},
50194
+ ( {pexp_desc = Pexp_ident {txt = Longident.Lident ("|." | "|.u" | "| >")}},
50195
50195
[(Nolabel, operand1); (Nolabel, _operand2)] )
50196
50196
when not (isPipeExpr operand1) ->
50197
50197
true
@@ -51499,7 +51499,7 @@ and walkExpression expr t comments =
51499
51499
Longident.Lident
51500
51500
( ":=" | "||" | "&&" | "=" | "==" | "<" | ">" | "!=" | "!=="
51501
51501
| "<=" | ">=" | "|>" | "+" | "+." | "-" | "-." | "++" | "^"
51502
- | "*" | "*." | "/" | "/." | "**" | "|." | "<>" );
51502
+ | "*" | "*." | "/" | "/." | "**" | "|." | "|.u" | " <>" );
51503
51503
};
51504
51504
},
51505
51505
[(Nolabel, operand1); (Nolabel, operand2)] ) ->
@@ -56548,7 +56548,7 @@ and printBinaryExpression ~state (expr : Parsetree.expression) cmtTbl =
56548
56548
let printBinaryOperator ~inlineRhs operator =
56549
56549
let operatorTxt =
56550
56550
match operator with
56551
- | "|." -> "->"
56551
+ | "|." | "|.u" -> "->"
56552
56552
| "^" -> "++"
56553
56553
| "=" -> "=="
56554
56554
| "==" -> "==="
@@ -56557,12 +56557,12 @@ and printBinaryExpression ~state (expr : Parsetree.expression) cmtTbl =
56557
56557
| txt -> txt
56558
56558
in
56559
56559
let spacingBeforeOperator =
56560
- if operator = "|." then Doc.softLine
56560
+ if operator = "|." || operator = "|.u" then Doc.softLine
56561
56561
else if operator = "|>" then Doc.line
56562
56562
else Doc.space
56563
56563
in
56564
56564
let spacingAfterOperator =
56565
- if operator = "|." then Doc.nil
56565
+ if operator = "|." || operator = "|.u" then Doc.nil
56566
56566
else if operator = "|>" then Doc.space
56567
56567
else if inlineRhs then Doc.space
56568
56568
else Doc.line
@@ -56712,7 +56712,10 @@ and printBinaryExpression ~state (expr : Parsetree.expression) cmtTbl =
56712
56712
in
56713
56713
match expr.pexp_desc with
56714
56714
| Pexp_apply
56715
- ( {pexp_desc = Pexp_ident {txt = Longident.Lident (("|." | "|>") as op)}},
56715
+ ( {
56716
+ pexp_desc =
56717
+ Pexp_ident {txt = Longident.Lident (("|." | "|.u" | "|>") as op)};
56718
+ },
56716
56719
[(Nolabel, lhs); (Nolabel, rhs)] )
56717
56720
when not
56718
56721
(ParsetreeViewer.isBinaryExpression lhs
@@ -56727,8 +56730,8 @@ and printBinaryExpression ~state (expr : Parsetree.expression) cmtTbl =
56727
56730
printAttributes ~state expr.pexp_attributes cmtTbl;
56728
56731
lhsDoc;
56729
56732
(match (lhsHasCommentBelow, op) with
56730
- | true, "|." -> Doc.concat [Doc.softLine; Doc.text "->"]
56731
- | false, "|." -> Doc.text "->"
56733
+ | true, ( "|." | "|.u") -> Doc.concat [Doc.softLine; Doc.text "->"]
56734
+ | false, ( "|." | "|.u") -> Doc.text "->"
56732
56735
| true, "|>" -> Doc.concat [Doc.line; Doc.text "|> "]
56733
56736
| false, "|>" -> Doc.text " |> "
56734
56737
| _ -> Doc.nil);
@@ -150303,7 +150306,7 @@ let view_as_app (fn : exp) (s : string list) : app_pattern option =
150303
150306
| _ -> None
150304
150307
150305
150308
let inner_ops = [ "##"; "#@" ]
150306
- let infix_ops = [ "|."; "#="; "##" ]
150309
+ let infix_ops = [ "|."; "|.u"; " #="; "##" ]
150307
150310
150308
150311
let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
150309
150312
(args : Ast_compatible.args) : exp =
@@ -150328,7 +150331,7 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
150328
150331
Location.raise_errorf ~loc "%s expect f%sproperty arg0 arg2 form" op op
150329
150332
| None -> (
150330
150333
match view_as_app e infix_ops with
150331
- | Some { op = "|."; args = [ a_; f_ ]; loc } -> (
150334
+ | Some { op = ( "|." | "|.u") as op ; args = [ a_; f_ ]; loc } -> (
150332
150335
(*
150333
150336
a |. f
150334
150337
a |. f b c [@bs] --> f a b c [@bs]
@@ -150411,6 +150414,16 @@ let app_exp_mapper (e : exp) (self : Bs_ast_mapper.mapper) (fn : exp)
150411
150414
pexp_loc = e.pexp_loc;
150412
150415
pexp_attributes = e.pexp_attributes @ other_attributes;
150413
150416
}
150417
+ | _ when op = "|.u" ->
150418
+ (* a |.u f
150419
+ Uncurried unary application *)
150420
+ {
150421
+ pexp_desc =
150422
+ Ast_uncurry_apply.uncurry_fn_apply e.pexp_loc self f
150423
+ [ (Nolabel, a) ];
150424
+ pexp_loc = e.pexp_loc;
150425
+ pexp_attributes = e.pexp_attributes;
150426
+ }
150414
150427
| _ -> Ast_compatible.app1 ~loc ~attrs:e.pexp_attributes f a))
150415
150428
| Some { op = "##"; loc; args = [ obj; rest ] } -> (
150416
150429
(* - obj##property
@@ -162691,7 +162704,8 @@ let buildLongident words =
162691
162704
162692
162705
let makeInfixOperator p token startPos endPos =
162693
162706
let stringifiedToken =
162694
- if token = Token.MinusGreater then "|."
162707
+ if token = Token.MinusGreater then
162708
+ if p.Parser.uncurried_by_default then "|.u" else "|."
162695
162709
else if token = Token.PlusPlus then "^"
162696
162710
else if token = Token.BangEqual then "<>"
162697
162711
else if token = Token.BangEqualEqual then "!="
0 commit comments