--- /dev/null
+/* Generated by re2c */
+#include <stdio.h>
+#include <string.h>
+
+static const size_t SIZE = 4096;
+
+struct input_t {
+ char buf[SIZE + 1];
+ char *lim;
+ char *cur;
+ char *tok;
+ bool eof;
+
+ input_t()
+ : buf()
+ , lim(buf + SIZE)
+ , cur(lim)
+ , tok(lim)
+ , eof(false)
+ {
+ fill();
+ }
+ int fill()
+ {
+ if (eof) {
+ return 1;
+ }
+ const size_t free = tok - buf;
+ if (free < 1) {
+ return 2;
+ }
+ memmove(buf, tok, lim - tok);
+ lim -= free;
+ cur -= free;
+ tok -= free;
+ lim += fread(lim, 1, free, stdin);
+ lim[0] = 255;
+ if (lim < buf + SIZE) {
+ eof = true;
+ }
+ return 0;
+ }
+};
+
+static bool lex(input_t & in, unsigned int &count)
+{
+ for (count = 0;;) {
+ in.tok = in.cur;
+
+{
+ char yych;
+yy1:
+yy1_:
+ yych = *in.cur;
+ switch (yych) {
+ case '\n': goto yy4;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': goto yy7;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy1_;
+ else goto yyeof;
+ }
+ goto yy2;
+ }
+yy2:
+ ++in.cur;
+ { return false; }
+yy4:
+ ++in.cur;
+yy4_:
+ yych = *in.cur;
+yy5:
+ switch (yych) {
+ case '\n': goto yy4;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy4_;
+ }
+ goto yy6;
+ }
+yy6:
+ { continue; }
+yy7:
+ ++in.cur;
+yy7_:
+ yych = *in.cur;
+yy8:
+ switch (yych) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': goto yy7;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy7_;
+ }
+ goto yy9;
+ }
+yy9:
+ { ++count; continue; }
+yyeof:
+ { return true; }
+}
+
+ }
+}
+
+int main()
+{
+ input_t in;
+ unsigned int count;
+ if (lex(in, count)) {
+ printf("glorious %u numbers!\n", count);
+ } else {
+ printf("error\n");
+ }
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+static const size_t SIZE = 4096;
+
+struct input_t {
+ char buf[SIZE + 1];
+ char *lim;
+ char *cur;
+ char *tok;
+ bool eof;
+
+ input_t()
+ : buf()
+ , lim(buf + SIZE)
+ , cur(lim)
+ , tok(lim)
+ , eof(false)
+ {
+ fill();
+ }
+ int fill()
+ {
+ if (eof) {
+ return 1;
+ }
+ const size_t free = tok - buf;
+ if (free < 1) {
+ return 2;
+ }
+ memmove(buf, tok, lim - tok);
+ lim -= free;
+ cur -= free;
+ tok -= free;
+ lim += fread(lim, 1, free, stdin);
+ lim[0] = 255;
+ if (lim < buf + SIZE) {
+ eof = true;
+ }
+ return 0;
+ }
+};
+
+static bool lex(input_t & in, unsigned int &count)
+{
+ for (count = 0;;) {
+ in.tok = in.cur;
+ /*!re2c
+ re2c:define:YYCTYPE = char;
+ re2c:define:YYCURSOR = in.cur;
+ re2c:define:YYLIMIT = in.lim;
+ re2c:define:YYFILL = "in.fill";
+ re2c:eof = 255;
+
+ wsp = [\n]+;
+ num = [0-9]+;
+
+ * { return false; }
+ $ { return true; }
+ wsp { continue; }
+ num { ++count; continue; }
+ */
+ }
+}
+
+int main()
+{
+ input_t in;
+ unsigned int count;
+ if (lex(in, count)) {
+ printf("glorious %u numbers!\n", count);
+ } else {
+ printf("error\n");
+ }
+
+ return 0;
+}
--- /dev/null
+/* Generated by re2c */
+#include <stdio.h>
+#include <string.h>
+
+static const size_t SIZE = 4096;
+
+struct input_t {
+ char buf[SIZE + 1];
+ char *lim;
+ char *cur;
+ char *tok;
+ bool eof;
+
+ input_t()
+ : buf()
+ , lim(buf + SIZE)
+ , cur(lim)
+ , tok(lim)
+ , eof(false)
+ {
+ fill();
+ }
+ int fill()
+ {
+ if (eof) {
+ return 1;
+ }
+ const size_t free = tok - buf;
+ if (free < 1) {
+ return 2;
+ }
+ memmove(buf, tok, lim - tok);
+ lim -= free;
+ cur -= free;
+ tok -= free;
+ lim += fread(lim, 1, free, stdin);
+ lim[0] = 254;
+ if (lim < buf + SIZE) {
+ eof = true;
+ }
+ return 0;
+ }
+};
+
+static bool lex(input_t & in, unsigned int &count)
+{
+ for (count = 0;;) {
+ in.tok = in.cur;
+
+{
+ char yych;
+yy1:
+yy1_:
+ yych = *in.cur;
+ switch (yych) {
+ case '\n': goto yy4;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': goto yy7;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy1_;
+ else goto yyeof;
+ }
+ goto yy2;
+ }
+yy2:
+ ++in.cur;
+ { return false; }
+yy4:
+ ++in.cur;
+yy4_:
+ yych = *in.cur;
+yy5:
+ switch (yych) {
+ case '\n': goto yy4;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy4_;
+ }
+ goto yy6;
+ }
+yy6:
+ { continue; }
+yy7:
+ ++in.cur;
+yy7_:
+ yych = *in.cur;
+yy8:
+ switch (yych) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': goto yy7;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy7_;
+ }
+ goto yy9;
+ }
+yy9:
+ { ++count; continue; }
+yyeof:
+ { return true; }
+}
+
+ }
+}
+
+int main()
+{
+ input_t in;
+ unsigned int count;
+ if (lex(in, count)) {
+ printf("glorious %u numbers!\n", count);
+ } else {
+ printf("error\n");
+ }
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+static const size_t SIZE = 4096;
+
+struct input_t {
+ char buf[SIZE + 1];
+ char *lim;
+ char *cur;
+ char *tok;
+ bool eof;
+
+ input_t()
+ : buf()
+ , lim(buf + SIZE)
+ , cur(lim)
+ , tok(lim)
+ , eof(false)
+ {
+ fill();
+ }
+ int fill()
+ {
+ if (eof) {
+ return 1;
+ }
+ const size_t free = tok - buf;
+ if (free < 1) {
+ return 2;
+ }
+ memmove(buf, tok, lim - tok);
+ lim -= free;
+ cur -= free;
+ tok -= free;
+ lim += fread(lim, 1, free, stdin);
+ lim[0] = 254;
+ if (lim < buf + SIZE) {
+ eof = true;
+ }
+ return 0;
+ }
+};
+
+static bool lex(input_t & in, unsigned int &count)
+{
+ for (count = 0;;) {
+ in.tok = in.cur;
+ /*!re2c
+ re2c:define:YYCTYPE = char;
+ re2c:define:YYCURSOR = in.cur;
+ re2c:define:YYLIMIT = in.lim;
+ re2c:define:YYFILL = "in.fill";
+ re2c:eof = 254;
+
+ wsp = [\n]+;
+ num = [0-9]+;
+
+ * { return false; }
+ $ { return true; }
+ wsp { continue; }
+ num { ++count; continue; }
+ */
+ }
+}
+
+int main()
+{
+ input_t in;
+ unsigned int count;
+ if (lex(in, count)) {
+ printf("glorious %u numbers!\n", count);
+ } else {
+ printf("error\n");
+ }
+
+ return 0;
+}
--- /dev/null
+/* Generated by re2c */
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+static const size_t SIZE = 4096;
+
+struct input_t {
+ uint8_t buf[SIZE + 1];
+ uint8_t *lim;
+ uint8_t *cur;
+ uint8_t *mar;
+ uint8_t *tok;
+ bool eof;
+
+ input_t()
+ : buf()
+ , lim(buf + SIZE)
+ , cur(lim)
+ , mar(lim)
+ , tok(lim)
+ , eof(false)
+ {
+ fill();
+ }
+ int fill()
+ {
+ if (eof) {
+ return 1;
+ }
+ const size_t free = tok - buf;
+ if (free < 1) {
+ return 2;
+ }
+ memmove(buf, tok, lim - tok);
+ lim -= free;
+ cur -= free;
+ mar -= free;
+ tok -= free;
+ lim += fread(lim, 1, free, stdin);
+ lim[0] = 255;
+ if (lim < buf + SIZE) {
+ eof = true;
+ }
+ return 0;
+ }
+};
+
+static bool lex(input_t & in, unsigned int &count)
+{
+ for (count = 0;;) {
+ in.tok = in.cur;
+
+{
+ uint8_t yych;
+ unsigned int yyaccept = 0;
+yy1:
+yy1_:
+ yych = *in.cur;
+ switch (yych) {
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ case '\t':
+ case '\v':
+ case '\f':
+ case '\r':
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ case 0x18:
+ case 0x19:
+ case 0x1A:
+ case 0x1B:
+ case 0x1C:
+ case 0x1D:
+ case 0x1E:
+ case 0x1F:
+ case ' ':
+ case '!':
+ case '"':
+ case '#':
+ case '$':
+ case '%':
+ case '&':
+ case '\'':
+ case '(':
+ case ')':
+ case '*':
+ case '+':
+ case ',':
+ case '-':
+ case '.':
+ case '/':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ':':
+ case ';':
+ case '<':
+ case '=':
+ case '>':
+ case '?':
+ case '@':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '[':
+ case '\\':
+ case ']':
+ case '^':
+ case '_':
+ case '`':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ case '{':
+ case '|':
+ case '}':
+ case '~':
+ case 0x7F: goto yy2;
+ case '\n': goto yy5;
+ case 0xC2:
+ case 0xC3:
+ case 0xC4:
+ case 0xC5:
+ case 0xC6:
+ case 0xC7:
+ case 0xC8:
+ case 0xC9:
+ case 0xCA:
+ case 0xCB:
+ case 0xCC:
+ case 0xCD:
+ case 0xCE:
+ case 0xCF:
+ case 0xD0:
+ case 0xD1:
+ case 0xD2:
+ case 0xD3:
+ case 0xD4:
+ case 0xD5:
+ case 0xD6:
+ case 0xD7:
+ case 0xD8:
+ case 0xD9:
+ case 0xDA:
+ case 0xDB:
+ case 0xDC:
+ case 0xDD:
+ case 0xDE:
+ case 0xDF: goto yy10;
+ case 0xE0: goto yy11;
+ case 0xE1:
+ case 0xE2:
+ case 0xE3:
+ case 0xE4:
+ case 0xE5:
+ case 0xE6:
+ case 0xE7:
+ case 0xE8:
+ case 0xE9:
+ case 0xEA:
+ case 0xEB:
+ case 0xEC:
+ case 0xED:
+ case 0xEE:
+ case 0xEF: goto yy12;
+ case 0xF0: goto yy13;
+ case 0xF1:
+ case 0xF2:
+ case 0xF3: goto yy14;
+ case 0xF4: goto yy15;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy1_;
+ else goto yyeof;
+ }
+ goto yy8;
+ }
+yy2:
+ yyaccept = 0;
+ in.mar = ++in.cur;
+yy2_:
+ yych = *in.cur;
+yy3:
+ switch (yych) {
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ case '\t':
+ case '\v':
+ case '\f':
+ case '\r':
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ case 0x18:
+ case 0x19:
+ case 0x1A:
+ case 0x1B:
+ case 0x1C:
+ case 0x1D:
+ case 0x1E:
+ case 0x1F:
+ case ' ':
+ case '!':
+ case '"':
+ case '#':
+ case '$':
+ case '%':
+ case '&':
+ case '\'':
+ case '(':
+ case ')':
+ case '*':
+ case '+':
+ case ',':
+ case '-':
+ case '.':
+ case '/':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case ':':
+ case ';':
+ case '<':
+ case '=':
+ case '>':
+ case '?':
+ case '@':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '[':
+ case '\\':
+ case ']':
+ case '^':
+ case '_':
+ case '`':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ case '{':
+ case '|':
+ case '}':
+ case '~':
+ case 0x7F: goto yy2;
+ case 0xC2:
+ case 0xC3:
+ case 0xC4:
+ case 0xC5:
+ case 0xC6:
+ case 0xC7:
+ case 0xC8:
+ case 0xC9:
+ case 0xCA:
+ case 0xCB:
+ case 0xCC:
+ case 0xCD:
+ case 0xCE:
+ case 0xCF:
+ case 0xD0:
+ case 0xD1:
+ case 0xD2:
+ case 0xD3:
+ case 0xD4:
+ case 0xD5:
+ case 0xD6:
+ case 0xD7:
+ case 0xD8:
+ case 0xD9:
+ case 0xDA:
+ case 0xDB:
+ case 0xDC:
+ case 0xDD:
+ case 0xDE:
+ case 0xDF: goto yy16;
+ case 0xE0: goto yy18;
+ case 0xE1:
+ case 0xE2:
+ case 0xE3:
+ case 0xE4:
+ case 0xE5:
+ case 0xE6:
+ case 0xE7:
+ case 0xE8:
+ case 0xE9:
+ case 0xEA:
+ case 0xEB:
+ case 0xEC:
+ case 0xED:
+ case 0xEE:
+ case 0xEF: goto yy19;
+ case 0xF0: goto yy20;
+ case 0xF1:
+ case 0xF2:
+ case 0xF3: goto yy21;
+ case 0xF4: goto yy22;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy2_;
+ }
+ goto yy4;
+ }
+yy4:
+ { ++count; continue; }
+yy5:
+ ++in.cur;
+yy5_:
+ yych = *in.cur;
+yy6:
+ switch (yych) {
+ case '\n': goto yy5;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy5_;
+ }
+ goto yy7;
+ }
+yy7:
+ { continue; }
+yy8:
+ ++in.cur;
+yy9:
+ { return false; }
+yy10:
+ ++in.cur;
+yy10_:
+ yych = *in.cur;
+ 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 yy2;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy10_;
+ }
+ goto yy9;
+ }
+yy11:
+ yyaccept = 1;
+ in.mar = ++in.cur;
+yy11_:
+ yych = *in.cur;
+ 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 yy16;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy11_;
+ }
+ goto yy9;
+ }
+yy12:
+ yyaccept = 1;
+ in.mar = ++in.cur;
+yy12_:
+ yych = *in.cur;
+ 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 yy16;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy12_;
+ }
+ goto yy9;
+ }
+yy13:
+ yyaccept = 1;
+ in.mar = ++in.cur;
+yy13_:
+ yych = *in.cur;
+ switch (yych) {
+ 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 yy19;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy13_;
+ }
+ goto yy9;
+ }
+yy14:
+ yyaccept = 1;
+ in.mar = ++in.cur;
+yy14_:
+ yych = *in.cur;
+ 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 yy19;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy14_;
+ }
+ goto yy9;
+ }
+yy15:
+ yyaccept = 1;
+ in.mar = ++in.cur;
+yy15_:
+ yych = *in.cur;
+ 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: goto yy19;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy15_;
+ }
+ goto yy9;
+ }
+yy16:
+ ++in.cur;
+yy16_:
+ yych = *in.cur;
+ 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 yy2;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy16_;
+ }
+ goto yy17;
+ }
+yy17:
+ in.cur = in.mar;
+ if (yyaccept == 0) {
+ goto yy4;
+ } else {
+ goto yy9;
+ }
+yy18:
+ ++in.cur;
+yy18_:
+ yych = *in.cur;
+ 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 yy16;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy18_;
+ }
+ goto yy17;
+ }
+yy19:
+ ++in.cur;
+yy19_:
+ yych = *in.cur;
+ 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 yy16;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy19_;
+ }
+ goto yy17;
+ }
+yy20:
+ ++in.cur;
+yy20_:
+ yych = *in.cur;
+ switch (yych) {
+ 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 yy19;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy20_;
+ }
+ goto yy17;
+ }
+yy21:
+ ++in.cur;
+yy21_:
+ yych = *in.cur;
+ 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 yy19;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy21_;
+ }
+ goto yy17;
+ }
+yy22:
+ ++in.cur;
+yy22_:
+ yych = *in.cur;
+ 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: goto yy19;
+ default:
+ if (in.lim <= in.cur) {
+ if (in.fill () == 0) goto yy22_;
+ }
+ goto yy17;
+ }
+yyeof:
+ { return true; }
+}
+
+ }
+}
+
+int main()
+{
+ input_t in;
+ unsigned int count;
+ if (lex(in, count)) {
+ printf("glorious %u numbers!\n", count);
+ } else {
+ printf("error\n");
+ }
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+static const size_t SIZE = 4096;
+
+struct input_t {
+ uint8_t buf[SIZE + 1];
+ uint8_t *lim;
+ uint8_t *cur;
+ uint8_t *mar;
+ uint8_t *tok;
+ bool eof;
+
+ input_t()
+ : buf()
+ , lim(buf + SIZE)
+ , cur(lim)
+ , mar(lim)
+ , tok(lim)
+ , eof(false)
+ {
+ fill();
+ }
+ int fill()
+ {
+ if (eof) {
+ return 1;
+ }
+ const size_t free = tok - buf;
+ if (free < 1) {
+ return 2;
+ }
+ memmove(buf, tok, lim - tok);
+ lim -= free;
+ cur -= free;
+ mar -= free;
+ tok -= free;
+ lim += fread(lim, 1, free, stdin);
+ lim[0] = 255;
+ if (lim < buf + SIZE) {
+ eof = true;
+ }
+ return 0;
+ }
+};
+
+static bool lex(input_t & in, unsigned int &count)
+{
+ for (count = 0;;) {
+ in.tok = in.cur;
+ /*!re2c
+ re2c:define:YYCTYPE = uint8_t;
+ re2c:define:YYCURSOR = in.cur;
+ re2c:define:YYMARKER = in.mar;
+ re2c:define:YYLIMIT = in.lim;
+ re2c:define:YYFILL = in.fill;
+ re2c:eof = 255;
+
+ wsp = [\n]+;
+ num = .+;
+
+ * { return false; }
+ $ { return true; }
+ wsp { continue; }
+ num { ++count; continue; }
+ */
+ }
+}
+
+int main()
+{
+ input_t in;
+ unsigned int count;
+ if (lex(in, count)) {
+ printf("glorious %u numbers!\n", count);
+ } else {
+ printf("error\n");
+ }
+
+ return 0;
+}