package dolmen

  1. Overview
  2. Docs
A parser library

Install

Dune Dependency

Authors

Maintainers

Sources

dolmen-v0.5.tbz
sha256=b9a6f80bf13fdf1fd69ff2013f583582fa00e13c86ee6f800737fabcfd530458
sha512=84b8c18e56b3fb20674af0a3729b7e15e543f21b0062c565b575b994388eb55ee8123e5d3d31f5f1042b204544b3084089a024c742ab741ddd7e18b5641dd399

doc/src/dolmen.std/tok.ml.html

Source file tok.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

(* This file is free software, part of dolmen. See file "LICENSE" for more information *)

type descr = Dolmen_intf.Tok.descr = {
  article : string;
  kind : string;
  lexeme : string;
  hint : string option;
}

let descr ?hint ?(article="the") ~kind lexeme = { article; kind; lexeme; hint; }

let print fmt { article; kind; lexeme; _ } =
  let lxm =
    if String.length lexeme < 15
    then lexeme
    else String.sub lexeme 0 14 ^ "…"
  in
  match lxm with
  | "" -> Format.fprintf fmt "%s %s" article kind
  | s -> Format.fprintf fmt "%s %s '%s'" article kind s

OCaml

Innovation. Community. Security.