Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.141.46.108
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/cwd/usr/share/doc/re2c/examples/c/submatch/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/cwd/usr/share/doc/re2c/examples/c/submatch/parse_records.c
/* Generated by re2c */
// re2c $INPUT -o $OUTPUT -i
#include <assert.h>
#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;
    fprintf(stderr, "    %.*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 yytm7;int yytm8;

    for (;;) {
        tp.clear();
    yytm7 = -1;yytm8 = -1;
    
{
	char yych;
	yych = *YYCURSOR;
	switch (yych) {
		case 0x00: goto yy1;
		case '\t':
		case ' ': goto yy4;
		case '\n': goto yy6;
		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 yy7;
		default: goto yy2;
	}
yy1:
	++YYCURSOR;
	{ return 0; }
yy2:
	++YYCURSOR;
yy3:
	{ fprintf(stderr, "error: %s\n", YYCURSOR); return 1; }
yy4:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy4;
		default: goto yy5;
	}
yy5:
	{ continue; }
yy6:
	++YYCURSOR;
	goto yy5;
yy7:
	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 yy11;
		default: goto yy3;
	}
yy8:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy8;
		case '{': goto yy12;
		default: goto yy9;
	}
yy9:
	YYCURSOR = YYMARKER;
	goto yy3;
yy10:
	yych = *++YYCURSOR;
yy11:
	switch (yych) {
		case '\t':
		case ' ':
			yyt2 = YYCURSOR;
			goto yy8;
		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 yy10;
		case '{':
			yyt2 = YYCURSOR;
			goto yy12;
		default: goto yy9;
	}
yy12:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy12;
		case '\n': goto yy13;
		default: goto yy9;
	}
yy13:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy13;
		case 'n': goto yy14;
		default: goto yy9;
	}
yy14:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'a': goto yy15;
		default: goto yy9;
	}
yy15:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'm': goto yy16;
		default: goto yy9;
	}
yy16:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'e': goto yy17;
		default: goto yy9;
	}
yy17:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy17;
		case '=': goto yy18;
		default: goto yy9;
	}
yy18:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy18;
		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 yy19;
		default: goto yy9;
	}
yy19:
	yych = *++YYCURSOR;
	switch (yych) {
		case '.': goto yy20;
		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 yy21;
		default: goto yy9;
	}
yy20:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ':
			yyt4 = YYCURSOR;
			goto yy22;
		case '\n':
			yyt4 = YYCURSOR;
			goto yy23;
		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 yy19;
		default: goto yy9;
	}
yy21:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ':
			yyt4 = YYCURSOR;
			goto yy22;
		case '\n':
			yyt4 = YYCURSOR;
			goto yy23;
		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 yy19;
		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 yy21;
		default: goto yy9;
	}
yy22:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy22;
		case '\n': goto yy23;
		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 yy19;
		default: goto yy9;
	}
yy23:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy23;
		case 'c': goto yy24;
		default: goto yy9;
	}
yy24:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'o': goto yy25;
		default: goto yy9;
	}
yy25:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'u': goto yy26;
		default: goto yy9;
	}
yy26:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'n': goto yy27;
		default: goto yy9;
	}
yy27:
	yych = *++YYCURSOR;
	switch (yych) {
		case 't': goto yy28;
		default: goto yy9;
	}
yy28:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'r': goto yy29;
		default: goto yy9;
	}
yy29:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'y': goto yy30;
		default: goto yy9;
	}
yy30:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy30;
		case '=': goto yy31;
		default: goto yy9;
	}
yy31:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t': goto yy31;
		case ' ':
			yyt5 = YYCURSOR;
			goto yy32;
		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 yy33;
		default: goto yy9;
	}
yy32:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
			yyt6 = YYCURSOR;
			goto yy34;
		case '\n':
			yyt6 = YYCURSOR;
			goto yy35;
		case ' ':
			yyt5 = YYCURSOR;
			goto yy32;
		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 yy33;
		default: goto yy9;
	}
yy33:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
			yyt6 = YYCURSOR;
			goto yy36;
		case '\n':
			yyt6 = YYCURSOR;
			goto yy35;
		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 yy33;
		default: goto yy9;
	}
yy34:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t': goto yy34;
		case '\n': goto yy35;
		case ' ':
			yyt5 = YYCURSOR;
			goto yy32;
		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 yy33;
		default: goto yy9;
	}
