bool lex (FILE * f, const long limit)
{
    long marker;
    long ctxmarker;
#   define YYCTYPE        char
#   define YYPEEK()       peek (f)
#   define YYSKIP()       fgetc (f)
#   define YYBACKUP()     marker = ftell (f)
#   define YYBACKUPCTX()  ctxmarker = ftell (f)
#   define YYRESTORE()    fseek (f, marker, SEEK_SET)
#   define YYRESTORECTX() fseek (f, ctxmarker, SEEK_SET)
#   define YYLESSTHAN(n)  limit - ftell (f) < n
#   define YYFILL(n)      {}
    
#line 27 "input_custom_fgetc.--input(custom).c"
{
	YYCTYPE yych;
	if (YYLESSTHAN (13)) YYFILL(13);
	yych = YYPEEK ();
	switch (yych) {
	case 'i':	goto yy4;
	default:	goto yy2;
	}
yy2:
	YYSKIP ();
yy3:
#line 25 "input_custom_fgetc.--input(custom).re"
	{ return false; }
#line 41 "input_custom_fgetc.--input(custom).c"
yy4:
	YYSKIP ();
	YYBACKUP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'n':	goto yy5;
	default:	goto yy3;
	}
yy5:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 't':	goto yy7;
	default:	goto yy6;
	}
yy6:
	YYRESTORE ();
	goto yy3;
yy7:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case ' ':	goto yy8;
	default:	goto yy6;
	}
yy8:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'b':	goto yy9;
	default:	goto yy6;
	}
yy9:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'u':	goto yy10;
	default:	goto yy6;
	}
yy10:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'f':	goto yy11;
	default:	goto yy6;
	}
yy11:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'f':	goto yy12;
	default:	goto yy6;
	}
yy12:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'e':	goto yy13;
	default:	goto yy6;
	}
yy13:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'r':	goto yy14;
	default:	goto yy6;
	}
yy14:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case ' ':	goto yy15;
	default:	goto yy6;
	}
yy15:
	YYSKIP ();
	yych = YYPEEK ();
	YYBACKUPCTX ();
	switch (yych) {
	case '[':	goto yy16;
	default:	goto yy6;
	}
yy16:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy17;
	default:	goto yy6;
	}
yy17:
	YYSKIP ();
	if (YYLESSTHAN (1)) YYFILL(1);
	yych = YYPEEK ();
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy17;
	case ']':	goto yy19;
	default:	goto yy6;
	}
yy19:
	YYSKIP ();
	YYRESTORECTX ();
#line 24 "input_custom_fgetc.--input(custom).re"
	{ return true; }
#line 163 "input_custom_fgetc.--input(custom).c"
}
#line 26 "input_custom_fgetc.--input(custom).re"

}
bool lex (std::istringstream & is, const std::streampos limit)
{
    std::streampos marker;
    std::streampos ctxmarker;
#   define YYCTYPE        char
#   define YYPEEK()       is.peek ()
#   define YYSKIP()       is.ignore ()
#   define YYBACKUP()     marker = is.tellg ()
#   define YYBACKUPCTX()  ctxmarker = is.tellg ()
#   define YYRESTORE()    is.seekg (marker)
#   define YYRESTORECTX() is.seekg (ctxmarker)
#   define YYLESSTHAN(n)  limit - is.tellg () < n
#   define YYFILL(n)      {}
    
#line 20 "input_custom_istringstream.--input(custom).c"
{
	YYCTYPE yych;
	if (YYLESSTHAN (13)) YYFILL(13);
	yych = YYPEEK ();
	switch (yych) {
	case 'i':	goto yy4;
	default:	goto yy2;
	}
yy2:
	YYSKIP ();
yy3:
#line 18 "input_custom_istringstream.--input(custom).re"
	{ return false; }
#line 34 "input_custom_istringstream.--input(custom).c"
yy4:
	YYSKIP ();
	YYBACKUP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'n':	goto yy5;
	default:	goto yy3;
	}
yy5:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 't':	goto yy7;
	default:	goto yy6;
	}
