diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-02 15:27:12 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-02 15:29:03 -0700 |
commit | 3c381d05ed984f756f45d21776670fa74e1687ca (patch) | |
tree | db98175472f2f4762912421481f6a87346bd22ec /src/dfasearch.c | |
parent | ad468bbe3df027f29ecb236283084fb60b734f68 (diff) | |
download | grep-3c381d05ed984f756f45d21776670fa74e1687ca.tar.gz |
dfa: new option for anchored searches
This follows up on a suggestion by Norihiro Tanaka (Bug#24262).
* src/dfa.c (struct regex_syntax): New member 'anchor'.
(char_context): Use it.
(dfasyntax): Change signature to specify it, along with the old
FOLD and EOL args, as a single DFAOPTS arg. All uses changed.
* src/dfa.h (DFA_ANCHOR, DFA_CASE_FOLD, DFA_EOL_NUL): New constants
for dfasyntax new last arg.
Diffstat (limited to 'src/dfasearch.c')
-rw-r--r-- | src/dfasearch.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dfasearch.c b/src/dfasearch.c index 0838e1fe..96be58f2 100644 --- a/src/dfasearch.c +++ b/src/dfasearch.c @@ -123,7 +123,9 @@ GEAcompile (char const *pattern, size_t size, reg_syntax_t syntax_bits) if (match_icase) syntax_bits |= RE_ICASE; re_set_syntax (syntax_bits); - dfasyntax (dfa, &localeinfo, syntax_bits, match_icase, eolbyte); + int dfaopts = ((match_icase ? DFA_CASE_FOLD : 0) + | (eolbyte ? 0 : DFA_EOL_NUL)); + dfasyntax (dfa, &localeinfo, syntax_bits, dfaopts); /* For GNU regex, pass the patterns separately to detect errors like "[\nallo\n]\n", where the patterns are "[", "allo" and "]", and |