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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* Generated by re2c */
#line 1 "unicode_group_Lt.8--encoding-policy(fail).re"
#include <stdio.h>
#include "utf8.h"
#define YYCTYPE unsigned char
bool scan(const YYCTYPE * start, const YYCTYPE * const limit)
{
__attribute__((unused)) const YYCTYPE * YYMARKER; // silence compiler warnings when YYMARKER is not used
# define YYCURSOR start
Lt:
#line 13 "unicode_group_Lt.8--encoding-policy(fail).c"
{
YYCTYPE yych;
yych = *YYCURSOR;
switch (yych) {
case 0xC7: goto yy4;
case 0xE1: goto yy5;
default: goto yy2;
}
yy2:
++YYCURSOR;
yy3:
#line 13 "unicode_group_Lt.8--encoding-policy(fail).re"
{ return YYCURSOR == limit; }
#line 27 "unicode_group_Lt.8--encoding-policy(fail).c"
yy4:
yych = *++YYCURSOR;
switch (yych) {
case 0x85:
case 0x88:
case 0x8B:
case 0xB2: goto yy6;
default: goto yy3;
}
yy5:
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case 0xBE: goto yy8;
case 0xBF: goto yy10;
default: goto yy3;
}
yy6:
++YYCURSOR;
#line 12 "unicode_group_Lt.8--encoding-policy(fail).re"
{ goto Lt; }
#line 48 "unicode_group_Lt.8--encoding-policy(fail).c"
yy8:
yych = *++YYCURSOR;
switch (yych) {
case 0x88:
case 0x89:
case 0x8A:
case 0x8B:
case 0x8C:
case 0x8D:
case 0x8E:
case 0x8F:
case 0x98:
case 0x99:
case 0x9A:
case 0x9B:
case 0x9C:
case 0x9D:
case 0x9E:
case 0x9F:
case 0xA8:
case 0xA9:
case 0xAA:
case 0xAB:
case 0xAC:
case 0xAD:
case 0xAE:
case 0xAF:
case 0xBC: goto yy6;
default: goto yy9;
}
yy9:
YYCURSOR = YYMARKER;
goto yy3;
yy10:
yych = *++YYCURSOR;
switch (yych) {
case 0x8C:
case 0xBC: goto yy6;
default: goto yy9;
}
}
#line 14 "unicode_group_Lt.8--encoding-policy(fail).re"
}
static const unsigned int chars_Lt [] = {0x1c5,0x1c5, 0x1c8,0x1c8, 0x1cb,0x1cb, 0x1f2,0x1f2, 0x1f88,0x1f8f, 0x1f98,0x1f9f, 0x1fa8,0x1faf, 0x1fbc,0x1fbc, 0x1fcc,0x1fcc, 0x1ffc,0x1ffc, 0x0,0x0};
static unsigned int encode_utf8 (const unsigned int * ranges, unsigned int ranges_count, unsigned char * s)
{
unsigned char * const s_start = s;
for (unsigned int i = 0; i < ranges_count - 2; i += 2)
for (unsigned int j = ranges[i]; j <= ranges[i + 1]; ++j)
s += re2c::utf8::rune_to_bytes (s, j);
re2c::utf8::rune_to_bytes (s, ranges[ranges_count - 1]);
return s - s_start + 1;
}
int main ()
{
YYCTYPE * buffer_Lt = new YYCTYPE [128];
unsigned int buffer_len = encode_utf8 (chars_Lt, sizeof (chars_Lt) / sizeof (unsigned int), buffer_Lt);
if (!scan (reinterpret_cast<const YYCTYPE *> (buffer_Lt), reinterpret_cast<const YYCTYPE *> (buffer_Lt + buffer_len)))
printf("test 'Lt' failed\n");
delete [] buffer_Lt;
return 0;
}
|