-
Notifications
You must be signed in to change notification settings - Fork 1
/
lexer.mll
58 lines (52 loc) · 1.8 KB
/
lexer.mll
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
46
47
48
49
50
51
52
53
54
55
56
57
58
(* -*- mode: Tuareg;-*- *)
(* Filename: lexer.mll *)
(* Authors: lgm *)
(* Creation: Mon Mar 7 11:45:56 2005 *)
(* Copyright: Biosimilarity LLC 2004 - 2006. All rights reserved. *)
(* See LICENSE.BIOSIM in the license directory. *)
(* Description: *)
(* ------------------------------------------------------------------------ *)
{
open Parser;; (* The type token is defined in parser.mli *)
exception Eof;;
}
let white = ' ' | '\t' | '\r' | '\n'
(* let digit = ['0'-'9'] *)
(* let alpha = ['A'-'Z' 'a'-'z'] *)
rule token =
parse
| [' ' '\t' '\r' '\n'] { token lexbuf } (* skip blanks *)
| "//" { comment lexbuf }
| '"' [' ' '!' '#'-'~']* '"'
{ FILENAME(Lexing.lexeme lexbuf) }
| "0" { STOP }
| "<|" { LLIFT }
| "|>" { RLIFT }
| '(' { LPAREN }
| ')' { RPAREN }
| '[' { LBRACK }
| ']' { RBRACK }
| '{' { LCURLY }
| '}' { RCURLY }
| "{|" { LMSET }
| "|}" { RMSET }
| '^' { CARROT }
| "'" { QUOTE }
| "<" { LANGLE }
| ">" { RANGLE }
| '.' { DOT }
| ';' { SEMICOLON }
| '|' { PAR }
| '?' { WHIMPER }
| '~' { TILDE }
| '&' { AMPERSAND }
| "|=" { MODELS }
| "|-" { VALID }
| "geometry" { GEOMETRY }
| "quit" { QUIT }
| "true" { TRUE }
| eof { EOF }
and comment = parse
| ['\n' '\r'] { token lexbuf }
| _ { comment lexbuf }
| eof { EOF }