/* Generated by re2c */
#include <stdio.h>
#include <stdlib.h>
#include <vector>

struct mtag_t
{
    int pred;
    const char *tag;
};

typedef std::vector<mtag_t> mtagpool_t;

static void mtag(int *pt, const char *t, mtagpool_t *tp)
{
    mtag_t l = {*pt, t};
    *pt = (int) tp->size();
    tp->push_back(l);
}

static void print_channels(const mtagpool_t &tp, int x, int y)
{
    if (x == -1) return;
    print_channels(tp, tp[x].pred, tp[y].pred);
    const char *px = tp[x].tag, *py = tp[y].tag;
    printf("    %.*s\n", (int) (py - px), px);
}

#define YYMTAGP(t) mtag(&t, YYCURSOR, &tp)
#define YYMTAGN(t) mtag(&t, NULL,     &tp)

static int lex(const char *YYCURSOR)
{
    const char *YYMARKER, *n1, *n2, *a1, *a2, *c1, *c2;
    mtagpool_t tp;
    int h1, h2;
    const char *yyt1;const char *yyt2;const char *yyt3;const char *yyt4;const char *yyt5;const char *yyt6;
    int yyt7;int yyt8;
loop:
    tp.clear();
    yyt7 = -1;yyt8 = -1;
    
{
	char yych;
	yych = *YYCURSOR;
	switch (yych) {
	case 0x00:	goto yy2;
	case '\t':
	case ' ':	goto yy6;
	case '\n':	goto yy9;
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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 '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':
		yyt1 = YYCURSOR;
		goto yy10;
	default:	goto yy4;
	}
yy2:
	++YYCURSOR;
	{ return 0; }
yy4:
	++YYCURSOR;
yy5:
	{ printf("error: %s\n", YYCURSOR); return 1; }
yy6:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy6;
	default:	goto yy8;
	}
yy8:
	{ goto loop; }
yy9:
	++YYCURSOR;
	goto yy8;
yy10:
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
	case '\t':
	case ' ':
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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 '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 '{':	goto yy15;
	default:	goto yy5;
	}
yy11:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy11;
	case '{':	goto yy16;
	default:	goto yy13;
	}
yy13:
	YYCURSOR = YYMARKER;
	goto yy5;
yy14:
	yych = *++YYCURSOR;
yy15:
	switch (yych) {
	case '\t':
	case ' ':
		yyt2 = YYCURSOR;
		goto yy11;
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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 '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':	goto yy14;
	case '{':
		yyt2 = YYCURSOR;
		goto yy16;
	default:	goto yy13;
	}
yy16:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy16;
	case '\n':	goto yy18;
	default:	goto yy13;
	}
yy18:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy18;
	case 'n':	goto yy20;
	default:	goto yy13;
	}
yy20:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'a':	goto yy21;
	default:	goto yy13;
	}
yy21:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'm':	goto yy22;
	default:	goto yy13;
	}
yy22:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'e':	goto yy23;
	default:	goto yy13;
	}
yy23:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy23;
	case '=':	goto yy25;
	default:	goto yy13;
	}
yy25:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy25;
	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':
		yyt3 = YYCURSOR;
		goto yy27;
	default:	goto yy13;
	}
yy27:
	yych = *++YYCURSOR;
	switch (yych) {
	case '.':	goto yy28;
	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':	goto yy29;
	default:	goto yy13;
	}
yy28:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':
		yyt4 = YYCURSOR;
		goto yy31;
	case '\n':
		yyt4 = YYCURSOR;
		goto yy33;
	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':	goto yy27;
	default:	goto yy13;
	}
yy29:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':
		yyt4 = YYCURSOR;
		goto yy31;
	case '\n':
		yyt4 = YYCURSOR;
		goto yy33;
	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':	goto yy27;
	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':	goto yy29;
	default:	goto yy13;
	}
yy31:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy31;
	case '\n':	goto yy33;
	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':	goto yy27;
	default:	goto yy13;
	}
yy33:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy33;
	case 'c':	goto yy35;
	default:	goto yy13;
	}
yy35:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'o':	goto yy36;
	default:	goto yy13;
	}
yy36:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'u':	goto yy37;
	default:	goto yy13;
	}
yy37:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'n':	goto yy38;
	default:	goto yy13;
	}
yy38:
	yych = *++YYCURSOR;
	switch (yych) {
	case 't':	goto yy39;
	default:	goto yy13;
	}
yy39:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'r':	goto yy40;
	default:	goto yy13;
	}
yy40:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'y':	goto yy41;
	default:	goto yy13;
	}
yy41:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy41;
	case '=':	goto yy43;
	default:	goto yy13;
	}
yy43:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':	goto yy43;
	case ' ':
		yyt5 = YYCURSOR;
		goto yy45;
	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 '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':
		yyt5 = YYCURSOR;
		goto yy47;
	default:	goto yy13;
	}
