1 --- engine.c.bsdnew 2009-11-11 11:29:04.000000000 -0800
2 +++ engine.c 2009-11-11 11:30:28.000000000 -0800
3 @@ -272,7 +272,7 @@ matcher(struct re_guts *g,
5 assert(m->coldp < m->endp);
6 m->coldp += XMBRTOWC(NULL, m->coldp,
7 - m->endp - m->coldp, &m->mbs, 0);
8 + m->endp - m->coldp, &m->mbs, 0, g->loc);
10 if (nmatch == 1 && !g->backrefs)
11 break; /* no further info needed */
12 @@ -333,7 +333,7 @@ matcher(struct re_guts *g,
14 /* recycle starting later */
15 start = m->coldp + XMBRTOWC(NULL, m->coldp,
16 - stop - m->coldp, &m->mbs, 0);
17 + stop - m->coldp, &m->mbs, 0, g->loc);
18 assert(start <= stop);
21 @@ -410,7 +410,7 @@ dissect(struct match *m,
25 - sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0);
26 + sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0, m->g->loc);
30 @@ -419,7 +419,7 @@ dissect(struct match *m,
34 - sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0);
35 + sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0, m->g->loc);
39 @@ -480,6 +480,10 @@ dissect(struct match *m,
43 + else if (tail==rest) {
44 + /* Fix for test expr 105 */
47 assert(sep == rest); /* must exhaust substring */
48 assert(slow(m, ssp, sep, ssub, esub) == rest);
49 dp = dissect(m, ssp, sep, ssub, esub);
50 @@ -532,6 +536,14 @@ dissect(struct match *m,
51 i = OPND(m->g->strip[ss]);
52 assert(0 < i && i <= m->g->nsub);
53 m->pmatch[i].rm_so = sp - m->offp;
54 + /* fix for T.regcomp 43: don't remember previous
55 + subexpression matches beyond the current one (i) */
57 + while (i<= m->g->nsub) {
58 + m->pmatch[i].rm_so = -1;
59 + m->pmatch[i].rm_eo = -1;
64 i = OPND(m->g->strip[ss]);
65 @@ -586,14 +598,14 @@ backref(struct match *m,
69 - sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
70 + sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
77 - sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
78 + sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
82 @@ -601,8 +613,8 @@ backref(struct match *m,
85 cs = &m->g->sets[OPND(s)];
86 - sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
87 - if (wc == BADCHAR || !CHIN(cs, wc))
88 + sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
89 + if (wc == BADCHAR || !CHIN(cs, wc, m->g->loc))
93 @@ -626,8 +638,8 @@ backref(struct match *m,
94 (sp < m->endp && *(sp-1) == '\n' &&
95 (m->g->cflags®_NEWLINE)) ||
97 - !ISWORD(*(sp-1))) ) &&
98 - (sp < m->endp && ISWORD(*sp)) )
99 + !ISWORD(*(sp-1), m->g->loc)) ) &&
100 + (sp < m->endp && ISWORD(*sp, m->g->loc)) )
104 @@ -636,8 +648,8 @@ backref(struct match *m,
105 if (( (sp == m->endp && !(m->eflags®_NOTEOL)) ||
106 (sp < m->endp && *sp == '\n' &&
107 (m->g->cflags®_NEWLINE)) ||
108 - (sp < m->endp && !ISWORD(*sp)) ) &&
109 - (sp > m->beginp && ISWORD(*(sp-1))) )
110 + (sp < m->endp && !ISWORD(*sp, m->g->loc)) ) &&
111 + (sp > m->beginp && ISWORD(*(sp-1), m->g->loc)) )
115 @@ -811,7 +823,7 @@ fast( struct match *m,
119 - clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR);
120 + clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR, m->g->loc);
124 @@ -835,12 +847,12 @@ fast( struct match *m,
127 /* how about a word boundary? */
128 - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
129 - (c != OUT && ISWORD(c)) ) {
130 + if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc, m->g->loc))) &&
131 + (c != OUT && ISWORD(c, m->g->loc)) ) {
134 - if ( (lastc != OUT && ISWORD(lastc)) &&
135 - (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
136 + if ( (lastc != OUT && ISWORD(lastc, m->g->loc)) &&
137 + (flagch == EOL || (c != OUT && !ISWORD(c, m->g->loc))) ) {
140 if (flagch == BOW || flagch == EOW) {
141 @@ -865,7 +877,7 @@ fast( struct match *m,
142 assert(coldp != NULL);
144 if (ISSET(st, stopst))
145 - return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0));
146 + return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0, m->g->loc));
150 @@ -916,7 +928,7 @@ slow( struct match *m,
154 - clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR);
155 + clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR, m->g->loc);
157 /* is there an EOL and/or BOL between lastc and c? */
159 @@ -938,12 +950,12 @@ slow( struct match *m,
162 /* how about a word boundary? */
163 - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
164 - (c != OUT && ISWORD(c)) ) {
165 + if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc, m->g->loc))) &&
166 + (c != OUT && ISWORD(c, m->g->loc)) ) {
169 - if ( (lastc != OUT && ISWORD(lastc)) &&
170 - (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
171 + if ( (lastc != OUT && ISWORD(lastc, m->g->loc)) &&
172 + (flagch == EOL || (c != OUT && !ISWORD(c, m->g->loc))) ) {
175 if (flagch == BOW || flagch == EOW) {
176 @@ -1033,7 +1045,7 @@ step(struct re_guts *g,
179 cs = &g->sets[OPND(s)];
180 - if (!NONCHAR(ch) && CHIN(cs, ch))
181 + if (!NONCHAR(ch) && CHIN(cs, ch, g->loc))
184 case OBACK_: /* ignored here */