From 73adc1f3ddda54da9faaf155cf6bf95b613ac221 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 9 Mar 2020 15:34:34 +0000 Subject: [PATCH] changed the tre parser to treat a backslash as an escaper inside [] --- qse/lib/cmn/tre-parse.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qse/lib/cmn/tre-parse.c b/qse/lib/cmn/tre-parse.c index 9203d701..0d15d099 100644 --- a/qse/lib/cmn/tre-parse.c +++ b/qse/lib/cmn/tre-parse.c @@ -278,6 +278,15 @@ tre_parse_bracket_items(tre_parse_ctx_t *ctx, int negate, if (min > max) status = REG_ERANGE; } + /* QSE: handle \ as an escaper */ + else if (re + 1 < ctx->re_end && *re == CHAR_BACKSLASH) + { + /* escaped character inside [] */ + min = max = *(re + 1); + re += 2; + } + /* END QSE */ + else if (re + 1 < ctx->re_end && *re == CHAR_LBRACKET && *(re + 1) == CHAR_PERIOD) status = REG_ECOLLATE;