yy6:
	YYRESTORE ();
	goto yy3;
yy7:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case ' ':	goto yy8;
	default:	goto yy6;
	}
yy8:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'b':	goto yy9;
	default:	goto yy6;
	}
yy9:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'u':	goto yy10;
	default:	goto yy6;
	}
yy10:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'f':	goto yy11;
	default:	goto yy6;
	}
yy11:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'f':	goto yy12;
	default:	goto yy6;
	}
yy12:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'e':	goto yy13;
	default:	goto yy6;
	}
yy13:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'r':	goto yy14;
	default:	goto yy6;
	}
yy14:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case ' ':	goto yy15;
	default:	goto yy6;
	}
yy15:
	YYSKIP ();
	yych = YYPEEK ();
	YYBACKUPCTX ();
	switch (yych) {
	case '[':	goto yy16;
	default:	goto yy6;
	}
yy16:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy17;
	default:	goto yy6;
	}
yy17:
	YYSKIP ();
	if (YYLESSTHAN (1)) YYFILL(1);
	yych = YYPEEK ();
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy17;
	case ']':	goto yy19;
	default:	goto yy6;
	}
yy19:
	YYSKIP ();
	YYRESTORECTX ();
#line 17 "input_custom_istringstream.--input(custom).re"
	{ return true; }
#line 156 "input_custom_istringstream.--input(custom).c"
}
#line 19 "input_custom_istringstream.--input(custom).re"

}
int lex_line19()
{
    const size_t padding = 13; /* YYMAXFILL */
    int status = 0;
    size_t input_len = 0;
    size_t keys_count = 0;
    YYCTYPE *input = NULL;
    YYKEYTYPE *keys = NULL;
    const YYCTYPE *cursor = NULL;
    const YYCTYPE *limit = NULL;
    const YYCTYPE *token = NULL;
    const YYCTYPE *eof = NULL;
    unsigned int i = 0;

    input = (YYCTYPE *) read_file
        ("input_custom_istringstream.--skeleton--input(custom).c.line19.input"
        , sizeof (YYCTYPE)
        , padding
        , &input_len
        );
    if (input == NULL) {
        status = 1;
        goto end;
    }

    keys = (YYKEYTYPE *) read_file
        ("input_custom_istringstream.--skeleton--input(custom).c.line19.keys"
        , 3 * sizeof (YYKEYTYPE)
        , 0
        , &keys_count
        );
    if (keys == NULL) {
        status = 1;
        goto end;
    }

    cursor = input;
    limit = input + input_len + padding;
    eof = input + input_len;

    for (i = 0; status == 0 && i < keys_count; ++i) {
        token = cursor;
        const YYCTYPE *marker = NULL;
        const YYCTYPE *ctxmarker = NULL;
        YYCTYPE yych;

        if (YYLESSTHAN (13)) YYFILL(13);
        yych = YYPEEK ();
        switch (yych) {
        case 'i':    goto yy4;
        default:    goto yy2;
        }
yy2:
        YYSKIP ();
yy3:
        status = action_line19(i, keys, input, token, &cursor, 254);
        continue;
yy4:
        YYSKIP ();
        YYBACKUP ();
        yych = YYPEEK ();
        switch (yych) {
        case 'n':    goto yy5;
        default:    goto yy3;
        }
yy5:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case 't':    goto yy7;
        default:    goto yy6;
        }
yy6:
        YYRESTORE ();
        goto yy3;
yy7:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case ' ':    goto yy8;
        default:    goto yy6;
        }
yy8:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case 'b':    goto yy9;
        default:    goto yy6;
        }
yy9:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case 'u':    goto yy10;
        default:    goto yy6;
        }
yy10:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case 'f':    goto yy11;
        default:    goto yy6;
        }
