(** Private raw parse tree types. These types represent the output of the structural Menhir parser before normalization. They are flat (no heading hierarchy), store inline content as raw strings, and preserve the parsing order. The normalization phase converts these into the public [Ast] types. *) type raw_list_item = { rli_indent : int; rli_bullet : string; rli_counter_set : int option; rli_checkbox : string option; (** "[ ]", "[X]", or "[-]" *) rli_tag : string option; (** Descriptive list tag text (raw) *) rli_body_lines : string list; (** Continuation lines *) } (** A raw list item as classified by the lexer. Indentation is preserved for later nesting. *) type raw_property = { rp_name : string; rp_value : string option } (** A raw property drawer entry. *) type raw_planning = { rpl_keyword : string; (** DEADLINE, SCHEDULED, or CLOSED *) rpl_timestamp : string; (** Raw timestamp text *) } (** A raw planning line. *) (** A raw table row. *) type raw_table_row = | Raw_table_standard of string (** | cell | cell | ... *) | Raw_table_rule (** |---+---| *) (** A block body. Opaque blocks store raw text; recursive blocks store nested raw elements. *) type raw_block_body = | Opaque_body of string (** Source, example, export, comment *) | Recursive_body of raw_element list (** Quote, center, verse, custom *) (** A raw element produced by the structural parser. *) and raw_element = | Raw_heading of raw_heading | Raw_paragraph of string list (** Consecutive text lines *) | Raw_list_items of raw_list_item list (** Consecutive list items *) | Raw_table of raw_table_row list (** Table rows *) | Raw_block of raw_block | Raw_drawer of raw_drawer | Raw_keyword of string * string (** key, value *) | Raw_affiliated of string * string option * string (** name, optional, value *) | Raw_comment of string list (** Consecutive comment lines *) | Raw_fixed_width of string list (** Consecutive fixed-width lines *) | Raw_horizontal_rule | Raw_planning of raw_planning list (** Planning line entries *) | Raw_property_drawer of raw_property list (** Property drawer *) and raw_block = { rb_name : string; (** Block type name (src, quote, etc.) *) rb_params : string option; (** Parameters after #+begin_NAME *) rb_body : raw_block_body; } (** A raw block. *) and raw_drawer = { rd_name : string; rd_contents : raw_element list } (** A raw drawer. *) and raw_heading = { rh_level : int; rh_raw_title : string; (** Everything after stars, to be parsed for TODO/priority/tags/inline *) rh_body : raw_element list; (** Elements until next heading of same or higher level *) } (** A raw heading (flat — no hierarchy yet). *) type document = { rd_preamble : raw_element list; rd_headings : raw_heading list; } (** A raw document produced by the structural parser. *)