aboutsummaryrefslogtreecommitdiff
path: root/jimregexp.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-11-27 21:38:39 +1000
committerSteve Bennett <steveb@workware.net.au>2010-11-28 23:06:20 +1000
commit6c6a315bb5d422df3764d4bf508dc741ee4742bc (patch)
tree0289ce23afbde1f3e7544ab42b8957897dab544d /jimregexp.c
parent60dfb023c4afa95047e0fa8db49830ccb46446b2 (diff)
downloadjimtcl-6c6a315bb5d422df3764d4bf508dc741ee4742bc.zip
jimtcl-6c6a315bb5d422df3764d4bf508dc741ee4742bc.tar.gz
jimtcl-6c6a315bb5d422df3764d4bf508dc741ee4742bc.tar.bz2
Bug fix: regexp should not treat \n as |
Remove a "feature" in the built-in regexp, where a newline in the pattern was treated as alternation, like |. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jimregexp.c')
-rw-r--r--jimregexp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/jimregexp.c b/jimregexp.c
index 66a1ba3..6c4e7bc 100644
--- a/jimregexp.c
+++ b/jimregexp.c
@@ -43,7 +43,7 @@
* on 16 October 2010, to remove static state and add better Tcl ARE compatibility.
* This includes counted repetitions, UTF-8 support, character classes,
* shorthand character classes, increased number of parentheses to 100,
- * backslash escape sequences.
+ * backslash escape sequences. It also removes \n as an alternative to |.
*
* Beware that some of this code is subtly aware of the way operator
* precedence is structured in regular expressions. Serious changes in
@@ -342,7 +342,7 @@ static int *reg(regex_t *preg, int paren /* Parenthesized? */, int *flagp )
if (!(flags&HASWIDTH))
*flagp &= ~HASWIDTH;
*flagp |= flags&SPSTART;
- while (*preg->regparse == '|' || *preg->regparse == '\n') {
+ while (*preg->regparse == '|') {
preg->regparse++;
br = regbranch(preg, &flags);
if (br == NULL)
@@ -395,7 +395,7 @@ static int *regbranch(regex_t *preg, int *flagp )
ret = regnode(preg, BRANCH);
chain = NULL;
while (*preg->regparse != '\0' && *preg->regparse != ')' &&
- *preg->regparse != '\n' && *preg->regparse != '|') {
+ *preg->regparse != '|') {
latest = regpiece(preg, &flags);
if (latest == NULL)
return(NULL);
@@ -852,7 +852,6 @@ static int *regatom(regex_t *preg, int *flagp)
break;
case '\0':
case '|':
- case '\n':
case ')':
preg->err = REG_ERR_INTERNAL;
return NULL; /* Supposed to be caught earlier. */