2002-03-27 08:20:32 -08:00
|
|
|
{
|
|
|
|
(***********************************************************************)
|
|
|
|
(* 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. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
let print_DEBUG2 s = print_string s ; print_newline ()
|
|
|
|
|
|
|
|
(** the lexer for special comments. *)
|
|
|
|
|
|
|
|
open Lexing
|
|
|
|
open Odoc_parser
|
|
|
|
|
|
|
|
let buf = Buffer.create 32
|
|
|
|
|
2010-01-22 04:48:24 -08:00
|
|
|
}
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
rule main = parse
|
|
|
|
[' ' '\013' '\009' '\012'] +
|
2010-01-22 04:48:24 -08:00
|
|
|
{
|
2002-03-27 08:20:32 -08:00
|
|
|
print_DEBUG2 "[' ' '\013' '\009' '\012'] +";
|
2010-01-22 04:48:24 -08:00
|
|
|
main lexbuf
|
2002-03-27 08:20:32 -08:00
|
|
|
}
|
|
|
|
|
2010-01-22 04:48:24 -08:00
|
|
|
| [ '\010' ]
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
print_DEBUG2 " [ '\010' ] ";
|
2010-01-22 04:48:24 -08:00
|
|
|
main lexbuf
|
2002-03-27 08:20:32 -08:00
|
|
|
}
|
|
|
|
|
2010-01-22 04:48:24 -08:00
|
|
|
| "<"
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
print_DEBUG2 "call url lexbuf" ;
|
2010-01-22 04:48:24 -08:00
|
|
|
url lexbuf
|
|
|
|
}
|
2002-03-27 08:20:32 -08:00
|
|
|
|
2010-01-22 04:48:24 -08:00
|
|
|
| "\""
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
print_DEBUG2 "call doc lexbuf" ;
|
|
|
|
doc lexbuf
|
2010-01-22 04:48:24 -08:00
|
|
|
}
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
| '\''
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
print_DEBUG2 "call file lexbuf" ;
|
|
|
|
file lexbuf
|
2010-01-22 04:48:24 -08:00
|
|
|
}
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
| eof
|
2010-01-22 04:48:24 -08:00
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
print_DEBUG2 "EOF";
|
2010-01-22 04:48:24 -08:00
|
|
|
EOF
|
2002-03-27 08:20:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
| _
|
2010-01-22 04:48:24 -08:00
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
Buffer.reset buf ;
|
2010-01-22 04:48:24 -08:00
|
|
|
Buffer.add_string buf (Lexing.lexeme lexbuf);
|
2002-07-23 07:12:03 -07:00
|
|
|
desc lexbuf
|
2010-01-22 04:48:24 -08:00
|
|
|
}
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
and url = parse
|
|
|
|
| ([^'>'] | '\n')+">"
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
let s = Lexing.lexeme lexbuf in
|
|
|
|
print_DEBUG2 ("([^'>'] | '\n')+ \">\" with "^s) ;
|
|
|
|
See_url (String.sub s 0 ((String.length s) -1))
|
2002-03-27 08:20:32 -08:00
|
|
|
}
|
|
|
|
|
2010-01-22 04:48:24 -08:00
|
|
|
|
2002-03-27 08:20:32 -08:00
|
|
|
and doc = parse
|
|
|
|
| ([^'"'] | '\n' | "\\'")* "\""
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
let s = Lexing.lexeme lexbuf in
|
|
|
|
See_doc (String.sub s 0 ((String.length s) -1))
|
2002-03-27 08:20:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
and file = parse
|
|
|
|
| ([^'\''] | '\n' | "\\\"")* "'"
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
let s = Lexing.lexeme lexbuf in
|
|
|
|
See_file (String.sub s 0 ((String.length s) -1))
|
2002-03-27 08:20:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
and desc = parse
|
|
|
|
eof
|
|
|
|
{ Desc (Buffer.contents buf) }
|
2010-01-22 04:48:24 -08:00
|
|
|
| _
|
|
|
|
{
|
2002-07-23 07:12:03 -07:00
|
|
|
Buffer.add_string buf (Lexing.lexeme lexbuf);
|
|
|
|
desc lexbuf
|
2002-03-27 08:20:32 -08:00
|
|
|
}
|