]> granicus.if.org Git - re2c/commit
Output user-defines start label in the appropriate place.
authorUlya Trofimovich <skvadrik@gmail.com>
Tue, 26 May 2015 20:34:56 +0000 (21:34 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Tue, 26 May 2015 20:34:56 +0000 (21:34 +0100)
commit2ede5a7546215ba6dd328c707629f789b90edf31
treed9b5fae8746f2f0baec2411a2e0b219033ed9fd8
parente315bb4526480d3bd6ffd04baa36144c6ce6de07
Output user-defines start label in the appropriate place.

Before this commit, given the following example:
    /*!re2c
            re2c:startlabel = "start";
            [^]* {}
    */
re2c would generate the following code:
    {
            YYCTYPE yych;
            goto yy0;
    yy1:
    start:
            ++YYCURSOR;
    yy0:
            if (YYLIMIT <= YYCURSOR) YYFILL(1);
            yych = *YYCURSOR;
            goto yy1;
            {}
    }
where "start:" falsely corresponds to "yy1:" rather to "yy0:".
(The important property of this example is that DFA has arrows
to initial state.) This commit fixes this behavior:
    {
            YYCTYPE yych;
    start:
            goto yy0;
    yy1:
            ++YYCURSOR;
    yy0:
            if (YYLIMIT <= YYCURSOR) YYFILL(1);
            yych = *YYCURSOR;
            goto yy1;
            {}
    }
re2c/src/codegen/emit_action.cc
re2c/src/codegen/emit_dfa.cc
re2c/test/segfault_full_range_star_startlabel.ci.c [new file with mode: 0644]
re2c/test/segfault_full_range_star_startlabel.ci.re [new file with mode: 0644]
re2c/test/segfault_full_range_star_startlabel.i.c [new file with mode: 0644]
re2c/test/segfault_full_range_star_startlabel.i.re [new file with mode: 0644]