summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp_parse/Lookahead.js
blob: 96fc20fe9f35bdaedc23c62034a3a3c8c6a3b20c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if (typeof parseRegExp === 'undefined')
    quit();

load(libdir + "regexp_parse.js");

test_mix("(?=abc)", all_flags,
         Lookahead(Atom("abc")));

test_mix("(?!abc)", all_flags,
         NegativeLookahead(Atom("abc")));

test_mix("(?=abc)+", no_unicode_flags,
         Lookahead(Atom("abc")));

// Lookahead becomes Empty because max_match of Lookahead is 0 and the min vaue
// of Quantifier is also 0.
test("(?=abc)*", no_unicode_flags,
     Empty());
test("X(?=abc)*Y", no_unicode_flags,
     Alternative([
         Atom("X"),
         Atom("Y"),
     ]));

test("(?=abc)?", no_unicode_flags,
     Empty());
test("X(?=abc)?Y", no_unicode_flags,
     Alternative([
         Atom("X"),
         Atom("Y"),
     ]));