From 97eddcb10b7e1f749e3ffcb519a82ce5311f6d6e Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 15 Nov 2024 14:57:37 +0100 Subject: [PATCH] Children order: review comments --- src/model/semantics.ml | 10 +++++----- src/parser/test/test.ml | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/model/semantics.ml b/src/model/semantics.ml index 96f96e3365..b801c676ff 100644 --- a/src/model/semantics.ml +++ b/src/model/semantics.ml @@ -45,14 +45,14 @@ let rec find_tag f = function warn_unexpected_tag hd; find_tag f tl) -let rec find_tags acc f = function +let rec find_tags acc ~filter = function | [] -> List.rev acc | hd :: tl -> ( - match f hd.Location.value with - | Some x -> find_tags ((x, hd.location) :: acc) f tl + match filter hd.Location.value with + | Some x -> find_tags ((x, hd.location) :: acc) ~filter tl | None -> warn_unexpected_tag hd; - find_tags acc f tl) + find_tags acc ~filter tl) let handle_internal_tags (type a) tags : a handle_internal_tags -> a = function | Expect_status -> ( @@ -73,7 +73,7 @@ let handle_internal_tags (type a) tags : a handle_internal_tags -> a = function | Expect_page_tags -> let unparsed_lines = find_tags [] - (function `Children_order _ as p -> Some p | _ -> None) + ~filter:(function `Children_order _ as p -> Some p | _ -> None) tags in let lines = diff --git a/src/parser/test/test.ml b/src/parser/test/test.ml index ef438ee366..5f24c13240 100644 --- a/src/parser/test/test.ml +++ b/src/parser/test/test.ml @@ -144,7 +144,9 @@ module Ast_to_sexp = struct | `Return es -> List (Atom "@return" :: List.map (at.at (nestable_block_element at)) es) | `Children_order es -> - List (Atom "@return" :: List.map (at.at (nestable_block_element at)) es) + List + (Atom "@children_order" + :: List.map (at.at (nestable_block_element at)) es) | `See (kind, s, es) -> let kind = match kind with