yy35:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy35;
		case 'c': goto yy37;
		default: goto yy9;
	}
yy36:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy36;
		case '\n': goto yy35;
		default: goto yy9;
	}
yy37:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'h': goto yy38;
		default: goto yy9;
	}
yy38:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'a': goto yy39;
		default: goto yy9;
	}
yy39:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'n': goto yy40;
		default: goto yy9;
	}
yy40:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'n': goto yy41;
		default: goto yy9;
	}
yy41:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'e': goto yy42;
		default: goto yy9;
	}
yy42:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'l': goto yy43;
		default: goto yy9;
	}
yy43:
	yych = *++YYCURSOR;
	switch (yych) {
		case 's': goto yy44;
		default: goto yy9;
	}
yy44:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy44;
		case '=': goto yy45;
		default: goto yy9;
	}
yy45:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy45;
		case '\n':
			YYMTAGN(yytm8);
			YYMTAGN(yytm7);
			goto yy46;
		case '#':
			YYMTAGP(yytm7);
			goto yy47;
		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(yytm7);
			goto yy48;
		default: goto yy9;
	}
yy46:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy46;
		case '}': goto yy49;
		default: goto yy9;
	}
yy47:
	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 yy50;
		default: goto yy9;
	}
yy48:
	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 yy48;
		case '/': goto yy51;
		default: goto yy9;
	}
yy49:
	++YYCURSOR;
	n1 = yyt1;
	n2 = yyt2;
	a1 = yyt3;
	a2 = yyt4;
	c1 = yyt5;
	c2 = yyt6;
	h1 = yytm7;
	h2 = yytm8;
	{
            fprintf(stderr, "\n%.*s\n", (int) (n2 - n1), n1);
            fprintf(stderr, "  name:     %.*s\n", (int) (a2 - a1), a1);
            fprintf(stderr, "  country:  %.*s\n", (int) (c2 - c1), c1);
            fprintf(stderr, "  channels:\n");
            print_channels(tp, h1, h2);
            continue;
        }
yy50:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ':
			YYMTAGP(yytm8);
			goto yy52;
		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 yy50;
		case ';':
			YYMTAGP(yytm8);
			goto yy53;
		default: goto yy9;
	}
yy51:
	yych = *++YYCURSOR;
	switch (yych) {
		case '#': goto yy47;
		default: goto yy9;
	}
yy52:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy52;
		case ';': goto yy53;
		default: goto yy9;
	}
yy53:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\t':
		case ' ': goto yy53;
		case '\n': goto yy46;
		case '#':
			YYMTAGP(yytm7);
			goto yy47;
		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(yytm7);
			goto yy48;
		default: goto yy9;
	}
}

    }
}

int main() {
    const char *fname = "etc_passwd";
    FILE *f;

    // prepare input file
    f = fopen(fname, "w");
    fprintf(f,
        "h4cker1970 {\n"
        "    name     = Jon Smith\n"
        "    country  = UK\n"
        "    channels = freenode/#gentoo-dev; freenode/#gentoo-arch; freenode/#alpha;\n"
        "}\n"
        "\n"
        "mitek {\n"
        "    name     = Mitrofan Rygoravich\n"
        "    country  = Belarus\n"
        "    channels = bynets/#haskell; freenode/#unix;\n"
        "}\n"
        "\n");
    fclose(f);

    // read input file into buffer
    f = fopen(fname, "r");
    fseek(f, 0, SEEK_END);
    const size_t fsize = (size_t) ftell(f);
    fseek(f, 0, SEEK_SET);
    char *buffer = (char*) malloc(fsize + 1);
    fread(buffer, 1, fsize, f);
    buffer[fsize] = 0;
    fclose(f);

    assert(lex(buffer) == 0);

    // cleanup
    remove(fname);
    free(buffer);
    return 0;
}
c/submatch/parse_records.re:58:18: warning: rule matches empty string [-Wmatch-empty-string]
c/submatch/parse_records.re:64:16: warning: tag 'a2' has 2nd degree of nondeterminism [-Wnondeterministic-tags]
c/submatch/parse_records.re:64:16: warning: tag 'c1' has 2nd degree of nondeterminism [-Wnondeterministic-tags]
c/submatch/parse_records.re:64:16: warning: tag 'c2' has 2nd degree of nondeterminism [-Wnondeterministic-tags]

Anon7 - 2022
AnonSec Team