File: colscan.mll

package info (click to toggle)
hevea 1.10-5
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,052 kB
  • ctags: 2,379
  • sloc: ml: 19,637; sh: 308; makefile: 224
file content (45 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download | duplicates (5)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(***********************************************************************)
(*                                                                     *)
(*                          HEVEA                                      *)
(*                                                                     *)
(*  Luc Maranget, projet Moscova, INRIA Rocquencourt                   *)
(*                                                                     *)
(*  Copyright 2001 Institut National de Recherche en Informatique et   *)
(*  Automatique.  Distributed only by permission.                      *)
(*                                                                     *)
(*  $Id: colscan.mll,v 1.6 2001/11/14 12:57:04 maranget Exp $          *)
(***********************************************************************)
{
open Lexing

exception Error of string
;;

let buf = Out.create_buff ()
;;
} 
rule one = parse
| ' '+ {one lexbuf}
| ('0'|'1')?'.'?['0'-'9']*
  {let lxm = lexeme lexbuf in
  try float_of_string lxm with _ -> assert false}
| "" {raise (Error "Syntax error in color argument")}

and other = parse
  ' '* ',' {one lexbuf}
|  ""      {raise (Error "Syntax error in color argument")}

and three = parse
  ""
  {let fst = one lexbuf in
  let snd = other lexbuf in
  let thrd = other lexbuf in
  fst,snd,thrd}
and four = parse
  ""
  {let fst = one lexbuf in
  let snd = other lexbuf in
  let thrd = other lexbuf in
  let fourth = other lexbuf in
  fst,snd,thrd,fourth}