comparison tools/nclex.mll @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 (* nclex.mll *)
2 (* Copyright (c) 2017 J. M. Spivey *)
3
4 {
5 open Ncparse
6 open String
7 open Lexing
8
9 let line_no = ref 1
10 }
11
12 rule token =
13 parse
14 "<"(['A'-'Z''a'-'z']+|'('[^')']+')' as s) { OPEN s }
15 | [^'<''>''('')'',''@'' ''\n']+ as s { WORD s }
16 | "(*"[^'\n']*"*)" as s { WORD s }
17 | "->" as s { WORD s }
18 | " " { SPACE }
19 | ">" { CLOSE }
20 | "(" { LPAREN }
21 | ")" { RPAREN }
22 | "," { COMMA }
23 | "@" { ATSIGN }
24 | "\n" { incr line_no; CHAR '\n' }
25 | _ as c { CHAR c }
26 | eof { EOF }
27