yy45:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
		yyt6 = YYCURSOR;
		goto yy49;
	case '\n':
		yyt6 = YYCURSOR;
		goto yy51;
	case ' ':
		yyt5 = YYCURSOR;
		goto yy45;
	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 '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':
		yyt5 = YYCURSOR;
		goto yy47;
	default:	goto yy13;
	}
yy47:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
		yyt6 = YYCURSOR;
		goto yy53;
	case '\n':
		yyt6 = YYCURSOR;
		goto yy51;
	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 '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':	goto yy47;
	default:	goto yy13;
	}
yy49:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':	goto yy49;
	case '\n':	goto yy51;
	case ' ':
		yyt5 = YYCURSOR;
		goto yy45;
	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 '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':
		yyt5 = YYCURSOR;
		goto yy47;
	default:	goto yy13;
	}
yy51:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy51;
	case 'c':	goto yy55;
	default:	goto yy13;
	}
yy53:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy53;
	case '\n':	goto yy51;
	default:	goto yy13;
	}
yy55:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'h':	goto yy56;
	default:	goto yy13;
	}
yy56:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'a':	goto yy57;
	default:	goto yy13;
	}
yy57:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'n':	goto yy58;
	default:	goto yy13;
	}
yy58:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'n':	goto yy59;
	default:	goto yy13;
	}
yy59:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'e':	goto yy60;
	default:	goto yy13;
	}
yy60:
	yych = *++YYCURSOR;
	switch (yych) {
	case 'l':	goto yy61;
	default:	goto yy13;
	}
yy61:
	yych = *++YYCURSOR;
	switch (yych) {
	case 's':	goto yy62;
	default:	goto yy13;
	}
yy62:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy62;
	case '=':	goto yy64;
	default:	goto yy13;
	}
yy64:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy64;
	case '\n':
		YYMTAGN (yyt8);
		YYMTAGN (yyt7);
		goto yy66;
	case '#':
		YYMTAGP (yyt7);
		goto yy68;
	case '-':
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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':
		YYMTAGP (yyt7);
		goto yy69;
	default:	goto yy13;
	}
yy66:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy66;
	case '}':	goto yy71;
	default:	goto yy13;
	}
yy68:
	yych = *++YYCURSOR;
	switch (yych) {
	case '-':
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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':	goto yy73;
	default:	goto yy13;
	}
yy69:
	yych = *++YYCURSOR;
	switch (yych) {
	case '-':
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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':	goto yy69;
	case '/':	goto yy75;
	default:	goto yy13;
	}
yy71:
	++YYCURSOR;
	n1 = yyt1;
	n2 = yyt2;
	a1 = yyt3;
	a2 = yyt4;
	c1 = yyt5;
	c2 = yyt6;
	h1 = yyt7;
	h2 = yyt8;
	{
            printf("\n%.*s\n", (int) (n2 - n1), n1);
            printf("  name:     %.*s\n", (int) (a2 - a1), a1);
            printf("  country:  %.*s\n", (int) (c2 - c1), c1);
            printf("  channels:\n");
            print_channels(tp, h1, h2);
            goto loop;
        }
yy73:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':
		YYMTAGP (yyt8);
		goto yy76;
	case '-':
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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':	goto yy73;
	case ';':
		YYMTAGP (yyt8);
		goto yy78;
	default:	goto yy13;
	}
yy75:
	yych = *++YYCURSOR;
	switch (yych) {
	case '#':	goto yy68;
	default:	goto yy13;
	}
yy76:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy76;
	case ';':	goto yy78;
	default:	goto yy13;
	}
yy78:
	yych = *++YYCURSOR;
	switch (yych) {
	case '\t':
	case ' ':	goto yy78;
	case '\n':	goto yy66;
	case '#':
		YYMTAGP (yyt7);
		goto yy68;
	case '-':
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	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':
		YYMTAGP (yyt7);
		goto yy69;
	default:	goto yy13;
	}
}

}

int main(int argc, char **argv)
{
    if (argc < 2) {
        fprintf(stderr, "no input files\n");
        return 1;
    }

    FILE *file = fopen(argv[1], "r");

    fseek(file, 0, SEEK_END);
    const size_t fsize = (size_t) ftell(file);
    fseek(file, 0, SEEK_SET);

    char *buffer = (char*) malloc(fsize + 1);

    fread(buffer, 1, fsize, file);
    buffer[fsize] = 0;

    const int status = lex(buffer);

    fclose(file);
    free(buffer);

    return status;
}
re2c: warning: line 57: rule matches empty string [-Wmatch-empty-string]
re2c: warning: line 63: tag 'a2' has 2nd degree of nondeterminism [-Wnondeterministic-tags]
re2c: warning: line 63: tag 'c1' has 2nd degree of nondeterminism [-Wnondeterministic-tags]
re2c: warning: line 63: tag 'c2' has 2nd degree of nondeterminism [-Wnondeterministic-tags]
