12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061(*
* uTop_token.ml
* -------------
* Copyright : (c) 2011, Jeremie Dimino <jeremie@dimino.org>
* Licence : BSD3
*
* This file is a part of utop.
*)(** Tokens.
The type of tokens is semi-structured: parentheses construct and
quotations are nested and others tokens are flat list. *)(** Locations in the source string, which is encoded in UTF-8. *)typelocation={idx1:int;(** Start position in unicode characters. *)idx2:int;(** Stop position in unicode characters. *)ofs1:int;(** Start position in bytes. *)ofs2:int;(** Stop position in bytes. *)}typet=|Symbolofstring|Lidentofstring|Uidentofstring|Constantofstring|Char|Stringofint*bool(** [String (quote_size, terminated)]. *)|Commentofcomment_kind*bool(** [Comment (kind, terminated)]. *)|Blanks|Error|Quotationof(quotation_item*location)list*bool(** [Quotation (items, terminated)]. *)andcomment_kind=|Comment_reg(** Regular comment. *)|Comment_doc(** Documentation comment. *)andquotation_item=|Quot_data|Quot_antiofantiquotationandantiquotation={a_opening:location;(** Location of the opening [$]. *)a_closing:locationoption;(** Location of the closing [$]. *)a_name:(location*location)option;(** Location of the name and colon if any. *)a_contents:(t*location)list;(** Contents of the location. *)}