yy11:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case 'f':    goto yy12;
        default:    goto yy6;
        }
yy12:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case 'e':    goto yy13;
        default:    goto yy6;
        }
yy13:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case 'r':    goto yy14;
        default:    goto yy6;
        }
yy14:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case ' ':    goto yy15;
        default:    goto yy6;
        }
yy15:
        YYSKIP ();
        yych = YYPEEK ();
        YYBACKUPCTX ();
        switch (yych) {
        case '[':    goto yy16;
        default:    goto yy6;
        }
yy16:
        YYSKIP ();
        yych = YYPEEK ();
        switch (yych) {
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':    goto yy17;
        default:    goto yy6;
        }
yy17:
        YYSKIP ();
        if (YYLESSTHAN (1)) YYFILL(1);
        yych = YYPEEK ();
        switch (yych) {
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':    goto yy17;
        case ']':    goto yy19;
        default:    goto yy6;
        }
yy19:
        YYSKIP ();
        YYRESTORECTX ();
        status = action_line19(i, keys, input, token, &cursor, 0);
        continue;

    }
    if (status == 0) {
        if (cursor != eof) {
            status = 1;
            const long pos = token - input;
            fprintf(stderr, "error: lex_line19: unused input strings left at position %ld\n", pos);
        }
        if (i != keys_count) {
            status = 1;
            fprintf(stderr, "error: lex_line19: unused keys left after %u iterations\n", i);
        }
    }

end:
    free(input);
    free(keys);

    return status;
}
bool lex (const char * cursor, const char * const limit)
{
    const char * marker;
    const char * ctxmarker;
#   define YYCTYPE        char
#   define YYPEEK()       *cursor
#   define YYSKIP()       ++cursor
#   define YYBACKUP()     marker = cursor
#   define YYBACKUPCTX()  ctxmarker = cursor
#   define YYRESTORE()    cursor = marker
#   define YYRESTORECTX() cursor = ctxmarker
#   define YYLESSTHAN(n)  limit - cursor < n
#   define YYFILL(n)      {}
    
#line 18 "input_custom_default.--input(custom).c"
{
	YYCTYPE yych;
	if (YYLESSTHAN (13)) YYFILL(13);
	yych = YYPEEK ();
	switch (yych) {
	case 'i':	goto yy4;
	default:	goto yy2;
	}
yy2:
	YYSKIP ();
yy3:
#line 16 "input_custom_default.--input(custom).re"
	{ return false; }
#line 32 "input_custom_default.--input(custom).c"
yy4:
	YYSKIP ();
	YYBACKUP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'n':	goto yy5;
	default:	goto yy3;
	}
yy5:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 't':	goto yy7;
	default:	goto yy6;
	}
yy6:
	YYRESTORE ();
	goto yy3;
yy7:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case ' ':	goto yy8;
	default:	goto yy6;
	}
yy8:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'b':	goto yy9;
	default:	goto yy6;
	}
yy9:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'u':	goto yy10;
	default:	goto yy6;
	}
yy10:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'f':	goto yy11;
	default:	goto yy6;
	}
yy11:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'f':	goto yy12;
	default:	goto yy6;
	}
yy12:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'e':	goto yy13;
	default:	goto yy6;
	}
yy13:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case 'r':	goto yy14;
	default:	goto yy6;
	}
yy14:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case ' ':	goto yy15;
	default:	goto yy6;
	}
yy15:
	YYSKIP ();
	yych = YYPEEK ();
	YYBACKUPCTX ();
	switch (yych) {
	case '[':	goto yy16;
	default:	goto yy6;
	}
yy16:
	YYSKIP ();
	yych = YYPEEK ();
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy17;
	default:	goto yy6;
	}
yy17:
	YYSKIP ();
	if (YYLESSTHAN (1)) YYFILL(1);
	yych = YYPEEK ();
	switch (yych) {
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':	goto yy17;
	case ']':	goto yy19;
	default:	goto yy6;
	}
