@@ -817,11 +817,33 @@ and parse_or_pexp (ps:pstate) : pexp =
817
817
step lhs
818
818
819
819
820
+ and parse_as_pexp (ps :pstate ) : pexp =
821
+ let apos = lexpos ps in
822
+ let pexp = ctxt " as pexp" parse_or_pexp ps in
823
+ let rec step accum =
824
+ match peek ps with
825
+ AS ->
826
+ bump ps;
827
+ let tapos = lexpos ps in
828
+ let t = parse_ty ps in
829
+ let bpos = lexpos ps in
830
+ let t = span ps tapos bpos t in
831
+ let node =
832
+ span ps apos bpos
833
+ (PEXP_unop ((Ast. UNOP_cast t), accum))
834
+ in
835
+ step node
836
+
837
+ | _ -> accum
838
+ in
839
+ step pexp
840
+
841
+
820
842
and parse_relational_pexp (ps :pstate ) : pexp =
821
843
let name = " relational pexp" in
822
844
let apos = lexpos ps in
823
- let lhs = ctxt (name ^ " lhs" ) parse_or_pexp ps in
824
- let build = binop_build ps name apos parse_or_pexp in
845
+ let lhs = ctxt (name ^ " lhs" ) parse_as_pexp ps in
846
+ let build = binop_build ps name apos parse_as_pexp in
825
847
let rec step accum =
826
848
match peek ps with
827
849
LT -> build accum step Ast. BINOP_lt
@@ -883,30 +905,8 @@ and parse_oror_pexp (ps:pstate) : pexp =
883
905
step lhs
884
906
885
907
886
- and parse_as_pexp (ps :pstate ) : pexp =
887
- let apos = lexpos ps in
888
- let pexp = ctxt " as pexp" parse_oror_pexp ps in
889
- let rec step accum =
890
- match peek ps with
891
- AS ->
892
- bump ps;
893
- let tapos = lexpos ps in
894
- let t = parse_ty ps in
895
- let bpos = lexpos ps in
896
- let t = span ps tapos bpos t in
897
- let node =
898
- span ps apos bpos
899
- (PEXP_unop ((Ast. UNOP_cast t), accum))
900
- in
901
- step node
902
-
903
- | _ -> accum
904
- in
905
- step pexp
906
-
907
-
908
908
and parse_pexp (ps :pstate ) : pexp =
909
- parse_as_pexp ps
909
+ parse_oror_pexp ps
910
910
911
911
and parse_mutable_and_pexp (ps :pstate ) : (Ast.mutability * pexp) =
912
912
let mutability = parse_mutability ps in
0 commit comments