Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2d96c35

Browse files
committed
add more tests; allow \< escape out
1 parent91e630a commit2d96c35

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

‎pike.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode)
203203
re++;
204204
if (!*re) gotosyntax_error;// Trailing backslash
205205
if (*re=='<'||*re=='>') {
206+
if (re-*re_loc>2&&re[-2]=='\\')
207+
break;
206208
EMIT(PC++,*re=='<' ?WBEG :WEND);
207209
prog->len++;
208210
term=PC;

‎test.sh‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,20 @@ aaaaa(aa)aa(aa(a)a)?aa
140140
(a(a)a|(a)|a(aa)|aa){2,5}
141141
((a)a|a(aa)|(aaaa)|(a*)){3,10}
142142
((a)a|a(aa)|(aaaa)|(a+)){3,10}
143+
(aa(aa){3}|(a)a+(a)|a){3,4}
144+
((ax)+b(ax)*)*
145+
(a*)(b?)(b+)b{3}
146+
(a*){2,3}
147+
(a|at|ate|aten)(ten|en|n|d)
148+
(a|aa|aaa|aaaaa)(aa|aaaa|aaa)
149+
(a|a.|a..|a....)(a.|a...|a..)
150+
(a*b|b*a)(a*b|b*a)
151+
(ab|((ab)c|abc))c*
152+
((a*b*c*)|(a*c*b*))*
153+
.*|.*(a|b)?
154+
((.a|.ab)(bc.|c.)|abc.)
155+
\\\\\\\\<
156+
\\\\\\\\\\\\\\\\<
143157
"
144158
input="\
145159
abcdef
@@ -281,6 +295,20 @@ aaaaaaaaaa
281295
aaaaaaaaaaaaaa
282296
aaaaaaaaaaaaaaaaa
283297
aaaaaaaaaaaaaaaaa
298+
aaaaaaaaaaaaaaa
299+
axbaxaxbaxaxaxbaxaxaxax
300+
aaabbbbbbb
301+
aaaaaaaaaaaaaaaaa
302+
atend
303+
aaaaaa
304+
aaaaaa
305+
bbaa
306+
abc
307+
abcacb
308+
aa
309+
xabcx
310+
\\<
311+
\\\\\\\\<
284312
"
285313
expect="\
286314
(0,3)
@@ -422,6 +450,20 @@ expect="\
422450
(0,13)(12,13)(10,11)(12,13)(?,?)
423451
(0,17)(17,17)(14,15)(?,?)(?,?)(17,17)
424452
(0,17)(16,17)(14,15)(?,?)(?,?)(16,17)
453+
(0,15)(14,15)(6,8)(8,9)(13,14)
454+
(0,7)(0,7)(0,2)(5,7)
455+
(0,10)(0,3)(3,4)(4,7)
456+
(0,17)(17,17)
457+
(0,4)(0,1)(1,4)
458+
(0,3)(0,1)(1,3)
459+
(0,3)(0,1)(1,3)
460+
(0,2)(0,1)(1,2)
461+
(0,3)(0,2)(?,?)(?,?)
462+
(0,6)(5,6)(5,6)(?,?)
463+
(0,2)(?,?)
464+
(0,5)(0,5)(0,2)(2,5)
465+
(0,2)
466+
(2,5)
425467
(0,0)
426468
"
427469

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp