summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove an entry from the BUGS section: we have multibyte charactertjr2004-07-121-2/+0
| | | | support now.
* Make regular expression matching aware of multibyte characters. The generaltjr2004-07-125-324/+478
| | | | | | | | | | | | | | | | | idea is that we perform multibyte->wide character conversion while parsing and compiling, then convert byte sequences to wide characters when they're needed for comparison and stepping through the string during execution. As with tr(1), the main complication is to efficiently represent sets of characters in bracket expressions. The old bitmap representation is replaced by a bitmap for the first 256 characters combined with a vector of individual wide characters, a vector of character ranges (for [A-Z] etc.), and a vector of character classes (for [[:alpha:]] etc.). One other point of interest is that although the Boyer-Moore algorithm had to be disabled in the general multibyte case, it is still enabled for UTF-8 because of its self-synchronizing nature. This greatly speeds up matching by reducing the number of multibyte conversions that need to be done.
* Add a new error code, REG_ILLSEQ, to indicate that a regular expressiontjr2004-07-122-1/+5
| | | | contains an illegal multibyte character sequence.
* Remove incomplete support for multi-character collating elements. Removetjr2004-07-112-262/+8
| | | | unused character category calculations.
* Document incorrect handling of multibyte characters.tjr2004-07-061-1/+3
|
* Mechanically kill hard sentence breaks.ru2004-07-022-3/+3
|
* mdoc(7): Use the new feature of the .In macro.ru2003-09-081-1/+1
|
* Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).nectar2003-02-163-6/+6
| | | | | | | Only warnings that could be fixed without changing the generated object code and without restructuring the source code have been handled. Reviewed by: /sbin/md5
* mdoc(7) police: "The .Fa argument.".ru2002-12-191-2/+6
|
* mdoc(7) police: "The .Fn function".ru2002-12-181-10/+31
|
* libc_r wasn't so tied to libc for 22 months.ru2002-11-181-3/+1
|
* Add restrict type-qualifier.mike2002-10-024-14/+15
|
* Replace various spelling with FALLTHROUGH which is lint()ablecharnier2002-08-251-1/+1
|
* Fix the style of the SCM ID's.obrien2002-03-226-1/+5
| | | | I believe have made all of libc .h's as consistent as possible.
* Fix the style of the SCM ID's.obrien2002-03-226-12/+16
| | | | I believe have made all of libc .c's as consistent as possible.
* Back out last commit (rev 1.2). I thought I caught this file in timeobrien2002-03-221-1/+1
| | | | when deP'ing. But I guess not.
* Remove __P() usage.obrien2002-03-214-54/+54
|
* Remove 'register' keyword.obrien2002-03-218-330/+334
|
* Fix a typo I made in revision 1.5.ru2002-01-221-1/+1
| | | | Submitted by: trevor
* The algorithm that computes the tables used in the BM search algorithm sometimesdcs2001-11-091-1/+2
| | | | | | | | | | access an array beyond it's length. This only happens in the last iteration of a loop, and the value fetched is not used then, so the bug is a relatively innocent one. Fix this by not fetching any value on the last iteration of said loop. Submitted by: MKI <mki@mozone.net> MFC after: 1 week
* mdoc(7) police: Use the new .In macro for #include statements.ru2001-10-011-2/+2
|
* mdoc(7) police: protect trailing full stops of abbreviationsru2001-08-101-1/+1
| | | | with a trailing zero-width space: `e.g.\&'.
* mdoc(7) police:ru2001-08-071-4/+2
| | | | | | | Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block.
* Remove whitespace at EOL.dd2001-07-151-2/+2
|
* MAN[1-9] -> MAN.ru2001-03-271-2/+2
|
* mdoc(7) police: fixed the weird construct.ru2001-02-091-3/+1
|
* man(7) -> mdoc(7).ru2001-01-121-266/+433
|
* Prepare for mdoc(7)NG.ru2000-12-291-13/+13
|
* Replace a `dagger' sign with a `double dagger' one.ru2000-11-161-15/+15
| | | | The former looks ugly on grotty(1) devices.
* Convert this from -man to -mdoc.ru2000-11-141-140/+345
|
* Actually make it so this Makefile can build grot.green2000-07-101-1/+8
|
* Add a test case for one of the bugs found on the new additions todcs2000-07-091-0/+1
| | | | regex(3).
* Spencer's regex(3) test code.dcs2000-07-098-0/+1727
| | | | Obtained from: BSD/OS
* altoffset() always returned whenever it recursed, because at the enddcs2000-07-091-0/+4
| | | | | | | | | | | | | | of the processing of the recursion, "scan" would be pointing to O_CH (or O_QUEST), which would then be interpreted as being the end character for altoffset(). We avoid this by properly increasing scan before leaving the switch. Without this, something like (a?b?)?cc would result in a g->moffset of 1 instead of 2. I added a case to the soon-to-be-imported regex(3) test code to catch this error.
* Since g->moffset points to the _maximum_ offset at which the mustdcs2000-07-091-1/+1
| | | | | | | | | | | | | string may be found (from the beginning of the pattern), the point at which must is found minus that offset may actually point to some place before the start of the text. In that case, make start = start. Alternatively, this could be tested for in the preceding if, but it did not occur to me. :-) Caught by: regex(3) test code
* Add some casts here and there.dcs2000-07-091-3/+3
|
* Since we have modified charjump to be CHAR_MIN-based, we have todcs2000-07-081-1/+2
| | | | | | correct the offset when we free it. Caught by: phkmalloc
* Do not free NULL pointers.dcs2000-07-071-1/+1
|
* Deal with the signed/unsigned chars issue in a more proper manner. Wedcs2000-07-072-21/+17
| | | | | | | | | use a CHAR_MIN-based array, like elsewhere in the code. Remove a number of unused variables (some due to the above change, one that was left after a number of optimizing steps through the source). Brucified by: bde
* I hate signed chars.^W^W^W^W^WCast to unsigned char before using signeddcs2000-07-061-1/+1
| | | | chars as array indices.
* Correct comment to work with test code.dcs2000-07-061-2/+2
| | | | Prevent out of bounds array access in some specific cases.
* Use UCHAR_MAX consistently.dcs2000-07-061-1/+1
|
* Fix memory leak introduced with regcomp.c rev 1.14.dcs2000-07-021-0/+6
|
* Enhance the optimization provided by pre-matching. Fix style bugs withdcs2000-07-023-12/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | previous commits. At the time we search the pattern for the "must" string, we now compute the longest offset from the beginning of the pattern at which the must string might be found. If that offset is found to be infinite (through use of "+" or "*"), we set it to -1 to disable the heuristics applied later. After we are done with pre-matching, we use that offset and the point in the text at which the must string was found to compute the earliest point at which the pattern might be found. Special care should be taken here. The variable "start" is passed to the automata-processing functions fast() and slow() to indicate the point in the text at which they should start working from. The real beginning of the text is passed in a struct match variable m, which is used to check for anchors. That variable, though, is initialized with "start", so we must not adjust "start" before "m" is properly initialized. Simple tests showed a speed increase from 100% to 400%, but they were biased in that regexec() was called for the whole file instead of line by line, and parenthized subexpressions were not searched for. This change adds a single integer to the size of the "guts" structure, and does not change the ABI. Further improvements possible: Since the speed increase observed here is so huge, one intuitive optimization would be to introduce a bias in the function that computes the "must" string so as to prefer a smaller string with a finite offset over a larger one with an infinite offset. Tests have shown this to be a bad idea, though, as the cost of false pre-matches far outweights the benefits of a must offset, even in biased situations. A number of other improvements suggest themselves, though: * identify the cases where the pattern is identical to the must string, and avoid entering fast() and slow() in these cases. * compute the maximum offset from the must string to the end of the pattern, and use that to set the point at which fast() and slow() should give up trying to find a match, and return then return to pre-matching. * return all the way to pre-matching if a "match" was found and later invalidated by back reference processing. Since back references are evil and should be avoided anyway, this is of little use.
* Remove from the notes a bug that it's said to have been fixed.dcs2000-07-021-5/+0
| | | | | | PR: 15561 Submitted by: Martin Kammerhofer <mkamm@gmx.net> Confirmed by: ache
* Initialize variables used by the Boyer-Moore algorithm.dcs2000-06-291-0/+2
| | | | | | | This should fix core dumps when the must pattern is of length three or less. Bug found by: knu
* Add Boyler-Moore algorithm to pre-matching test.dcs2000-06-293-6/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BM algorithm works by scanning the pattern from right to left, and jumping as many characters as viable based on the text's mismatched character and the pattern's already matched suffix. This typically enable us to test only a fraction of the text's characters, but has a worse performance than the straight-forward method for small patterns. Because of this, the BM algorithm will only be used if the pattern size is at least 4 characters. Notice that this pre-matching is done on the largest substring of the regular expression that _must_ be present on the text for a succesful match to be possible at all. For instance, "(xyzzy|grues)" will yield a null "must" substring, and, therefore, not benefit from the BM algorithm at all. Because of the lack of intelligence of the algorithm that finds the "must" string, things like "charjump|matchjump" will also yield a null string. To optimize that, "(char|match)jump" should be used. The setup time (at regcomp()) for the BM algorithm will most likely outweight any benefits for one-time matches. Given the slow regex(3) we have, this is unlikely to be even perceptible, though. The size of a regex_t structure is increased by 2*sizeof(char*) + 256*sizeof(int) + strlen(must)*sizeof(int). This is all inside the regex_t's "guts", which is allocated dynamically by regcomp(). If allocation of either of the two tables fail, the other one is freed. In this case, the straight-forward algorithm is used for pre-matching. Tests exercising the code path affected have shown a speed increase of 50% for "must" strings of length four or five. API and ABI remain unchanged by this commit. The patch submitted on the PR was not used, as it was non-functional. PR: 14342
* $Id$ -> $FreeBSD$peter1999-08-283-3/+3
|
* remove <ctype.h> - not neededache1999-07-261-1/+0
|
* unsigned char cleanupache1999-07-261-17/+17
| | | | | | | fix wrong index from p_simp_re() PR: 8790 Submitted by: Alexander Viro <viro@math.psu.edu> (partially)
OpenPOWER on IntegriCloud