blob: e8a7a731812acb910053c3f5bb6d32d04331fd99 (
plain)
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
|
{
open Parser
exception SyntaxError of string
}
let digit = ['0'-'9']
let frac = '.' digit*
let exp = ['e' 'E'] ['-' '+']? digit+
let float = digit* frac? exp?
let white = [' ' '\t']+
let newline = '\r' | '\n' | "\r\n"
let id = ['a'-'z' 'A'-'Z' '_']*
rule read =
parse
| white { read lexbuf }
| id { IDENTIFIER (Lexing.lexeme lexbuf) }
| "uuidv4" { UUIDV4 }
| "name" { NAME }
| ":" { COLON }
| "," { COMMA }
| "\n" { NEWLINE }
| "." { DOT }
| eof { EOF }
| _ as c { failwith (Printf.sprintf "unexpected character: %C" c) }
|