1
(* $Id: uReStrLexer.mll,v 1.4 2003/12/19 17:24:34 yori Exp $
2
Copyright 2003 Yamagata Yoriyuki *)
8
let ascii_char = ['\000'-'\127']
11
['\194'-'\223']['\128'-'\191']
12
| ['\224'-'\239']['\128'-'\191']['\128'-'\191']
13
| ['\240'-'\247']['\128'-'\191']['\128'-'\191']['\128'-'\191']
14
| ['\248'-'\251']['\128'-'\191']['\128'-'\191']['\128'-'\191']['\128'-'\191']
15
| ['\252'-'\253']['\128'-'\191']['\128'-'\191']['\128'-'\191']['\128'-'\191']['\128'-'\191']
17
let hex_char = ['0'-'9''a'-'f''A'-'F']
34
| "\\{" ['0'-'9']+ (',' ['0'-'9']*)? "\\}" {
35
let s = Lexing.lexeme lexbuf in
37
let n = String.index s ',' in
38
let s1 = String.sub s 2 (n - 2) in
39
let n1 = int_of_string s1 in
40
let len2 = String.length s - n - 3 in
41
if len2 <= 0 then REPN (n1, None, s) else
42
let s2 = String.sub s (n + 1) len2 in
43
let m = int_of_string s2 in
46
let s1 = String.sub s 2 (String.length s - 4) in
47
let n = int_of_string s1 in
55
| "\\u" hex_char hex_char hex_char hex_char
56
| "\\U" hex_char hex_char hex_char hex_char hex_char hex_char hex_char hex_char
57
{let s = Lexing.lexeme lexbuf in
58
let s = "0x" ^ (String.sub s 2 (String.length s - 2)) in
59
let n = int_of_string s in
60
UCHAR (UChar.chr_of_uint n)}
62
let s = Lexing.lexeme lexbuf in
65
let s = Lexing.lexeme lexbuf in
67
UCHAR (UTF8.look s 2)}
69
let s = Lexing.lexeme lexbuf in
72
let s = Lexing.lexeme lexbuf in
74
UCHAR (UTF8.look s 0)}