aboutsummaryrefslogtreecommitdiff
path: root/tools/coqdoc
diff options
context:
space:
mode:
authornotin2008-07-17 10:15:33 +0000
committernotin2008-07-17 10:15:33 +0000
commit724ca60d237360e8ab44652bcd95f86599056b03 (patch)
treecaed1510561e2853d72ef33de6541d9ab2992ded /tools/coqdoc
parentd46b26156b306b8cb8b8867ec48dc43fd0c0e3fa (diff)
- coqdoc: correction d'un bug sur les commentaires imbriqués
- coq_makefile: amélioration des chemins de camlp4/5 git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11231 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'tools/coqdoc')
-rw-r--r--tools/coqdoc/pretty.mll29
1 files changed, 18 insertions, 11 deletions
diff --git a/tools/coqdoc/pretty.mll b/tools/coqdoc/pretty.mll
index b2fa915b6c..b02133285b 100644
--- a/tools/coqdoc/pretty.mll
+++ b/tools/coqdoc/pretty.mll
@@ -56,6 +56,7 @@
let formatted = ref false
let brackets = ref 0
+ let comment_level = ref 0
let backtrack lexbuf = lexbuf.lex_curr_pos <- lexbuf.lex_start_pos
@@ -93,7 +94,8 @@
let reset () =
formatted := false;
- brackets := 0
+ brackets := 0;
+ comment_level := 0
(* erasing of Section/End *)
@@ -386,6 +388,7 @@ rule coq_bol = parse
| space* "(**" space+ "printing" space+
{ eprintf "warning: bad 'printing' command at character %d\n"
(lexeme_start lexbuf); flush stderr;
+ comment_level := 1;
ignore (comment lexbuf);
coq_bol lexbuf }
| space* "(**" space+ "remove" space+ "printing" space+
@@ -395,10 +398,12 @@ rule coq_bol = parse
| space* "(**" space+ "remove" space+ "printing" space+
{ eprintf "warning: bad 'remove printing' command at character %d\n"
(lexeme_start lexbuf); flush stderr;
+ comment_level := 1;
ignore (comment lexbuf);
coq_bol lexbuf }
| space* "(*"
- { let eol = comment lexbuf in
+ { comment_level := 1;
+ let eol = comment lexbuf in
if eol then coq_bol lexbuf else coq lexbuf }
| eof
{ () }
@@ -422,7 +427,8 @@ and coq = parse
Output.end_doc (); Output.start_coq ();
if eol then coq_bol lexbuf else coq lexbuf }
| "(*"
- { let eol = comment lexbuf in
+ { comment_level := 1;
+ let eol = comment lexbuf in
if eol then begin Output.line_break(); coq_bol lexbuf end
else coq lexbuf
}
@@ -557,7 +563,7 @@ and escaped_coq = parse
| "["
{ incr brackets; Output.char '['; escaped_coq lexbuf }
| "(*"
- { ignore (comment lexbuf); escaped_coq lexbuf }
+ { comment_level := 1; ignore (comment lexbuf); escaped_coq lexbuf }
| "*)"
{ (* likely to be a syntax error: we escape *) backtrack lexbuf }
| eof
@@ -592,16 +598,16 @@ and comments = parse
(*s Skip comments *)
and comment = parse
- | "(*" { comment lexbuf }
- | "*)" space* nl { true }
- | "*)" { false }
- | eof { false }
- | _ { comment lexbuf }
+ | "(*" { incr comment_level; comment lexbuf }
+ | "*)" space* nl { decr comment_level; if !comment_level > 0 then comment lexbuf else true }
+ | "*)" { decr comment_level; if !comment_level > 0 then comment lexbuf else false }
+ | eof { false }
+ | _ { comment lexbuf }
and skip_to_dot = parse
| '.' space* nl { true }
| eof | '.' space+ { false}
- | "(*" { ignore (comment lexbuf); skip_to_dot lexbuf }
+ | "(*" { comment_level := 1; ignore (comment lexbuf); skip_to_dot lexbuf }
| _ { skip_to_dot lexbuf }
and body_bol = parse
@@ -617,7 +623,8 @@ and body = parse
| '.' space* nl | '.' space* eof { Output.char '.'; Output.line_break(); true }
| '.' space+ { Output.char '.'; Output.char ' '; false }
| '"' { Output.char '"'; ignore(notation lexbuf); body lexbuf }
- | "(*" { let eol = comment lexbuf in
+ | "(*" { comment_level := 1;
+ let eol = comment lexbuf in
if eol
then begin Output.line_break(); body_bol lexbuf end
else body lexbuf }