/* Generated by re2c */ #line 1 "unicode_group_Cs.8--encoding-policy(ignore).re" #include #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 Cs: #line 13 "unicode_group_Cs.8--encoding-policy(ignore).c" { YYCTYPE yych; yych = *YYCURSOR; switch (yych) { case 0xED: goto yy4; default: goto yy2; } yy2: ++YYCURSOR; yy3: #line 13 "unicode_group_Cs.8--encoding-policy(ignore).re" { return YYCURSOR == limit; } #line 26 "unicode_group_Cs.8--encoding-policy(ignore).c" yy4: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: case 0xB8: case 0xB9: case 0xBA: case 0xBB: case 0xBC: case 0xBD: case 0xBE: case 0xBF: goto yy5; default: goto yy3; } yy5: yych = *++YYCURSOR; switch (yych) { case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: case 0x88: case 0x89: case 0x8A: case 0x8B: case 0x8C: case 0x8D: case 0x8E: case 0x8F: case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: case 0x98: case 0x99: case 0x9A: case 0x9B: case 0x9C: case 0x9D: case 0x9E: case 0x9F: case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: case 0xB8: case 0xB9: case 0xBA: case 0xBB: case 0xBC: case 0xBD: case 0xBE: case 0xBF: goto yy7; default: goto yy6; } yy6: YYCURSOR = YYMARKER; goto yy3; yy7: ++YYCURSOR; #line 12 "unicode_group_Cs.8--encoding-policy(ignore).re" { goto Cs; } #line 140 "unicode_group_Cs.8--encoding-policy(ignore).c" } #line 14 "unicode_group_Cs.8--encoding-policy(ignore).re" } static const unsigned int chars_Cs [] = {0xd800,0xdfff, 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_Cs = new YYCTYPE [8196]; unsigned int buffer_len = encode_utf8 (chars_Cs, sizeof (chars_Cs) / sizeof (unsigned int), buffer_Cs); if (!scan (reinterpret_cast (buffer_Cs), reinterpret_cast (buffer_Cs + buffer_len))) printf("test 'Cs' failed\n"); delete [] buffer_Cs; return 0; }