From 9409743bdac8ac0478f0746adccab2ddc0513eb0 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Thu, 8 Feb 2001 17:21:55 +0000 Subject: Range fixex. Handle range expressions correctly even when they match strings with two or more characters. * src/dfa.h (CRANGE): New enum value. Comment fix. * src/dfa.c: Include if HAVE_SETLOCALE. Include "hard-locale.h". (prtok): Print CRANGE. (hard_LC_COLLATE): New static var. (lex): Return CRANGE when parsing a character range in a hard locale. Don't use strcoll; it's no longer needed and wasn't correct anyway. Use unsigned rather than token to hold unsigned chars. (addtok): Comment fix. (atom): Treat a CRANGE as if it were (.\1), approximately. (dfaparse): Initialize hard_LC_COLLATE. * src/Makefile.am (base_sources): Add hard-locale.c, hard-locale.h. * src/hard-locale.c, src/hard-locale.h: New files, taken from textutils. --- src/dfa.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/dfa.h') diff --git a/src/dfa.h b/src/dfa.h index dae3391e..cab659a5 100644 --- a/src/dfa.h +++ b/src/dfa.h @@ -142,6 +142,12 @@ typedef enum RPAREN, /* RPAREN never appears in the parse tree. */ + CRANGE, /* CRANGE never appears in the parse tree. + It stands for a character range that can + match a string of one or more characters. + For example, [a-z] can match "ch" in + a Spanish locale. */ + CSET /* CSET and (and any value greater) is a terminal symbol that matches any of a class of characters. */ @@ -361,6 +367,5 @@ extern void dfastate PARAMS ((int, struct dfa *, int [])); /* dfaerror() is called by the regexp routines whenever an error occurs. It takes a single argument, a NUL-terminated string describing the error. - The default dfaerror() prints the error message to stderr and exits. - The user can provide a different dfafree() if so desired. */ + The user must supply a dfaerror. */ extern void dfaerror PARAMS ((const char *)); -- cgit v1.2.1