Escape question marks
This commit is contained in:
parent
f139f3218e
commit
b725a608da
|
@ -84,6 +84,7 @@ put_reg(char r)
|
||||||
case 't': putc(0x09, stdout); break;
|
case 't': putc(0x09, stdout); break;
|
||||||
case 'n': putc(0x0a, stdout); break;
|
case 'n': putc(0x0a, stdout); break;
|
||||||
case 's': putc(0x20, stdout); break;
|
case 's': putc(0x20, stdout); break;
|
||||||
|
case '?': putc(0x3f, stdout); break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
putc(c, stdout);
|
putc(c, stdout);
|
||||||
|
@ -103,7 +104,7 @@ match_rule(Rule *r, char *p)
|
||||||
rmin = 0xff, rmax = 0x00;
|
rmin = 0xff, rmax = 0x00;
|
||||||
}
|
}
|
||||||
while((c = *a)) {
|
while((c = *a)) {
|
||||||
if(spacer(last) && c == '?') {
|
if(c == '?' && last != '\\') {
|
||||||
if(!set_reg(*(++a), b)) return NULL;
|
if(!set_reg(*(++a), b)) return NULL;
|
||||||
a++, b = walk(b);
|
a++, b = walk(b);
|
||||||
continue;
|
continue;
|
||||||
|
@ -137,7 +138,7 @@ write_rule(Rule *r, char last, char *res)
|
||||||
{
|
{
|
||||||
char c, *b = r->b, *origin = dst_;
|
char c, *b = r->b, *origin = dst_;
|
||||||
while((c = *b++))
|
while((c = *b++))
|
||||||
if(spacer(last) && c == '?' && regs[(int)*b])
|
if(c == '?' && last != '\\' && regs[(int)*b])
|
||||||
put_reg(*b++);
|
put_reg(*b++);
|
||||||
else
|
else
|
||||||
*dst_++ = c, last = c;
|
*dst_++ = c, last = c;
|
||||||
|
|
Loading…
Reference in New Issue