From 5cdb7a1af45ab02bf54e14ab5e72882cb5bf9f6d Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Tue, 16 Jun 2015 14:17:17 +0100 Subject: [PATCH] Added cmd option "--empty-class ". This option controls re2c actions when it encounters empty character class (e.g. [], [^\0x00-\xFF] or [\0x00-\xFF]\[\0x00-\xFF]): match-empty (default) - match on empty input match-none - fail to match on any input error - compilation error This is a final fix for bug #61 "empty character class [] matches empty string". --- re2c/src/globals.h | 3 ++ re2c/src/ir/regexp/empty_class_policy.h | 15 ++++++++++ re2c/src/ir/regexp/regexp.cc | 11 ++++++- re2c/src/main.cc | 23 ++++++++++++++ re2c/test/bug61.i--empty-class(error).c | 1 + ...1a.i.re => bug61.i--empty-class(error).re} | 4 +++ re2c/test/bug61.i--empty-class(match-empty).c | 1 + .../test/bug61.i--empty-class(match-empty).re | 19 ++++++++++++ re2c/test/bug61.i--empty-class(match-none).c | 30 +++++++++++++++++++ re2c/test/bug61.i--empty-class(match-none).re | 19 ++++++++++++ re2c/test/bug61.i.c | 22 +------------- re2c/test/bug61.i.re | 8 +++++ ...61_difference_full.i--empty-class(error).c | 1 + ...1_difference_full.i--empty-class(error).re | 3 ++ ...ference_full.i--empty-class(match-empty).c | 7 +++++ ...erence_full.i--empty-class(match-empty).re | 3 ++ ...fference_full.i--empty-class(match-none).c | 6 ++++ ...ference_full.i--empty-class(match-none).re | 3 ++ re2c/test/bug61_difference_full.i.c | 7 +++++ re2c/test/bug61_difference_full.i.re | 3 ++ ...ifference_negative.i--empty-class(error).c | 1 + ...fference_negative.i--empty-class(error).re | 3 ++ ...nce_negative.i--empty-class(match-empty).c | 1 + ...ce_negative.i--empty-class(match-empty).re | 3 ++ ...ence_negative.i--empty-class(match-none).c | 6 ++++ ...nce_negative.i--empty-class(match-none).re | 3 ++ re2c/test/bug61_difference_negative.i.c | 1 + re2c/test/bug61_difference_negative.i.re | 3 ++ ...ifference_positive.i--empty-class(error).c | 1 + ...fference_positive.i--empty-class(error).re | 3 ++ ...nce_positive.i--empty-class(match-empty).c | 1 + ...ce_positive.i--empty-class(match-empty).re | 3 ++ ...ence_positive.i--empty-class(match-none).c | 6 ++++ ...nce_positive.i--empty-class(match-none).re | 3 ++ re2c/test/bug61_difference_positive.i.c | 1 + re2c/test/bug61_difference_positive.i.re | 3 ++ .../bug61_negative.i--empty-class(error).c | 1 + .../bug61_negative.i--empty-class(error).re | 3 ++ ...g61_negative.i--empty-class(match-empty).c | 7 +++++ ...61_negative.i--empty-class(match-empty).re | 3 ++ ...ug61_negative.i--empty-class(match-none).c | 6 ++++ ...g61_negative.i--empty-class(match-none).re | 3 ++ re2c/test/bug61_negative.i.c | 7 +++++ re2c/test/bug61_negative.i.re | 3 ++ .../bug61_positive.i--empty-class(error).c | 1 + .../bug61_positive.i--empty-class(error).re | 3 ++ ...g61_positive.i--empty-class(match-empty).c | 7 +++++ ...61_positive.i--empty-class(match-empty).re | 3 ++ ...ug61_positive.i--empty-class(match-none).c | 6 ++++ ...g61_positive.i--empty-class(match-none).re | 3 ++ re2c/test/bug61_positive.i.c | 7 +++++ re2c/test/bug61_positive.i.re | 3 ++ re2c/test/bug61a.i.c | 1 - 53 files changed, 275 insertions(+), 23 deletions(-) create mode 100644 re2c/src/ir/regexp/empty_class_policy.h create mode 100644 re2c/test/bug61.i--empty-class(error).c rename re2c/test/{bug61a.i.re => bug61.i--empty-class(error).re} (84%) create mode 100644 re2c/test/bug61.i--empty-class(match-empty).c create mode 100644 re2c/test/bug61.i--empty-class(match-empty).re create mode 100644 re2c/test/bug61.i--empty-class(match-none).c create mode 100644 re2c/test/bug61.i--empty-class(match-none).re create mode 100644 re2c/test/bug61_difference_full.i--empty-class(error).c create mode 100644 re2c/test/bug61_difference_full.i--empty-class(error).re create mode 100644 re2c/test/bug61_difference_full.i--empty-class(match-empty).c create mode 100644 re2c/test/bug61_difference_full.i--empty-class(match-empty).re create mode 100644 re2c/test/bug61_difference_full.i--empty-class(match-none).c create mode 100644 re2c/test/bug61_difference_full.i--empty-class(match-none).re create mode 100644 re2c/test/bug61_difference_full.i.c create mode 100644 re2c/test/bug61_difference_full.i.re create mode 100644 re2c/test/bug61_difference_negative.i--empty-class(error).c create mode 100644 re2c/test/bug61_difference_negative.i--empty-class(error).re create mode 100644 re2c/test/bug61_difference_negative.i--empty-class(match-empty).c create mode 100644 re2c/test/bug61_difference_negative.i--empty-class(match-empty).re create mode 100644 re2c/test/bug61_difference_negative.i--empty-class(match-none).c create mode 100644 re2c/test/bug61_difference_negative.i--empty-class(match-none).re create mode 100644 re2c/test/bug61_difference_negative.i.c create mode 100644 re2c/test/bug61_difference_negative.i.re create mode 100644 re2c/test/bug61_difference_positive.i--empty-class(error).c create mode 100644 re2c/test/bug61_difference_positive.i--empty-class(error).re create mode 100644 re2c/test/bug61_difference_positive.i--empty-class(match-empty).c create mode 100644 re2c/test/bug61_difference_positive.i--empty-class(match-empty).re create mode 100644 re2c/test/bug61_difference_positive.i--empty-class(match-none).c create mode 100644 re2c/test/bug61_difference_positive.i--empty-class(match-none).re create mode 100644 re2c/test/bug61_difference_positive.i.c create mode 100644 re2c/test/bug61_difference_positive.i.re create mode 100644 re2c/test/bug61_negative.i--empty-class(error).c create mode 100644 re2c/test/bug61_negative.i--empty-class(error).re create mode 100644 re2c/test/bug61_negative.i--empty-class(match-empty).c create mode 100644 re2c/test/bug61_negative.i--empty-class(match-empty).re create mode 100644 re2c/test/bug61_negative.i--empty-class(match-none).c create mode 100644 re2c/test/bug61_negative.i--empty-class(match-none).re create mode 100644 re2c/test/bug61_negative.i.c create mode 100644 re2c/test/bug61_negative.i.re create mode 100644 re2c/test/bug61_positive.i--empty-class(error).c create mode 100644 re2c/test/bug61_positive.i--empty-class(error).re create mode 100644 re2c/test/bug61_positive.i--empty-class(match-empty).c create mode 100644 re2c/test/bug61_positive.i--empty-class(match-empty).re create mode 100644 re2c/test/bug61_positive.i--empty-class(match-none).c create mode 100644 re2c/test/bug61_positive.i--empty-class(match-none).re create mode 100644 re2c/test/bug61_positive.i.c create mode 100644 re2c/test/bug61_positive.i.re delete mode 100644 re2c/test/bug61a.i.c diff --git a/re2c/src/globals.h b/re2c/src/globals.h index 9f2549ad..d05f43a4 100644 --- a/re2c/src/globals.h +++ b/re2c/src/globals.h @@ -6,6 +6,7 @@ #include "src/codegen/code_names.h" #include "src/codegen/input_api.h" #include "src/ir/regexp/encoding/enc.h" +#include "src/ir/regexp/empty_class_policy.h" #include "src/util/c99_stdint.h" namespace re2c @@ -74,6 +75,8 @@ extern CodeNames mapCodeName; extern Enc encoding; extern InputAPI input_api; +extern empty_class_policy_t empty_class_policy; + } // end namespace re2c #endif // _RE2C_GLOBALS_ diff --git a/re2c/src/ir/regexp/empty_class_policy.h b/re2c/src/ir/regexp/empty_class_policy.h new file mode 100644 index 00000000..bb062de0 --- /dev/null +++ b/re2c/src/ir/regexp/empty_class_policy.h @@ -0,0 +1,15 @@ +#ifndef _RE2C_IR_REGEXP_EMPTY_CLASS_POLICY_ +#define _RE2C_IR_REGEXP_EMPTY_CLASS_POLICY_ + +namespace re2c { + +enum empty_class_policy_t +{ + EMPTY_CLASS_MATCH_EMPTY, // match on empty input + EMPTY_CLASS_MATCH_NONE, // fail to match on any input + EMPTY_CLASS_ERROR // compilation error +}; + +} // namespace re2c + +#endif // _RE2C_IR_REGEXP_EMPTY_CLASS_POLICY_ diff --git a/re2c/src/ir/regexp/regexp.cc b/re2c/src/ir/regexp/regexp.cc index d259531f..6e1cdc99 100644 --- a/re2c/src/ir/regexp/regexp.cc +++ b/re2c/src/ir/regexp/regexp.cc @@ -211,7 +211,16 @@ RegExp * Scanner::matchSymbolRange(Range * r) const { if (!r) { - return new NullOp; + switch (empty_class_policy) + { + case EMPTY_CLASS_MATCH_EMPTY: + return new NullOp; + case EMPTY_CLASS_MATCH_NONE: + break; + case EMPTY_CLASS_ERROR: + fatal ("empty character class"); + break; + } } if (encoding.is(Enc::UTF16)) diff --git a/re2c/src/main.cc b/re2c/src/main.cc index d97f7283..ff2322e6 100644 --- a/re2c/src/main.cc +++ b/re2c/src/main.cc @@ -64,6 +64,8 @@ bool bCaseInverted = false; Enc encoding; InputAPI input_api; +empty_class_policy_t empty_class_policy = EMPTY_CLASS_MATCH_EMPTY; + uint32_t last_fill_index = 0; CodeNames mapCodeName; @@ -105,6 +107,7 @@ static const mbo_opt_struct OPTIONS[] = mbo_opt_struct(13, 1, "encoding-policy"), mbo_opt_struct(14, 1, "input"), mbo_opt_struct(15, 0, "skeleton"), + mbo_opt_struct(16, 1, "empty-class"), mbo_opt_struct('-', 0, NULL) /* end of args */ }; @@ -198,6 +201,12 @@ static void usage() "--skeleton Instead of embedding re2c-generated code into C/C++ source,\n" " generate a self-contained program for the same DFA.\n" " Most useful for correctness and performance testing.\n" + "\n" + "--empty-class policy What to do if user inputs empty character class. policy can be\n" + " one of the following: 'match-empty' (match empty input, default),\n" + " 'match-none' (fail to match on any input), 'error' (compilation\n" + " error). Note that there are various ways to construct empty class,\n" + " e.g: [], [^\\x00-\\xFF], [\\x00-\\xFF]\\[\\x00-\\xFF].\n" ; } @@ -396,6 +405,20 @@ int main(int argc, char *argv[]) flag_skeleton = true; input_api.set (InputAPI::CUSTOM); break; + + case 16: + if (strcmp(opt_arg, "match-empty") == 0) + empty_class_policy = EMPTY_CLASS_MATCH_EMPTY; + else if (strcmp(opt_arg, "match-none") == 0) + empty_class_policy = EMPTY_CLASS_MATCH_NONE; + else if (strcmp(opt_arg, "error") == 0) + empty_class_policy = EMPTY_CLASS_ERROR; + else + { + std::cerr << "re2c: error: Invalid empty class policy: \"" << opt_arg << "\"\n"; + return 1; + } + break; } } diff --git a/re2c/test/bug61.i--empty-class(error).c b/re2c/test/bug61.i--empty-class(error).c new file mode 100644 index 00000000..9bce6164 --- /dev/null +++ b/re2c/test/bug61.i--empty-class(error).c @@ -0,0 +1 @@ +re2c: error: line 2, column 5: empty character class diff --git a/re2c/test/bug61a.i.re b/re2c/test/bug61.i--empty-class(error).re similarity index 84% rename from re2c/test/bug61a.i.re rename to re2c/test/bug61.i--empty-class(error).re index 0e00561e..6da4ba81 100644 --- a/re2c/test/bug61a.i.re +++ b/re2c/test/bug61.i--empty-class(error).re @@ -10,6 +10,10 @@ [\x00-\xFF]\[\x00-\xFF] {} */ +/*!re2c + []\[] {} +*/ + /*!re2c [^\x00-\xFF]\[^\x00-\xFF] {} */ diff --git a/re2c/test/bug61.i--empty-class(match-empty).c b/re2c/test/bug61.i--empty-class(match-empty).c new file mode 100644 index 00000000..f5ff7f83 --- /dev/null +++ b/re2c/test/bug61.i--empty-class(match-empty).c @@ -0,0 +1 @@ +re2c: error: line 14, column 11: can only difference char sets diff --git a/re2c/test/bug61.i--empty-class(match-empty).re b/re2c/test/bug61.i--empty-class(match-empty).re new file mode 100644 index 00000000..6da4ba81 --- /dev/null +++ b/re2c/test/bug61.i--empty-class(match-empty).re @@ -0,0 +1,19 @@ +/*!re2c + [] {} +*/ + +/*!re2c + [^\x00-\xFF] {} +*/ + +/*!re2c + [\x00-\xFF]\[\x00-\xFF] {} +*/ + +/*!re2c + []\[] {} +*/ + +/*!re2c + [^\x00-\xFF]\[^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61.i--empty-class(match-none).c b/re2c/test/bug61.i--empty-class(match-none).c new file mode 100644 index 00000000..914f45eb --- /dev/null +++ b/re2c/test/bug61.i--empty-class(match-none).c @@ -0,0 +1,30 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; +} + + + +{ + YYCTYPE yych; +} + + + +{ + YYCTYPE yych; +} + + + +{ + YYCTYPE yych; +} + + + +{ + YYCTYPE yych; +} + diff --git a/re2c/test/bug61.i--empty-class(match-none).re b/re2c/test/bug61.i--empty-class(match-none).re new file mode 100644 index 00000000..6da4ba81 --- /dev/null +++ b/re2c/test/bug61.i--empty-class(match-none).re @@ -0,0 +1,19 @@ +/*!re2c + [] {} +*/ + +/*!re2c + [^\x00-\xFF] {} +*/ + +/*!re2c + [\x00-\xFF]\[\x00-\xFF] {} +*/ + +/*!re2c + []\[] {} +*/ + +/*!re2c + [^\x00-\xFF]\[^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61.i.c b/re2c/test/bug61.i.c index 453370d6..f5ff7f83 100644 --- a/re2c/test/bug61.i.c +++ b/re2c/test/bug61.i.c @@ -1,21 +1 @@ -/* Generated by re2c */ - -{ - YYCTYPE yych; - {} -} - - - -{ - YYCTYPE yych; - {} -} - - - -{ - YYCTYPE yych; - {} -} - +re2c: error: line 14, column 11: can only difference char sets diff --git a/re2c/test/bug61.i.re b/re2c/test/bug61.i.re index 4937d7da..6da4ba81 100644 --- a/re2c/test/bug61.i.re +++ b/re2c/test/bug61.i.re @@ -9,3 +9,11 @@ /*!re2c [\x00-\xFF]\[\x00-\xFF] {} */ + +/*!re2c + []\[] {} +*/ + +/*!re2c + [^\x00-\xFF]\[^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_full.i--empty-class(error).c b/re2c/test/bug61_difference_full.i--empty-class(error).c new file mode 100644 index 00000000..70094ae3 --- /dev/null +++ b/re2c/test/bug61_difference_full.i--empty-class(error).c @@ -0,0 +1 @@ +re2c: error: line 2, column 29: empty character class diff --git a/re2c/test/bug61_difference_full.i--empty-class(error).re b/re2c/test/bug61_difference_full.i--empty-class(error).re new file mode 100644 index 00000000..47ae4e15 --- /dev/null +++ b/re2c/test/bug61_difference_full.i--empty-class(error).re @@ -0,0 +1,3 @@ +/*!re2c + [\x00-\xFF]\[\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_full.i--empty-class(match-empty).c b/re2c/test/bug61_difference_full.i--empty-class(match-empty).c new file mode 100644 index 00000000..6561f368 --- /dev/null +++ b/re2c/test/bug61_difference_full.i--empty-class(match-empty).c @@ -0,0 +1,7 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; + {} +} + diff --git a/re2c/test/bug61_difference_full.i--empty-class(match-empty).re b/re2c/test/bug61_difference_full.i--empty-class(match-empty).re new file mode 100644 index 00000000..47ae4e15 --- /dev/null +++ b/re2c/test/bug61_difference_full.i--empty-class(match-empty).re @@ -0,0 +1,3 @@ +/*!re2c + [\x00-\xFF]\[\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_full.i--empty-class(match-none).c b/re2c/test/bug61_difference_full.i--empty-class(match-none).c new file mode 100644 index 00000000..823d0409 --- /dev/null +++ b/re2c/test/bug61_difference_full.i--empty-class(match-none).c @@ -0,0 +1,6 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; +} + diff --git a/re2c/test/bug61_difference_full.i--empty-class(match-none).re b/re2c/test/bug61_difference_full.i--empty-class(match-none).re new file mode 100644 index 00000000..47ae4e15 --- /dev/null +++ b/re2c/test/bug61_difference_full.i--empty-class(match-none).re @@ -0,0 +1,3 @@ +/*!re2c + [\x00-\xFF]\[\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_full.i.c b/re2c/test/bug61_difference_full.i.c new file mode 100644 index 00000000..6561f368 --- /dev/null +++ b/re2c/test/bug61_difference_full.i.c @@ -0,0 +1,7 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; + {} +} + diff --git a/re2c/test/bug61_difference_full.i.re b/re2c/test/bug61_difference_full.i.re new file mode 100644 index 00000000..47ae4e15 --- /dev/null +++ b/re2c/test/bug61_difference_full.i.re @@ -0,0 +1,3 @@ +/*!re2c + [\x00-\xFF]\[\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_negative.i--empty-class(error).c b/re2c/test/bug61_difference_negative.i--empty-class(error).c new file mode 100644 index 00000000..9bce6164 --- /dev/null +++ b/re2c/test/bug61_difference_negative.i--empty-class(error).c @@ -0,0 +1 @@ +re2c: error: line 2, column 5: empty character class diff --git a/re2c/test/bug61_difference_negative.i--empty-class(error).re b/re2c/test/bug61_difference_negative.i--empty-class(error).re new file mode 100644 index 00000000..71a4f7bd --- /dev/null +++ b/re2c/test/bug61_difference_negative.i--empty-class(error).re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF]\[^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_negative.i--empty-class(match-empty).c b/re2c/test/bug61_difference_negative.i--empty-class(match-empty).c new file mode 100644 index 00000000..2e5aa92f --- /dev/null +++ b/re2c/test/bug61_difference_negative.i--empty-class(match-empty).c @@ -0,0 +1 @@ +re2c: error: line 2, column 31: can only difference char sets diff --git a/re2c/test/bug61_difference_negative.i--empty-class(match-empty).re b/re2c/test/bug61_difference_negative.i--empty-class(match-empty).re new file mode 100644 index 00000000..71a4f7bd --- /dev/null +++ b/re2c/test/bug61_difference_negative.i--empty-class(match-empty).re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF]\[^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_negative.i--empty-class(match-none).c b/re2c/test/bug61_difference_negative.i--empty-class(match-none).c new file mode 100644 index 00000000..823d0409 --- /dev/null +++ b/re2c/test/bug61_difference_negative.i--empty-class(match-none).c @@ -0,0 +1,6 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; +} + diff --git a/re2c/test/bug61_difference_negative.i--empty-class(match-none).re b/re2c/test/bug61_difference_negative.i--empty-class(match-none).re new file mode 100644 index 00000000..71a4f7bd --- /dev/null +++ b/re2c/test/bug61_difference_negative.i--empty-class(match-none).re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF]\[^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_negative.i.c b/re2c/test/bug61_difference_negative.i.c new file mode 100644 index 00000000..2e5aa92f --- /dev/null +++ b/re2c/test/bug61_difference_negative.i.c @@ -0,0 +1 @@ +re2c: error: line 2, column 31: can only difference char sets diff --git a/re2c/test/bug61_difference_negative.i.re b/re2c/test/bug61_difference_negative.i.re new file mode 100644 index 00000000..71a4f7bd --- /dev/null +++ b/re2c/test/bug61_difference_negative.i.re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF]\[^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_difference_positive.i--empty-class(error).c b/re2c/test/bug61_difference_positive.i--empty-class(error).c new file mode 100644 index 00000000..9bce6164 --- /dev/null +++ b/re2c/test/bug61_difference_positive.i--empty-class(error).c @@ -0,0 +1 @@ +re2c: error: line 2, column 5: empty character class diff --git a/re2c/test/bug61_difference_positive.i--empty-class(error).re b/re2c/test/bug61_difference_positive.i--empty-class(error).re new file mode 100644 index 00000000..bfad991d --- /dev/null +++ b/re2c/test/bug61_difference_positive.i--empty-class(error).re @@ -0,0 +1,3 @@ +/*!re2c + []\[] {} +*/ diff --git a/re2c/test/bug61_difference_positive.i--empty-class(match-empty).c b/re2c/test/bug61_difference_positive.i--empty-class(match-empty).c new file mode 100644 index 00000000..3cd856ff --- /dev/null +++ b/re2c/test/bug61_difference_positive.i--empty-class(match-empty).c @@ -0,0 +1 @@ +re2c: error: line 2, column 11: can only difference char sets diff --git a/re2c/test/bug61_difference_positive.i--empty-class(match-empty).re b/re2c/test/bug61_difference_positive.i--empty-class(match-empty).re new file mode 100644 index 00000000..bfad991d --- /dev/null +++ b/re2c/test/bug61_difference_positive.i--empty-class(match-empty).re @@ -0,0 +1,3 @@ +/*!re2c + []\[] {} +*/ diff --git a/re2c/test/bug61_difference_positive.i--empty-class(match-none).c b/re2c/test/bug61_difference_positive.i--empty-class(match-none).c new file mode 100644 index 00000000..823d0409 --- /dev/null +++ b/re2c/test/bug61_difference_positive.i--empty-class(match-none).c @@ -0,0 +1,6 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; +} + diff --git a/re2c/test/bug61_difference_positive.i--empty-class(match-none).re b/re2c/test/bug61_difference_positive.i--empty-class(match-none).re new file mode 100644 index 00000000..bfad991d --- /dev/null +++ b/re2c/test/bug61_difference_positive.i--empty-class(match-none).re @@ -0,0 +1,3 @@ +/*!re2c + []\[] {} +*/ diff --git a/re2c/test/bug61_difference_positive.i.c b/re2c/test/bug61_difference_positive.i.c new file mode 100644 index 00000000..3cd856ff --- /dev/null +++ b/re2c/test/bug61_difference_positive.i.c @@ -0,0 +1 @@ +re2c: error: line 2, column 11: can only difference char sets diff --git a/re2c/test/bug61_difference_positive.i.re b/re2c/test/bug61_difference_positive.i.re new file mode 100644 index 00000000..bfad991d --- /dev/null +++ b/re2c/test/bug61_difference_positive.i.re @@ -0,0 +1,3 @@ +/*!re2c + []\[] {} +*/ diff --git a/re2c/test/bug61_negative.i--empty-class(error).c b/re2c/test/bug61_negative.i--empty-class(error).c new file mode 100644 index 00000000..9bce6164 --- /dev/null +++ b/re2c/test/bug61_negative.i--empty-class(error).c @@ -0,0 +1 @@ +re2c: error: line 2, column 5: empty character class diff --git a/re2c/test/bug61_negative.i--empty-class(error).re b/re2c/test/bug61_negative.i--empty-class(error).re new file mode 100644 index 00000000..d94d97db --- /dev/null +++ b/re2c/test/bug61_negative.i--empty-class(error).re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_negative.i--empty-class(match-empty).c b/re2c/test/bug61_negative.i--empty-class(match-empty).c new file mode 100644 index 00000000..6561f368 --- /dev/null +++ b/re2c/test/bug61_negative.i--empty-class(match-empty).c @@ -0,0 +1,7 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; + {} +} + diff --git a/re2c/test/bug61_negative.i--empty-class(match-empty).re b/re2c/test/bug61_negative.i--empty-class(match-empty).re new file mode 100644 index 00000000..d94d97db --- /dev/null +++ b/re2c/test/bug61_negative.i--empty-class(match-empty).re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_negative.i--empty-class(match-none).c b/re2c/test/bug61_negative.i--empty-class(match-none).c new file mode 100644 index 00000000..823d0409 --- /dev/null +++ b/re2c/test/bug61_negative.i--empty-class(match-none).c @@ -0,0 +1,6 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; +} + diff --git a/re2c/test/bug61_negative.i--empty-class(match-none).re b/re2c/test/bug61_negative.i--empty-class(match-none).re new file mode 100644 index 00000000..d94d97db --- /dev/null +++ b/re2c/test/bug61_negative.i--empty-class(match-none).re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_negative.i.c b/re2c/test/bug61_negative.i.c new file mode 100644 index 00000000..6561f368 --- /dev/null +++ b/re2c/test/bug61_negative.i.c @@ -0,0 +1,7 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; + {} +} + diff --git a/re2c/test/bug61_negative.i.re b/re2c/test/bug61_negative.i.re new file mode 100644 index 00000000..d94d97db --- /dev/null +++ b/re2c/test/bug61_negative.i.re @@ -0,0 +1,3 @@ +/*!re2c + [^\x00-\xFF] {} +*/ diff --git a/re2c/test/bug61_positive.i--empty-class(error).c b/re2c/test/bug61_positive.i--empty-class(error).c new file mode 100644 index 00000000..9bce6164 --- /dev/null +++ b/re2c/test/bug61_positive.i--empty-class(error).c @@ -0,0 +1 @@ +re2c: error: line 2, column 5: empty character class diff --git a/re2c/test/bug61_positive.i--empty-class(error).re b/re2c/test/bug61_positive.i--empty-class(error).re new file mode 100644 index 00000000..48ed19d9 --- /dev/null +++ b/re2c/test/bug61_positive.i--empty-class(error).re @@ -0,0 +1,3 @@ +/*!re2c + [] {} +*/ diff --git a/re2c/test/bug61_positive.i--empty-class(match-empty).c b/re2c/test/bug61_positive.i--empty-class(match-empty).c new file mode 100644 index 00000000..6561f368 --- /dev/null +++ b/re2c/test/bug61_positive.i--empty-class(match-empty).c @@ -0,0 +1,7 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; + {} +} + diff --git a/re2c/test/bug61_positive.i--empty-class(match-empty).re b/re2c/test/bug61_positive.i--empty-class(match-empty).re new file mode 100644 index 00000000..48ed19d9 --- /dev/null +++ b/re2c/test/bug61_positive.i--empty-class(match-empty).re @@ -0,0 +1,3 @@ +/*!re2c + [] {} +*/ diff --git a/re2c/test/bug61_positive.i--empty-class(match-none).c b/re2c/test/bug61_positive.i--empty-class(match-none).c new file mode 100644 index 00000000..823d0409 --- /dev/null +++ b/re2c/test/bug61_positive.i--empty-class(match-none).c @@ -0,0 +1,6 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; +} + diff --git a/re2c/test/bug61_positive.i--empty-class(match-none).re b/re2c/test/bug61_positive.i--empty-class(match-none).re new file mode 100644 index 00000000..48ed19d9 --- /dev/null +++ b/re2c/test/bug61_positive.i--empty-class(match-none).re @@ -0,0 +1,3 @@ +/*!re2c + [] {} +*/ diff --git a/re2c/test/bug61_positive.i.c b/re2c/test/bug61_positive.i.c new file mode 100644 index 00000000..6561f368 --- /dev/null +++ b/re2c/test/bug61_positive.i.c @@ -0,0 +1,7 @@ +/* Generated by re2c */ + +{ + YYCTYPE yych; + {} +} + diff --git a/re2c/test/bug61_positive.i.re b/re2c/test/bug61_positive.i.re new file mode 100644 index 00000000..48ed19d9 --- /dev/null +++ b/re2c/test/bug61_positive.i.re @@ -0,0 +1,3 @@ +/*!re2c + [] {} +*/ diff --git a/re2c/test/bug61a.i.c b/re2c/test/bug61a.i.c deleted file mode 100644 index 39becbe0..00000000 --- a/re2c/test/bug61a.i.c +++ /dev/null @@ -1 +0,0 @@ -re2c: error: line 14, column 31: can only difference char sets -- 2.40.0