1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-30 09:00:31 -08:00
Commit graph

199 commits

Author SHA1 Message Date
Richard M. Stallman
134579f2da (re_match_2_internal) <symend, wordend>:
Fix calls to UPDATE_SYNTAX_TABLE_FORWARD.
2004-12-20 11:06:54 +00:00
Stefan Monnier
c72b0edd08 (GET_UNSIGNED_NUMBER): Signal an error when reaching the end.
Remove redundant correctness checks.
(regex_compile): Fix up error codes for \{..\} expressions.
2004-12-06 00:41:40 +00:00
Richard M. Stallman
c721eee5e3 (regex_compile): Fix end-of-pattern case for space. 2004-12-05 23:34:44 +00:00
Richard M. Stallman
4fb680cd9c Fix previous change. 2004-11-19 19:47:39 +00:00
Richard M. Stallman
f9b0fd9964 (regex_compile): Substitute whitespace_regexp for spaces, if it is nonzero.
(whitespace_regexp): New variable.
(re_set_whitespace_regexp): New function.
2004-11-19 19:36:09 +00:00
Kenichi Handa
b3e4c89795 (re_error_msgid): Add an entry for REG_ERANGEX.
(regex_compile): Return REG_ERANGEX if appropriate.
2004-10-24 03:56:51 +00:00
Richard M. Stallman
1fdab50394 (re_wctype, re_iswctype): Function defs longer static.
(CHAR_CLASS_MAX_LENGTH, re_wctype_t, re_wchar_t)
(re_wctype, re_iswctype, re_wctype_to_bit):
Non-function definitions moved to regex.h.
2004-06-13 22:36:05 +00:00
Stefan Monnier
e2543b02bf (print_partial_compiled_pattern): Add missing 'break'
after 'case wordend'.  For symbeg and symend, print to stderr,
like the other cases.
2004-05-28 22:28:09 +00:00
Stefan Monnier
669fa600c6 Add support for new '\_<' and '\_>' regexp operators, matching the
beginning and ends of symbols.
* regex.c (enum syntaxcode): Add Ssymbol.
(init_syntax_once): Set the syntax for '_' to Ssymbol, not Sword.
(re_opcode_t): New opcodes `symbeg' and `symend'.
(print_partial_compiled_pattern): Print the new opcodes properly.
(regex_compile): Parse the new operators.
(analyse_first): Skip symbeg and symend (they match only the empty string).
(mutually_exclusive_p): `symend' is mutually exclusive with \s_ and
\sw; `symbeg' is mutually exclusive with \S_ and \Sw.
(re_match_2_internal): Match symbeg and symend.
2004-05-19 16:38:34 +00:00
Eli Zaretskii
2a0c736beb (mutually_exclusive_p): In 'case wordbeg', compare op2
against proper opcode.
2004-05-11 09:47:25 +00:00
Richard M. Stallman
275a34095a (MAX_BUF_SIZE): Reduce to 2**15.
(print_partial_compiled_pattern): Replace assert with a printout.
(skip_noops, mutually_exclusive_p): Change args, values to re_char *.
2003-10-13 18:48:14 +00:00
Richard M. Stallman
7c67c9f660 (regex_compile): Free the stack when returning from function. 2003-09-30 12:36:17 +00:00
Miles Bader
ab5796a9f9 Add arch taglines 2003-09-01 15:45:59 +00:00
Richard M. Stallman
a1a052dfa5 (print_partial_compiled_pattern): Output to stderr. 2003-02-23 15:00:30 +00:00
Juanma Barranquero
177c0ea743 Trailing whitespace deleted. 2003-02-04 14:56:31 +00:00
Kenichi Handa
70806df64d (GET_CHAR_BEFORE_2): Use PREV_CHAR_BOUNDARY.
(re_search_2): Likewise.
2003-01-16 04:31:55 +00:00
Dave Love
1fc84d77bb (_GNU_SOURCE): Don't define. 2002-11-18 15:40:28 +00:00
Dave Love
9f2dbe01ef (regexec): Fix pmatch declaration. 2002-11-07 20:53:33 +00:00
Stefan Monnier
6df42991d3 (DISCARD_FAILURE_REG_OR_COUNT): Delete.
(CHECK_INFINITE_LOOP): Don't pop anything: just set `cycle' to 1.
(re_match_2_internal): Be more careful with infinite loops.
2002-09-10 05:59:32 +00:00
Richard M. Stallman
098d42af72 (regnum_t): Use signed int, not unsigned int. 2002-09-09 19:41:30 +00:00
Richard M. Stallman
b7c1256511 (set_image_of_range_1): In no-TRANSLATE case,
call EXTEND_RANGE_TABLE and return a proper value.
(set_image_of_range): Don't call set_image_of_range_1
if no TRANSLATE or if range includes all of Latin-1.
Only call it for the Latin-1 part of the range.
For other cases, make two separate ranges,
one for the original specified characters and one for
their case-conversions.
2002-09-06 03:09:13 +00:00
Richard M. Stallman
77d11aec51 (set_image_of_range_1): New function.
(set_image_of_range): Use set_image_of_range_1 for Latin-1.
Return a value to indicate running out of memory.
(SET_RANGE_TABLE_WORK_AREA): Check value from set_image_of_range.
(extend_range_table_work_area): New subroutine.
(EXTEND_RANGE_TABLE): Replaces EXTEND_RANGE_TABLE_WORK_AREA.
Different calling conventions, and used from set_image_of_range{,_1}.
(IMMEDIATE_QUIT_CHECK): Definitions moved.
2002-09-05 02:34:37 +00:00
Stefan Monnier
365958144e (PATFETCH): Remove the translating fetch.
(PATFETCH_RAW): Rename to PATFETCH.
(set_image_of_range): New fun.
(SET_RANGE_TABLE_WORK_AREA): Use it.
(regex_compile): Don't translate the pattern chars so eagerly.
Only do it when inserting an `exactn' bytecode or when handling a char-range.
(mutually_exclusive_p): Avoid empty statement.
2002-08-23 22:21:51 +00:00
Richard M. Stallman
060cc8ffa0 (GET_UNSIGNED_NUMBER): Give proper error for spaces. 2002-03-25 00:45:48 +00:00
Richard M. Stallman
f6df485fd7 (DISCARD_FAILURE_REG_OR_COUNT): New macro.
(CHECK_INFINITE_LOOP): Use DISCARD_FAILURE_REG_OR_COUNT
when jumping to `fail' to avoid undoing reg changes in the
last iteration of the loop.
(GET_UNSIGNED_NUMBER): Skip spaces around the number.
2002-03-21 09:44:43 +00:00
Stefan Monnier
ada30c0eab (re_wctype): Try to fix some warnings.
(regcomp, regexec): Don't forget the __restrict.
2001-11-02 16:06:54 +00:00
Gerd Moellmann
5e5388f653 (WIDE_CHAR_SUPPORT): Do not use defined() in macro.
From Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
2001-10-09 10:05:32 +00:00
Eli Zaretskii
7689ef0b8a (malloc, realloc, free) [emacs]: Undefine before
redefining, to avoid compiler warnings.
2001-05-12 10:54:10 +00:00
Stefan Monnier
609b757aa4 (mutually_exclusive_p): Add missing break' at the end of charset' processing. 2001-01-25 01:44:54 +00:00
Stefan Monnier
411e420305 (mutually_exclusive_p): Don't blindly handle `charset_not'
as if it was a `charset'.
2001-01-24 23:11:40 +00:00
Stefan Monnier
0cdd06f849 (re_iswctype, re_wctype_to_bit): Fix braino.
(regex_compile): Catch bogus \(\1\).
2000-10-30 15:20:17 +00:00
Stefan Monnier
6dcf2d0e0c (POP_FAILURE_REG_OR_COUNT, re_match_2_internal)
(re_match_2_internal, re_match_2_internal, re_match_2_internal):
Giving in to popular pressure to shut up the compiler with casts.
2000-10-27 13:29:36 +00:00
Stefan Monnier
0161849810 More unsigned char' -> re_char' changes.
Also change several `int' into `re_wchar_t'.
(PATTERN_STACK_EMPTY, PUSH_PATTERN_OP, POP_PATTERN_OP): Remove.
(PUSH_FAILURE_POINTER): Don't cast any more.
(POP_FAILURE_REG_OR_COUNT): Remove the cast that strips `const'.
We want GCC to complain, since this piece of code makes
re_match non-reentrant, which *should* be fixed.
(GET_BUFFER_SPACE): Use size_t rather than unsigned long.
(EXTEND_BUFFER): Use RETALLOC.
(SET_LIST_BIT): Don't cast.
(re_wchar_t): New type.
(re_iswctype, re_wctype_to_bit): Make it crystal clear to GCC
that those two functions will always properly return.
(IMMEDIATE_QUIT_CHECK): Cast to void.
(analyse_first): Use recursion rather than an explicit stack.
(re_compile_fastmap): Can't fail anymore.
(re_search_2): Don't check re_compile_fastmap for failure.
(PUSH_NUMBER): Renamed from PUSH_FAILURE_COUNT.
Now also sets the new value (passed in a new argument).
(re_match_2_internal): Use it.
Also, use a new var `reg' of type size_t when looping through regs
rather than reuse the inappropriate `mcnt'.
2000-10-26 00:45:01 +00:00
Andrew Innes
5b370c2bad (IMMEDIATE_QUIT_CHECK): New macro, which does QUIT on
NT-Emacs only.
(re_match_2_internal): Use IMMEDIATE_QUIT_CHECK instead of QUIT,
so that re_search functions only quit when callers expect them to.
2000-10-24 14:00:55 +00:00
Kenichi Handa
333526e0f4 (regex_compile): Fix previous change. 2000-10-24 08:27:34 +00:00
Kenichi Handa
3ff2446d46 (regex_compile): Change the way of handling a range from a char less
than 256 to a char not less than 256.
2000-10-24 08:10:27 +00:00
Jeff Bailey
6a45ac9cbd Remove warning that noone noticed anyway 2000-10-17 06:55:04 +00:00
Stefan Monnier
a0ad02f7fb (WIDE_CHAR_SUPPORT): Define if _LIBC as well.
Mostly, just a test of the CVS repository.
2000-10-15 16:44:45 +00:00
Jeff Bailey
1c024bdaaa Add warning to top of source files 2000-09-19 15:47:02 +00:00
Stefan Monnier
14473664b8 (WIDE_CHAR_SUPPORT): New macro.
(btowc, iswctype, wctype) [_LIBC]: Redefine to __<fun>.
(BIT_ALPHA, BIT_ALNUM, BIT_ASCII, BIT_NONASCII, BIT_GRAPH, BIT_PRINT)
(BIT_UNIBYTE): Remove.
(re_match_2_internal): Delete corresponding code and streamline the
BIT_MULTIBYTE case to not bother checking ISUNIBYTE.
(CHAR_CLASS_MAX_LENGTH) [!WIDE_CHAR_SUPPORT]: Set to 9 rather than 6.
(re_wctype_t): New type.
(re_wctype, re_iswctype, re_wctype_to_bit): New functions.
(regex_compile): Use them and fix handling of overly long char classes.
2000-09-04 04:24:00 +00:00
Stefan Monnier
c0f9ea083e * regex.h (RE_NO_NEWLINE_ANCHOR): New syntax flag.
(struct re_pattern_buffer): Remove newline_anchor.
* regex.c: Keep namespace clean for GNU libc by renaming <fun>
to __<fun> and using `weak_alias (__<fun>, <fun>)'.
(re_max_failures, fail_stack): Use size_t rather than unsigned.
(regex_compile): For ^ and $, choose between buffer and line (beg|end)
depending on the new RE_NO_NEWLINE_ANCHOR syntax flag.
(print_compiled_pattern, re_search_2, mutually_exclusive_p)
(re_match_2_internal, re_compile_pattern, re_comp, regcomp):
Get rid of references to newline_anchor.
(regcomp): Allocate and precompute a fastmap.
2000-08-31 17:19:15 +00:00
Stefan Monnier
4bb91c680f Merge some changes from GNU libc. Add prototypes.
(bcopy, bcmp, REGEX_REALLOCATE, re_match_2_internal):
Use memcmp and memcpy instead of bcopy and bcmp.
(init_syntax_once): Use ISALNUM.
(PUSH_FAILURE_POINT, re_match_2_internal): Remove failure_id.
(REG_UNSET_VALUE): Remove.  Use NULL instead.
(REG_UNSET, re_match_2_internal): Use NULL.
(SET_HIGH_BOUND, MOVE_BUFFER_POINTER, ELSE_EXTEND_BUFFER_HIGH_BOUND):
New macros.
(EXTEND_BUFFER): Use them (to work with BOUNDED_POINTERS).
(GET_UNSIGNED_NUMBER): Don't use ISDIGIT.
(regex_compile): In handle_interval, return an error rather than try to
unfetch the interval if we can't find the closing brace.
Obey the RE_NO_GNU_OPS syntax bit.
(TOLOWER): New macro.
(regcomp): Use it.
(regexec): Allocate regs.start and regs.end as one block.
2000-08-30 18:31:30 +00:00
Stefan Monnier
0b32bf0e34 * regex.c: Indent cpp directives and remove parens after `defined'.
(PTR_TO_OFFSET, POS_AS_IN_BUFFER): Move to a better place.
(ISDIGIT, ISCNTRL, ISXDIGIT) [!emacs]: Remove duplicate definition.
(regex_compile): Use RE_FRUGAL instead of RE_ALL_GREEDY.
(re_compile_pattern): Use size_t for length.
(init_syntax_once): Move to a better place.
* regex.h: Merge changes from GNU libc.  Indent cpp directives.
(RE_FRUGAL): Replaces RE_ALL_GREEDY (inverted meaning).
2000-08-28 00:37:50 +00:00
Stefan Monnier
dc1e502dd9 (PUSH_FAILURE_COUNT): New macro.
(POP_FAILURE_REG_OR_COUNT): Renamed from POP_FAILURE_REG.
Handle popping of a register's or a counter's data.
(POP_FAILURE_POINT): Use the new name.
(re_match_2_internal): Push counter data on the stack for succeed_n,
jump_n and set_number_at and remove misleading dead code in succeed_n.
2000-08-25 14:35:12 +00:00
Kenichi Handa
e0277a4716 (regex_compile) <normal_char>: Pay attention to multibyteness.
(analyse_first) <exactn>: Setup fastmap correctly for
eight-bit-control characters.
2000-08-11 01:56:59 +00:00
Stefan Monnier
a60198e5df (re_match, re_match_2): Protect calls to alloca (0).
(re_comp): Cast gettext return value to avoid complaints when
!HAVE_LIBINTL.
2000-06-20 16:48:05 +00:00
Kenichi Handa
b54f61ed95 (MAKE_CHAR) [!emacs]: Dummy macro for non-Emacs env.
(regex_compile): Fix the code for handling the case of single byte
char and multibyte char being mixed in a range within [...].
2000-06-10 08:04:33 +00:00
Stefan Monnier
f1ad044f23 (PREFETCH_NOLIMIT): New function.
(re_match_2_internal): Use it and adjust the end_match_2 logic.
2000-05-30 02:59:54 +00:00
Stefan Monnier
d2af47dfec (at_begline_loc_p): Also recognize the \\(?:^ case
of an anchor at the beginning of a shy-group.
2000-05-25 16:32:19 +00:00
Stefan Monnier
419d1c749d (re_match_2_internal): Don't shorten the strings anymore,
instead define end_match(1|2) more carefully.
Use GET_CHAR_BEFORE_2 for `begline'.
2000-04-19 21:39:18 +00:00