]> granicus.if.org Git - re2c/commit
Partial fix for bug #61 "empty character class [] matches empty string".
authorUlya Trofimovich <skvadrik@gmail.com>
Tue, 16 Jun 2015 11:19:03 +0000 (12:19 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Tue, 16 Jun 2015 11:19:03 +0000 (12:19 +0100)
commit7157354c453d3f4ba538bf73ac76d2a2d2311dee
treeeef97ff3b7cdf4edaccdde91b524a7c3d5f13e8d
parent50802e46966089b3a843496722879c9b5f50fa43
Partial fix for bug #61 "empty character class [] matches empty string".

Given the following code:
    /*!re2c
        [] {}
    */

    /*!re2c
        [^\x00-\xFF] {}
    */

    /*!re2c
        [\x00-\xFF]\[\x00-\xFF] {}
    */
re2c versions <=0.13.6 and >=0.13.7 behaved differently.
0.13.6 consistently considered that empty range should match empty string.
Since 0.13.7 empty positive range [] and empty difference (e.g. [a-z][a-z])
still match empty string, but empty negative range (e.g. [^\x00-\xFF])
matches nothing (always fails). The faulty commit is
28ee7c95bca46ad3cdb965741c5c29e21c50df14
"Added UTF-8 encoding support and tests for it."

This commit brings back consistent behaviour of 0.13.6: empty range,
however it was constructed, always matches empty string. Whether this
behaviour is sane or not is another question.
re2c/src/ir/regexp/regexp.cc
re2c/src/ir/regexp/regexp.h
re2c/src/parse/parser.ypp
re2c/src/parse/scanner.h
re2c/test/bug61.i.c [new file with mode: 0644]
re2c/test/bug61.i.re [new file with mode: 0644]
re2c/test/bug61a.i.c [new file with mode: 0644]
re2c/test/bug61a.i.re [new file with mode: 0644]