yy19:
	YYSKIP ();
	YYRESTORECTX ();
#line 15 "input_custom_default.--input(custom).re"
	{ return true; }
#line 154 "input_custom_default.--input(custom).c"
}
#line 17 "input_custom_default.--input(custom).re"

}
Exemplo n.º 5
0
int lex_line131()
{
    const size_t padding = 4; /* YYMAXFILL */
    int status = 0;
    size_t input_len = 0;
    size_t keys_count = 0;
    YYCTYPE *input = NULL;
    YYKEYTYPE *keys = NULL;
    const YYCTYPE *cursor = NULL;
    const YYCTYPE *limit = NULL;
    const YYCTYPE *token = NULL;
    const YYCTYPE *eof = NULL;
    unsigned int i = 0;

    input = (YYCTYPE *) read_file
        ("strip_003.b--skeleton.c.line131.input"
        , sizeof (YYCTYPE)
        , padding
        , &input_len
        );
    if (input == NULL) {
        status = 1;
        goto end;
    }

    keys = (YYKEYTYPE *) read_file
        ("strip_003.b--skeleton.c.line131.keys"
        , sizeof (YYKEYTYPE)
        , 0
        , &keys_count
        );
    if (keys == NULL) {
        status = 1;
        goto end;
    }

    cursor = input;
    limit = input + input_len + padding;
    eof = input + input_len;

    for (i = 0; status == 0 && cursor < eof && i < keys_count;) {
        token = cursor;
        const YYCTYPE *marker = NULL;
        const YYCTYPE *ctxmarker = NULL;
        YYCTYPE yych;

        if (YYLESSTHAN (4)) YYFILL(4);
        yych = YYPEEK ();
        if (yych <= '\f') {
            if (yych == '\n') goto yy4;
        } else {
            if (yych <= '\r') goto yy5;
            if (yych == '/') goto yy6;
        }
        YYSKIP ();
yy3:
        status = check_key_count_line131(keys_count, i, 3)
             || action_line131(&i, keys, input, token, &cursor, 3);
        continue;
yy4:
        YYSKIP ();
        YYBACKUP ();
        yych = YYPEEK ();
        if (yych == '/') {
            YYBACKUPCTX ();
            goto yy7;
        }
        goto yy3;
yy5:
        YYSKIP ();
        YYBACKUP ();
        yych = YYPEEK ();
        if (yych == '\n') goto yy9;
        goto yy3;
yy6:
        YYSKIP ();
        yych = YYPEEK ();
        if (yych == '*') goto yy10;
        if (yych == '/') goto yy12;
        goto yy3;
yy7:
        YYSKIP ();
        yych = YYPEEK ();
        if (yych == '*') goto yy14;
yy8:
        YYRESTORE ();
        goto yy3;
yy9:
        YYSKIP ();
        yych = YYPEEK ();
        if (yych == '/') {
            YYBACKUPCTX ();
            goto yy7;
        }
        goto yy8;
yy10:
        YYSKIP ();
        status = check_key_count_line131(keys_count, i, 3)
             || action_line131(&i, keys, input, token, &cursor, 2);
        continue;
yy12:
        YYSKIP ();
        status = check_key_count_line131(keys_count, i, 3)
             || action_line131(&i, keys, input, token, &cursor, 0);
        continue;
yy14:
        YYSKIP ();
        YYRESTORECTX ();
        status = check_key_count_line131(keys_count, i, 3)
             || action_line131(&i, keys, input, token, &cursor, 1);
        continue;

    }
    if (status == 0) {
        if (cursor != eof) {
            status = 1;
            const long pos = token - input;
            fprintf(stderr, "error: lex_line131: unused input strings left at position %ld\n", pos);
        }
        if (i != keys_count) {
            status = 1;
            fprintf(stderr, "error: lex_line131: unused keys left after %u keys\n", i);
        }
    }

end:
    free(input);
    free(keys);

    return status;
}