package libsail
Module Libsail.Chunk_astSource
Module for breaking AST into syntactic chunks and interleaving comments.
This module is part of the Sail formatting system. It takes a parsed AST (not a desugared AST, as for formatting we need to preserve as much as possible), and breaks it up into more abstract syntactic elements - 'chunks' for want of a better term.
Source
and chunk = | Comment of Lexer.comment_type * int * int * string| Spacer of bool * int| Function of {id : Parse_ast.id;clause : bool;rec_opt : chunks option;typq_opt : chunks option;return_typ_opt : chunks option;funcls : (chunks * pexp_chunks) list;
}| Val of {id : Parse_ast.id;extern_opt : Parse_ast.extern option;typq_opt : chunks option;typ : chunks;
}| Enum of {id : Parse_ast.id;enum_functions : chunks list option;members : chunks list;
}| Function_typ of {}| Exists of {}| Typ_quant of {}| App of Parse_ast.id * chunks list| Field of chunks * Parse_ast.id| Tuple of string * string * int * chunks list| Intersperse of string * chunks list| Atom of string| String_literal of string| Pragma of string * string| Unary of string * chunks| Binary of chunks * string * chunks| Ternary of chunks * string * chunks * string * chunks| Infix_sequence of infix_chunk list| Index of chunks * chunks| Delim of string| Opt_delim of string| Block of bool * chunks list| Binder of binder * chunks * chunks * chunks| Block_binder of binder * chunks * chunks| If_then of bool * chunks * chunks| If_then_else of if_format * chunks * chunks * chunks| Struct_update of chunks * chunks list| Match of {kind : match_kind;exp : chunks;aligned : bool;cases : pexp_chunks list;
}| Foreach of {var : chunks;decreasing : bool;from_index : chunks;to_index : chunks;step : chunks option;body : chunks;
}| While of {}| Vector_updates of chunks * chunk list| Chunks of chunks| Raw of string