@@ -220,7 +220,7 @@ module Exp = struct
220220 | Pexp_override _ | Pexp_open _ | Pexp_extension _ | Pexp_hole
221221 | Pexp_record _ | Pexp_record_unboxed_product _ | Pexp_array _
222222 | Pexp_list _ | Pexp_list_comprehension _ | Pexp_array_comprehension _
223- | Pexp_unboxed_tuple _ | Pexp_idx _ ->
223+ | Pexp_unboxed_tuple _ | Pexp_idx _ | Pexp_quote _ | Pexp_splice _ ->
224224 true
225225 | Pexp_constant c -> not (is_uminus_constant c)
226226 | Pexp_prefix (op , _ ) -> not (is_uminus_op op || is_uplus_op op)
@@ -718,7 +718,9 @@ module Class_type_field = struct
718718end
719719
720720type toplevel_item =
721- [`Item of structure_item | `Directive of toplevel_directive ]
721+ [ `Item of structure_item
722+ | `Directive of toplevel_directive
723+ | `Lexer of lexer_directive ]
722724
723725(* * Ast terms of various forms. *)
724726module T = struct
@@ -775,6 +777,8 @@ module T = struct
775777 Format. fprintf fs " Ctf:@\n %a@\n " Printast. class_type_field ctf
776778 | Tli (`Directive d ) ->
777779 Format. fprintf fs " Dir:@\n %a" Printast. top_phrase (Ptop_dir d)
780+ | Tli (`Lexer l ) ->
781+ Format. fprintf fs " Lex:@\n %a" Printast. top_phrase (Ptop_lex l)
778782 | Jkd jkd ->
779783 Format. fprintf fs " Jkd:@\n %a" (Printast. jkind_annotation 0 ) jkd
780784 | Top -> Format. pp_print_string fs " Top"
@@ -836,6 +840,7 @@ let location = function
836840 | Ctf x -> x.pctf_loc
837841 | Tli (`Item x ) -> x.pstr_loc
838842 | Tli (`Directive x ) -> x.pdir_loc
843+ | Tli (`Lexer x ) -> x.plex_loc
839844 | Jkd _ -> Location. none
840845 | Top -> Location. none
841846 | Rep -> Location. none
@@ -1055,7 +1060,9 @@ end = struct
10551060 | {pof_desc = Oinherit t1 ; _} -> typ == t1 ) )
10561061 | Ptyp_class (_ , l ) -> assert (List. exists l ~f )
10571062 | Ptyp_of_kind _ -> assert false
1058- | Ptyp_constr_unboxed (_ , t1N ) -> assert (List. exists t1N ~f ) )
1063+ | Ptyp_constr_unboxed (_ , t1N ) -> assert (List. exists t1N ~f )
1064+ | Ptyp_quote t1 -> assert (typ == t1)
1065+ | Ptyp_splice t1 -> assert (typ == t1) )
10591066 | Td {ptype_params; ptype_cstrs; ptype_kind; ptype_manifest; _} ->
10601067 assert (
10611068 List. exists ptype_params ~f: fst_f
@@ -1448,7 +1455,7 @@ end = struct
14481455 | Pexp_variant _ | Pexp_while _ | Pexp_hole | Pexp_beginend _
14491456 | Pexp_parens _ | Pexp_cons _ | Pexp_letopen _
14501457 | Pexp_indexop_access _ | Pexp_prefix _ | Pexp_infix _ | Pexp_stack _
1451- | Pexp_idx _ ->
1458+ | Pexp_idx _ | Pexp_quote _ | Pexp_splice _ ->
14521459 assert false
14531460 | Pexp_extension (_ , ext ) -> assert (check_extensions ext)
14541461 | Pexp_object {pcstr_self; _} ->
@@ -1596,7 +1603,9 @@ end = struct
15961603 | Pexp_letopen (_, e)
15971604 | Pexp_poly (e, _)
15981605 | Pexp_send (e, _)
1599- | Pexp_setinstvar (_ , e ) ->
1606+ | Pexp_setinstvar (_, e)
1607+ | Pexp_quote e
1608+ | Pexp_splice e ->
16001609 assert (e == exp)
16011610 | Pexp_sequence (e1 , e2 ) -> assert (e1 == exp || e2 == exp)
16021611 | Pexp_setfield (e1 , _ , e2 ) | Pexp_while (e1 , e2 ) ->
@@ -1784,7 +1793,7 @@ end = struct
17841793 | Ptyp_constr _ -> Some (Apply , Non )
17851794 | Ptyp_any | Ptyp_var _ | Ptyp_object _ | Ptyp_class _
17861795 | Ptyp_variant _ | Ptyp_poly _ | Ptyp_package _ | Ptyp_extension _
1787- | Ptyp_of_kind _ ->
1796+ | Ptyp_of_kind _ | Ptyp_quote _ | Ptyp_splice _ ->
17881797 None
17891798 | Ptyp_constr_unboxed (_ , _ :: _ :: _ ) -> Some (Comma , Non )
17901799 | Ptyp_constr_unboxed _ -> Some (Apply , Non ) )
@@ -1921,7 +1930,9 @@ end = struct
19211930 | Ptyp_any | Ptyp_var _ | Ptyp_constr _ | Ptyp_object _
19221931 | Ptyp_class _ | Ptyp_variant _ | Ptyp_poly _ | Ptyp_extension _ ->
19231932 None
1924- | Ptyp_constr_unboxed _ | Ptyp_of_kind _ -> None )
1933+ | Ptyp_constr_unboxed _ | Ptyp_of_kind _ | Ptyp_quote _ | Ptyp_splice _
1934+ ->
1935+ None )
19251936 | Td _ -> None
19261937 | Tyv _ -> None
19271938 | Kab _ -> None
@@ -2313,6 +2324,7 @@ end = struct
23132324 | Pexp_apply (_ , args ) -> continue (snd (List. last_exn args))
23142325 | Pexp_tuple es -> continue (snd (List. last_exn es))
23152326 | Pexp_unboxed_tuple _ -> false
2327+ | Pexp_splice e -> continue e
23162328 | Pexp_array _ | Pexp_list _ | Pexp_coerce _ | Pexp_constant _
23172329 | Pexp_constraint _
23182330 | Pexp_construct (_, None )
@@ -2323,7 +2335,7 @@ end = struct
23232335 | Pexp_variant (_, None )
23242336 | Pexp_hole | Pexp_while _ | Pexp_beginend _ | Pexp_parens _
23252337 | Pexp_indexop_access _ | Pexp_list_comprehension _
2326- | Pexp_array_comprehension _ | Pexp_idx _ ->
2338+ | Pexp_array_comprehension _ | Pexp_idx _ | Pexp_quote _ ->
23272339 false
23282340 in
23292341 Exp. mem_cls cls exp
@@ -2396,6 +2408,7 @@ end = struct
23962408 | Pexp_apply (_ , args ) -> continue (snd (List. last_exn args))
23972409 | Pexp_tuple es -> continue (snd (List. last_exn es))
23982410 | Pexp_unboxed_tuple _ -> false
2411+ | Pexp_splice e -> continue e
23992412 | Pexp_array _ | Pexp_list _ | Pexp_coerce _ | Pexp_constant _
24002413 | Pexp_constraint _
24012414 | Pexp_construct (_, None )
@@ -2406,7 +2419,7 @@ end = struct
24062419 | Pexp_variant (_, None )
24072420 | Pexp_hole | Pexp_while _ | Pexp_beginend _ | Pexp_parens _
24082421 | Pexp_list_comprehension _ | Pexp_array_comprehension _ | Pexp_idx _
2409- ->
2422+ | Pexp_quote _ ->
24102423 false
24112424 in
24122425 Hashtbl. find_or_add marked_parenzed_inner_nested_match exp
0 commit comments