diff options
| author | Gerd Moellmann | 2000-01-27 11:40:40 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-01-27 11:40:40 +0000 |
| commit | f95d599c5167087059cfb25d380f69152ec3f587 (patch) | |
| tree | 82ee24b9895ee29792f733e4dd2f96a409d0fdec /src | |
| parent | 7c7b25db8c0da5d241321e5385d19ea89402a00e (diff) | |
| download | emacs-f95d599c5167087059cfb25d380f69152ec3f587.tar.gz emacs-f95d599c5167087059cfb25d380f69152ec3f587.zip | |
Lost version containing non-greedy changes from Emacs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/regex.h b/src/regex.h index 72416837988..36775d567aa 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -38,9 +38,12 @@ | |||
| 38 | add or remove a bit, only one other definition need change. */ | 38 | add or remove a bit, only one other definition need change. */ |
| 39 | typedef unsigned reg_syntax_t; | 39 | typedef unsigned reg_syntax_t; |
| 40 | 40 | ||
| 41 | /* If this bit is set, then even *?, +? and ?? match greedily. */ | ||
| 42 | #define RE_ALL_GREEDY (1) | ||
| 43 | |||
| 41 | /* If this bit is not set, then \ inside a bracket expression is literal. | 44 | /* If this bit is not set, then \ inside a bracket expression is literal. |
| 42 | If set, then such a \ quotes the following character. */ | 45 | If set, then such a \ quotes the following character. */ |
| 43 | #define RE_BACKSLASH_ESCAPE_IN_LISTS (1) | 46 | #define RE_BACKSLASH_ESCAPE_IN_LISTS (RE_ALL_GREEDY << 1) |
| 44 | 47 | ||
| 45 | /* If this bit is not set, then + and ? are operators, and \+ and \? are | 48 | /* If this bit is not set, then + and ? are operators, and \+ and \? are |
| 46 | literals. | 49 | literals. |
| @@ -127,13 +130,13 @@ typedef unsigned reg_syntax_t; | |||
| 127 | starting range point, the range is ignored. */ | 130 | starting range point, the range is ignored. */ |
| 128 | #define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) | 131 | #define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) |
| 129 | 132 | ||
| 130 | /* If this bit is set, then an unmatched ) is ordinary. | ||
| 131 | If not set, then an unmatched ) is invalid. */ | ||
| 132 | #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) | ||
| 133 | |||
| 134 | /* If this bit is set, succeed as soon as we match the whole pattern, | 133 | /* If this bit is set, succeed as soon as we match the whole pattern, |
| 135 | without further backtracking. */ | 134 | without further backtracking. */ |
| 136 | #define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) | 135 | #define RE_NO_POSIX_BACKTRACKING (RE_NO_EMPTY_RANGES << 1) |
| 136 | |||
| 137 | /* If this bit is set, then an unmatched ) is ordinary. | ||
| 138 | If not set, then an unmatched ) is invalid. */ | ||
| 139 | #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_POSIX_BACKTRACKING << 1) | ||
| 137 | 140 | ||
| 138 | /* This global variable defines the particular regexp syntax to use (for | 141 | /* This global variable defines the particular regexp syntax to use (for |
| 139 | some interfaces). When a regexp is compiled, the syntax used is | 142 | some interfaces). When a regexp is compiled, the syntax used is |
| @@ -158,7 +161,7 @@ extern Lisp_Object re_match_object; | |||
| 158 | (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ | 161 | (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ |
| 159 | | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | 162 | | RE_NO_BK_PARENS | RE_NO_BK_REFS \ |
| 160 | | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ | 163 | | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ |
| 161 | | RE_UNMATCHED_RIGHT_PAREN_ORD) | 164 | | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_ALL_GREEDY) |
| 162 | 165 | ||
| 163 | #define RE_SYNTAX_POSIX_AWK \ | 166 | #define RE_SYNTAX_POSIX_AWK \ |
| 164 | (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) | 167 | (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) |
| @@ -166,13 +169,13 @@ extern Lisp_Object re_match_object; | |||
| 166 | #define RE_SYNTAX_GREP \ | 169 | #define RE_SYNTAX_GREP \ |
| 167 | (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ | 170 | (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ |
| 168 | | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ | 171 | | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ |
| 169 | | RE_NEWLINE_ALT) | 172 | | RE_NEWLINE_ALT | RE_ALL_GREEDY) |
| 170 | 173 | ||
| 171 | #define RE_SYNTAX_EGREP \ | 174 | #define RE_SYNTAX_EGREP \ |
| 172 | (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ | 175 | (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ |
| 173 | | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ | 176 | | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ |
| 174 | | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ | 177 | | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ |
| 175 | | RE_NO_BK_VBAR) | 178 | | RE_NO_BK_VBAR | RE_ALL_GREEDY) |
| 176 | 179 | ||
| 177 | #define RE_SYNTAX_POSIX_EGREP \ | 180 | #define RE_SYNTAX_POSIX_EGREP \ |
| 178 | (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES) | 181 | (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES) |
| @@ -185,7 +188,7 @@ extern Lisp_Object re_match_object; | |||
| 185 | /* Syntax bits common to both basic and extended POSIX regex syntax. */ | 188 | /* Syntax bits common to both basic and extended POSIX regex syntax. */ |
| 186 | #define _RE_SYNTAX_POSIX_COMMON \ | 189 | #define _RE_SYNTAX_POSIX_COMMON \ |
| 187 | (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ | 190 | (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ |
| 188 | | RE_INTERVALS | RE_NO_EMPTY_RANGES) | 191 | | RE_INTERVALS | RE_NO_EMPTY_RANGES | RE_ALL_GREEDY) |
| 189 | 192 | ||
| 190 | #define RE_SYNTAX_POSIX_BASIC \ | 193 | #define RE_SYNTAX_POSIX_BASIC \ |
| 191 | (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) | 194 | (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) |