summaryrefslogtreecommitdiffstats
path: root/ocamldoc/odoc_text.ml
blob: 5a712e5b4cea5ecb7466e24807788f405c52bef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(***********************************************************************)
(*                             OCamldoc                                *)
(*                                                                     *)
(*            Maxence Guesdon, projet Cristal, INRIA Rocquencourt      *)
(*                                                                     *)
(*  Copyright 2001 Institut National de Recherche en Informatique et   *)
(*  en Automatique.  All rights reserved.  This file is distributed    *)
(*  under the terms of the Q Public License version 1.0.               *)
(*                                                                     *)
(***********************************************************************)


exception Text_syntax of int * int * string (* line, char, string *)

module Texter =
  struct
    (* builds a text structure from a string. *)
    let text_of_string s =
      let lexbuf = Lexing.from_string s in
      try
	Odoc_text_lexer.init ();
	Odoc_text_parser.main Odoc_text_lexer.main lexbuf
      with
	_ ->
	  raise (Text_syntax (!Odoc_text_lexer.line_number, 
			      !Odoc_text_lexer.char_number, 
			      s)
		)
  end