mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-09 22:16:10 +03:00
Added iter visitor
This commit is contained in:
parent
c67857700a
commit
37bbbad9db
@ -19,17 +19,22 @@
|
||||
module Pos = Utils.Pos
|
||||
|
||||
type constructor = (string[@opaque])
|
||||
[@@deriving visitors { variety = "map"; name = "constructor_map"; nude = true }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "constructor_map"; nude = true },
|
||||
visitors { variety = "iter"; name = "constructor_iter"; nude = true }]
|
||||
(** Constructors are CamelCase *)
|
||||
|
||||
type ident = (string[@opaque])
|
||||
[@@deriving visitors { variety = "map"; name = "ident_map"; nude = true }]
|
||||
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "ident_map"; nude = true },
|
||||
visitors { variety = "iter"; name = "ident_iter"; nude = true }]
|
||||
(** Idents are snake_case *)
|
||||
|
||||
type qident = ident Pos.marked list
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map"; "ident_map" ]; name = "qident_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map"; "ident_map" ]; name = "qident_map" },
|
||||
visitors
|
||||
{ variety = "iter"; ancestors = [ "Pos.marked_iter"; "ident_iter" ]; name = "qident_iter" }]
|
||||
|
||||
type primitive_typ =
|
||||
| Integer
|
||||
@ -41,7 +46,8 @@ type primitive_typ =
|
||||
| Date
|
||||
| Named of constructor
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "constructor_map" ]; name = "primitive_typ_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "constructor_map" ]; name = "primitive_typ_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "constructor_iter" ]; name = "primitive_typ_iter" }]
|
||||
|
||||
type base_typ_data = Primitive of primitive_typ | Collection of base_typ_data Pos.marked
|
||||
[@@deriving
|
||||
@ -50,20 +56,36 @@ type base_typ_data = Primitive of primitive_typ | Collection of base_typ_data Po
|
||||
variety = "map";
|
||||
ancestors = [ "Pos.marked_map"; "primitive_typ_map" ];
|
||||
name = "base_typ_data_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "Pos.marked_iter"; "primitive_typ_iter" ];
|
||||
name = "base_typ_data_iter";
|
||||
}]
|
||||
|
||||
type base_typ = Condition | Data of base_typ_data
|
||||
[@@deriving
|
||||
visitors
|
||||
{ variety = "map"; ancestors = [ "base_typ_data_map" ]; name = "base_typ_map"; nude = true }]
|
||||
{ variety = "map"; ancestors = [ "base_typ_data_map" ]; name = "base_typ_map"; nude = true },
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "base_typ_data_iter" ];
|
||||
name = "base_typ_iter";
|
||||
nude = true;
|
||||
}]
|
||||
|
||||
type func_typ = { arg_typ : base_typ Pos.marked; return_typ : base_typ Pos.marked }
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "base_typ_map" ]; name = "func_typ_map"; nude = true }]
|
||||
visitors { variety = "map"; ancestors = [ "base_typ_map" ]; name = "func_typ_map"; nude = true },
|
||||
visitors
|
||||
{ variety = "iter"; ancestors = [ "base_typ_iter" ]; name = "func_typ_iter"; nude = true }]
|
||||
|
||||
type typ = Base of base_typ | Func of func_typ
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "func_typ_map" ]; name = "typ_map"; nude = true }]
|
||||
visitors { variety = "map"; ancestors = [ "func_typ_map" ]; name = "typ_map"; nude = true },
|
||||
visitors { variety = "iter"; ancestors = [ "func_typ_iter" ]; name = "typ_iter"; nude = true }]
|
||||
|
||||
type struct_decl_field = {
|
||||
struct_decl_field_name : ident Pos.marked;
|
||||
@ -71,21 +93,31 @@ type struct_decl_field = {
|
||||
}
|
||||
[@@deriving
|
||||
visitors
|
||||
{ variety = "map"; ancestors = [ "typ_map"; "ident_map" ]; name = "struct_decl_field_map" }]
|
||||
{ variety = "map"; ancestors = [ "typ_map"; "ident_map" ]; name = "struct_decl_field_map" },
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "typ_iter"; "ident_iter" ];
|
||||
name = "struct_decl_field_iter";
|
||||
}]
|
||||
|
||||
type struct_decl = {
|
||||
struct_decl_name : constructor Pos.marked;
|
||||
struct_decl_fields : struct_decl_field Pos.marked list;
|
||||
}
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "struct_decl_field_map" ]; name = "struct_decl_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "struct_decl_field_map" ]; name = "struct_decl_map" },
|
||||
visitors
|
||||
{ variety = "iter"; ancestors = [ "struct_decl_field_iter" ]; name = "struct_decl_iter" }]
|
||||
|
||||
type enum_decl_case = {
|
||||
enum_decl_case_name : constructor Pos.marked;
|
||||
enum_decl_case_typ : typ Pos.marked option;
|
||||
}
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "typ_map" ]; name = "enum_decl_case_map"; nude = true }]
|
||||
visitors { variety = "map"; ancestors = [ "typ_map" ]; name = "enum_decl_case_map"; nude = true },
|
||||
visitors
|
||||
{ variety = "iter"; ancestors = [ "typ_iter" ]; name = "enum_decl_case_iter"; nude = true }]
|
||||
|
||||
type enum_decl = {
|
||||
enum_decl_name : constructor Pos.marked;
|
||||
@ -93,7 +125,14 @@ type enum_decl = {
|
||||
}
|
||||
[@@deriving
|
||||
visitors
|
||||
{ variety = "map"; ancestors = [ "enum_decl_case_map" ]; name = "enum_decl_map"; nude = true }]
|
||||
{ variety = "map"; ancestors = [ "enum_decl_case_map" ]; name = "enum_decl_map"; nude = true },
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "enum_decl_case_iter" ];
|
||||
name = "enum_decl_iter";
|
||||
nude = true;
|
||||
}]
|
||||
|
||||
type match_case_pattern = constructor Pos.marked list * ident Pos.marked option
|
||||
[@@deriving
|
||||
@ -102,7 +141,13 @@ type match_case_pattern = constructor Pos.marked list * ident Pos.marked option
|
||||
variety = "map";
|
||||
ancestors = [ "ident_map"; "constructor_map"; "Pos.marked_map" ];
|
||||
name = "match_case_pattern_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "ident_iter"; "constructor_iter"; "Pos.marked_iter" ];
|
||||
name = "match_case_pattern_iter";
|
||||
}]
|
||||
|
||||
type op_kind =
|
||||
| KInt (** No suffix *)
|
||||
@ -110,7 +155,9 @@ type op_kind =
|
||||
| KMoney (** Suffix: [$] *)
|
||||
| KDate (** Suffix: [@] *)
|
||||
| KDuration (** Suffix: [^] *)
|
||||
[@@deriving visitors { variety = "map"; name = "op_kind_map"; nude = true }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "op_kind_map"; nude = true },
|
||||
visitors { variety = "iter"; name = "op_kind_iter"; nude = true }]
|
||||
|
||||
type binop =
|
||||
| And
|
||||
@ -126,14 +173,18 @@ type binop =
|
||||
| Eq
|
||||
| Neq
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "op_kind_map" ]; name = "binop_map"; nude = true }]
|
||||
visitors { variety = "map"; ancestors = [ "op_kind_map" ]; name = "binop_map"; nude = true },
|
||||
visitors { variety = "iter"; ancestors = [ "op_kind_iter" ]; name = "binop_iter"; nude = true }]
|
||||
|
||||
type unop = Not | Minus of op_kind
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "op_kind_map" ]; name = "unop_map"; nude = true }]
|
||||
visitors { variety = "map"; ancestors = [ "op_kind_map" ]; name = "unop_map"; nude = true },
|
||||
visitors { variety = "iter"; ancestors = [ "op_kind_iter" ]; name = "unop_iter"; nude = true }]
|
||||
|
||||
type builtin_expression = Cardinal | IntToDec | GetDay | GetMonth | GetYear
|
||||
[@@deriving visitors { variety = "map"; name = "builtin_expression_map"; nude = true }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "builtin_expression_map"; nude = true },
|
||||
visitors { variety = "iter"; name = "builtin_expression_iter"; nude = true }]
|
||||
|
||||
type literal_date = {
|
||||
literal_date_day : (int[@opaque]) Pos.marked;
|
||||
@ -141,16 +192,23 @@ type literal_date = {
|
||||
literal_date_year : (int[@opaque]) Pos.marked;
|
||||
}
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "literal_date_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "literal_date_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "Pos.marked_iter" ]; name = "literal_date_iter" }]
|
||||
|
||||
type literal_number = Int of (Z.t[@opaque]) | Dec of (Z.t[@opaque]) * (Z.t[@opaque])
|
||||
[@@deriving visitors { variety = "map"; name = "literal_number_map"; nude = true }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "literal_number_map"; nude = true },
|
||||
visitors { variety = "iter"; name = "literal_number_iter"; nude = true }]
|
||||
|
||||
type literal_unit = Percent | Year | Month | Day
|
||||
[@@deriving visitors { variety = "map"; name = "literal_unit_map"; nude = true }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "literal_unit_map"; nude = true },
|
||||
visitors { variety = "iter"; name = "literal_unit_iter"; nude = true }]
|
||||
|
||||
type money_amount = { money_amount_units : (Z.t[@opaque]); money_amount_cents : (Z.t[@opaque]) }
|
||||
[@@deriving visitors { variety = "map"; name = "money_amount_map"; nude = true }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "money_amount_map"; nude = true },
|
||||
visitors { variety = "iter"; name = "money_amount_iter"; nude = true }]
|
||||
|
||||
type literal =
|
||||
| LNumber of literal_number Pos.marked * literal_unit Pos.marked option
|
||||
@ -164,7 +222,14 @@ type literal =
|
||||
ancestors =
|
||||
[ "literal_number_map"; "money_amount_map"; "literal_date_map"; "literal_unit_map" ];
|
||||
name = "literal_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors =
|
||||
[ "literal_number_iter"; "money_amount_iter"; "literal_date_iter"; "literal_unit_iter" ];
|
||||
name = "literal_iter";
|
||||
}]
|
||||
|
||||
type aggregate_func =
|
||||
| AggregateSum of primitive_typ
|
||||
@ -214,7 +279,21 @@ and expression =
|
||||
"builtin_expression_map";
|
||||
];
|
||||
name = "expression_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors =
|
||||
[
|
||||
"primitive_typ_iter";
|
||||
"match_case_pattern_iter";
|
||||
"literal_iter";
|
||||
"binop_iter";
|
||||
"unop_iter";
|
||||
"builtin_expression_iter";
|
||||
];
|
||||
name = "expression_iter";
|
||||
}]
|
||||
|
||||
type rule = {
|
||||
rule_label : ident Pos.marked option;
|
||||
@ -225,7 +304,9 @@ type rule = {
|
||||
rule_consequence : (bool[@opaque]) Pos.marked;
|
||||
}
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "expression_map"; "qident_map" ]; name = "rule_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "expression_map"; "qident_map" ]; name = "rule_map" },
|
||||
visitors
|
||||
{ variety = "iter"; ancestors = [ "expression_iter"; "qident_iter" ]; name = "rule_iter" }]
|
||||
|
||||
type definition = {
|
||||
definition_label : ident Pos.marked option;
|
||||
@ -237,10 +318,18 @@ type definition = {
|
||||
}
|
||||
[@@deriving
|
||||
visitors
|
||||
{ variety = "map"; ancestors = [ "expression_map"; "qident_map" ]; name = "definition_map" }]
|
||||
{ variety = "map"; ancestors = [ "expression_map"; "qident_map" ]; name = "definition_map" },
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "expression_iter"; "qident_iter" ];
|
||||
name = "definition_iter";
|
||||
}]
|
||||
|
||||
type variation_typ = Increasing | Decreasing
|
||||
[@@deriving visitors { variety = "map"; name = "variation_typ_map" }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "variation_typ_map" },
|
||||
visitors { variety = "iter"; name = "variation_typ_iter" }]
|
||||
|
||||
type meta_assertion =
|
||||
| FixedBy of qident Pos.marked * ident Pos.marked
|
||||
@ -251,13 +340,21 @@ type meta_assertion =
|
||||
variety = "map";
|
||||
ancestors = [ "variation_typ_map"; "qident_map"; "expression_map" ];
|
||||
name = "meta_assertion_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "variation_typ_iter"; "qident_iter"; "expression_iter" ];
|
||||
name = "meta_assertion_iter";
|
||||
}]
|
||||
|
||||
type assertion = {
|
||||
assertion_condition : expression Pos.marked option;
|
||||
assertion_content : expression Pos.marked;
|
||||
}
|
||||
[@@deriving visitors { variety = "map"; ancestors = [ "expression_map" ]; name = "assertion_map" }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "expression_map" ]; name = "assertion_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "expression_iter" ]; name = "assertion_iter" }]
|
||||
|
||||
type scope_use_item =
|
||||
| Rule of rule
|
||||
@ -270,7 +367,13 @@ type scope_use_item =
|
||||
variety = "map";
|
||||
ancestors = [ "meta_assertion_map"; "definition_map"; "assertion_map"; "rule_map" ];
|
||||
name = "scope_use_item_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "meta_assertion_iter"; "definition_iter"; "assertion_iter"; "rule_iter" ];
|
||||
name = "scope_use_item_iter";
|
||||
}]
|
||||
|
||||
type scope_use = {
|
||||
scope_use_condition : expression Pos.marked option;
|
||||
@ -283,7 +386,13 @@ type scope_use = {
|
||||
variety = "map";
|
||||
ancestors = [ "expression_map"; "scope_use_item_map" ];
|
||||
name = "scope_use_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "expression_iter"; "scope_use_item_iter" ];
|
||||
name = "scope_use_iter";
|
||||
}]
|
||||
|
||||
type scope_decl_context_scope = {
|
||||
scope_decl_context_scope_name : ident Pos.marked;
|
||||
@ -295,7 +404,13 @@ type scope_decl_context_scope = {
|
||||
variety = "map";
|
||||
ancestors = [ "ident_map"; "constructor_map"; "Pos.marked_map" ];
|
||||
name = "scope_decl_context_scope_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "ident_iter"; "constructor_iter"; "Pos.marked_iter" ];
|
||||
name = "scope_decl_context_scope_iter";
|
||||
}]
|
||||
|
||||
type scope_decl_context_data = {
|
||||
scope_decl_context_item_name : ident Pos.marked;
|
||||
@ -307,7 +422,13 @@ type scope_decl_context_data = {
|
||||
variety = "map";
|
||||
ancestors = [ "typ_map"; "ident_map" ];
|
||||
name = "scope_decl_context_data_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "typ_iter"; "ident_iter" ];
|
||||
name = "scope_decl_context_data_iter";
|
||||
}]
|
||||
|
||||
type scope_decl_context_item =
|
||||
| ContextData of scope_decl_context_data
|
||||
@ -318,7 +439,13 @@ type scope_decl_context_item =
|
||||
variety = "map";
|
||||
ancestors = [ "scope_decl_context_data_map"; "scope_decl_context_scope_map" ];
|
||||
name = "scope_decl_context_item_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "scope_decl_context_data_iter"; "scope_decl_context_scope_iter" ];
|
||||
name = "scope_decl_context_item_iter";
|
||||
}]
|
||||
|
||||
type scope_decl = {
|
||||
scope_decl_name : constructor Pos.marked;
|
||||
@ -326,7 +453,9 @@ type scope_decl = {
|
||||
}
|
||||
[@@deriving
|
||||
visitors
|
||||
{ variety = "map"; ancestors = [ "scope_decl_context_item_map" ]; name = "scope_decl_map" }]
|
||||
{ variety = "map"; ancestors = [ "scope_decl_context_item_map" ]; name = "scope_decl_map" },
|
||||
visitors
|
||||
{ variety = "iter"; ancestors = [ "scope_decl_context_item_iter" ]; name = "scope_decl_iter" }]
|
||||
|
||||
type code_item =
|
||||
| ScopeUse of scope_use
|
||||
@ -339,14 +468,23 @@ type code_item =
|
||||
variety = "map";
|
||||
ancestors = [ "scope_decl_map"; "enum_decl_map"; "struct_decl_map"; "scope_use_map" ];
|
||||
name = "code_item_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "scope_decl_iter"; "enum_decl_iter"; "struct_decl_iter"; "scope_use_iter" ];
|
||||
name = "code_item_iter";
|
||||
}]
|
||||
|
||||
type code_block = code_item Pos.marked list
|
||||
[@@deriving visitors { variety = "map"; ancestors = [ "code_item_map" ]; name = "code_block_map" }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "code_item_map" ]; name = "code_block_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "code_item_iter" ]; name = "code_block_iter" }]
|
||||
|
||||
type source_repr = (string[@opaque]) Pos.marked
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "source_repr_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "source_repr_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "Pos.marked_iter" ]; name = "source_repr_iter" }]
|
||||
|
||||
type law_article = {
|
||||
law_article_name : (string[@opaque]) Pos.marked;
|
||||
@ -354,14 +492,16 @@ type law_article = {
|
||||
law_article_expiration_date : (string[@opaque]) option;
|
||||
}
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "law_article_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "law_article_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "Pos.marked_iter" ]; name = "law_article_iter" }]
|
||||
|
||||
type law_include =
|
||||
| PdfFile of (string[@opaque]) Pos.marked * (int[@opaque]) option
|
||||
| CatalaFile of (string[@opaque]) Pos.marked
|
||||
| LegislativeText of (string[@opaque]) Pos.marked
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "law_include_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "Pos.marked_map" ]; name = "law_include_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "Pos.marked_iter" ]; name = "law_include_iter" }]
|
||||
|
||||
type law_article_item = LawText of (string[@opaque]) | CodeBlock of code_block * source_repr
|
||||
[@@deriving
|
||||
@ -370,10 +510,18 @@ type law_article_item = LawText of (string[@opaque]) | CodeBlock of code_block *
|
||||
variety = "map";
|
||||
ancestors = [ "code_block_map"; "source_repr_map" ];
|
||||
name = "law_article_item_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors = [ "code_block_iter"; "source_repr_iter" ];
|
||||
name = "law_article_item_iter";
|
||||
}]
|
||||
|
||||
type law_heading = { law_heading_name : (string[@opaque]); law_heading_precedence : (int[@opaque]) }
|
||||
[@@deriving visitors { variety = "map"; name = "law_heading_map" }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; name = "law_heading_map" },
|
||||
visitors { variety = "iter"; name = "law_heading_iter" }]
|
||||
|
||||
type law_structure =
|
||||
| LawInclude of law_include
|
||||
@ -395,14 +543,31 @@ type law_structure =
|
||||
"law_heading_map";
|
||||
];
|
||||
name = "law_structure_map";
|
||||
}]
|
||||
},
|
||||
visitors
|
||||
{
|
||||
variety = "iter";
|
||||
ancestors =
|
||||
[
|
||||
"law_include_iter";
|
||||
"law_article_iter";
|
||||
"law_article_item_iter";
|
||||
"code_block_iter";
|
||||
"source_repr_iter";
|
||||
"law_heading_iter";
|
||||
];
|
||||
name = "law_structure_iter";
|
||||
}]
|
||||
|
||||
type program_item = LawStructure of law_structure
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "law_structure_map" ]; name = "program_item_map" }]
|
||||
visitors { variety = "map"; ancestors = [ "law_structure_map" ]; name = "program_item_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "law_structure_iter" ]; name = "program_item_iter" }]
|
||||
|
||||
type program = { program_items : program_item list; program_source_files : (string[@opaque]) list }
|
||||
[@@deriving visitors { variety = "map"; ancestors = [ "program_item_map" ]; name = "program_map" }]
|
||||
[@@deriving
|
||||
visitors { variety = "map"; ancestors = [ "program_item_map" ]; name = "program_map" },
|
||||
visitors { variety = "iter"; ancestors = [ "program_item_iter" ]; name = "program_iter" }]
|
||||
|
||||
type source_file_or_master =
|
||||
| SourceFile of program_item list
|
||||
|
@ -192,3 +192,11 @@ class ['self] marked_map =
|
||||
method visit_marked : 'a. ('env -> 'a -> 'a) -> 'env -> 'a marked -> 'a marked =
|
||||
fun f env x -> same_pos_as (f env (unmark x)) x
|
||||
end
|
||||
|
||||
class ['self] marked_iter =
|
||||
object (_self : 'self)
|
||||
constraint 'self = < visit_marked : 'a. ('env -> 'a -> unit) -> 'env -> 'a marked -> unit ; .. >
|
||||
|
||||
method visit_marked : 'a. ('env -> 'a -> unit) -> 'env -> 'a marked -> unit =
|
||||
fun f env x -> f env (unmark x)
|
||||
end
|
||||
|
@ -81,3 +81,10 @@ class ['self] marked_map :
|
||||
|
||||
method visit_marked : 'a. ('env -> 'a -> 'a) -> 'env -> 'a marked -> 'a marked
|
||||
end
|
||||
|
||||
class ['self] marked_iter :
|
||||
object ('self)
|
||||
constraint 'self = < visit_marked : 'a. ('env -> 'a -> unit) -> 'env -> 'a marked -> unit ; .. >
|
||||
|
||||
method visit_marked : 'a. ('env -> 'a -> unit) -> 'env -> 'a marked -> unit
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user