~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to ide/find_phrase.mll

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(************************************************************************)
 
2
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
 
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
 
4
(*   \VV/  **************************************************************)
 
5
(*    //   *      This file is distributed under the terms of the       *)
 
6
(*         *       GNU Lesser General Public License Version 2.1        *)
 
7
(************************************************************************)
 
8
 
 
9
(* $Id: find_phrase.mll 9240 2006-10-13 17:51:11Z notin $ *)
 
10
 
 
11
{
 
12
  exception Lex_error of string
 
13
  let length = ref 0
 
14
  let buff = Buffer.create 513
 
15
 
 
16
}
 
17
 
 
18
let phrase_sep = '.'
 
19
 
 
20
rule next_phrase = parse
 
21
  | "(*" { incr length; incr length; 
 
22
           skip_comment lexbuf;
 
23
           next_phrase lexbuf}
 
24
  | '"'[^'"']*'"' { let lexeme = Lexing.lexeme lexbuf in 
 
25
                 let ulen = Glib.Utf8.length lexeme in
 
26
                 length := !length + ulen;
 
27
                 Buffer.add_string buff lexeme;
 
28
                 next_phrase lexbuf
 
29
               }
 
30
  | phrase_sep[' ''\n''\t''\r'] {
 
31
        begin 
 
32
          if !Preferences.current.Preferences.lax_syntax 
 
33
          then length := !length + 1
 
34
          else length := !length + 2
 
35
        end;
 
36
      Buffer.add_string buff (Lexing.lexeme lexbuf);
 
37
      Buffer.contents buff}
 
38
 
 
39
  | phrase_sep eof{
 
40
      length := !length + 1; 
 
41
      Buffer.add_string buff (Lexing.lexeme lexbuf);
 
42
      Buffer.contents buff}
 
43
  | phrase_sep phrase_sep
 
44
      { 
 
45
        length := !length + 2; 
 
46
        Buffer.add_string buff (Lexing.lexeme lexbuf);
 
47
        next_phrase lexbuf
 
48
      }
 
49
  | _ 
 
50
      { 
 
51
        let c = Lexing.lexeme_char lexbuf 0 in 
 
52
        if Ideutils.is_char_start c then incr length; 
 
53
        Buffer.add_char buff c ;
 
54
        next_phrase lexbuf
 
55
      }
 
56
  | eof  { raise (Lex_error "Phrase should end with . followed by a separator") }
 
57
and skip_comment = parse
 
58
  | "*)" {incr length; incr length; ()}
 
59
  | "(*" {incr length; incr length; 
 
60
          skip_comment lexbuf;
 
61
          skip_comment lexbuf}
 
62
  | _  { if Ideutils.is_char_start (Lexing.lexeme_char lexbuf 0) then 
 
63
           incr length; 
 
64
         skip_comment lexbuf}
 
65
  | eof  { raise (Lex_error "No closing *)") }
 
66
 
 
67
 
 
68
{
 
69
  let get lb = 
 
70
    Buffer.reset buff;
 
71
    length := 0;
 
72
    next_phrase lb
 
73
 
 
74
}