Lines Matching +full:- +full:b
20 $this->assertFalse($regex->apply("Hello", $match));
21 $this->assertEquals($match, "");
25 $regex->addPattern(".*");
26 $this->assertTrue($regex->apply("", $match));
27 $this->assertEquals($match, "");
31 $regex->addPattern(".*");
32 $this->assertTrue($regex->apply("Hello", $match));
33 $this->assertEquals($match, "Hello");
37 $regex->addPattern("abc");
38 $this->assertTrue($regex->apply("abcdef", $match));
39 $this->assertEquals($match, "abc");
40 $this->assertTrue($regex->apply("AAABCabcdef", $match));
41 $this->assertEquals($match, "abc");
45 $regex->addPattern("abc");
46 $this->assertTrue($regex->apply("abcdef", $match));
47 $this->assertEquals($match, "abc");
48 $this->assertTrue($regex->apply("AAABCabcdef", $match));
49 $this->assertEquals($match, "ABC");
53 $regex->addPattern("abc");
54 $regex->addPattern("ABC");
55 $this->assertTrue($regex->apply("abcdef", $match));
56 $this->assertEquals($match, "abc");
57 $this->assertTrue($regex->apply("AAABCabcdef", $match));
58 $this->assertEquals($match, "ABC");
59 $this->assertFalse($regex->apply("Hello", $match));
63 $regex->addPattern("abc", "letter");
64 $regex->addPattern("123", "number");
65 $this->assertEquals($regex->apply("abcdef", $match), "letter");
66 $this->assertEquals($match, "abc");
67 $this->assertEquals($regex->apply("0123456789", $match), "number");
68 $this->assertEquals($match, "123");
72 $regex->addPattern("abc");
73 $regex->addPattern("ABC");
74 $regex->addPattern("a(?!\n).{1}");
75 $this->assertTrue($regex->apply("abcdef", $match));
76 $this->assertEquals($match, "abc");
77 $this->assertTrue($regex->apply("AAABCabcdef", $match));
78 $this->assertEquals($match, "ABC");
79 $this->assertTrue($regex->apply("a\nab", $match));
80 $this->assertEquals($match, "ab");
81 $this->assertFalse($regex->apply("Hello", $match));
85 $regex->addPattern("a(?i)b(?i)c");
86 $this->assertTrue($regex->apply("aBc", $match));
87 $this->assertEquals($match, "aBc");
91 $regex->addPattern("(?U)\w+");
92 $this->assertTrue($regex->apply("aaaaaa", $match));
93 $this->assertEquals($match, "a");
97 $regex->addPattern("\w(?=c)");
98 $this->assertTrue($regex->apply("xbyczd", $match));
99 $this->assertEquals($match, "y");
103 $regex->addPattern("\w(?!b|c)");
104 $this->assertTrue($regex->apply("xbyczd", $match));
105 $this->assertEquals($match, "b");
109 $regex->addPattern("(?<=c)\w");
110 $this->assertTrue($regex->apply("xbyczd", $match));
111 $this->assertEquals($match, "z");
115 $regex->addPattern("(?<!\A|x|b)\w");
116 $this->assertTrue($regex->apply("xbyczd", $match));
117 $this->assertEquals($match, "c");
125 $this->assertEquals($stack->getCurrent(), "one");
129 $this->assertFalse($stack->leave());
133 $stack->enter("two");
134 $this->assertEquals($stack->getCurrent(), "two");
135 $stack->enter("three");
136 $this->assertEquals($stack->getCurrent(), "three");
137 $this->assertTrue($stack->leave());
138 $this->assertEquals($stack->getCurrent(), "two");
139 $stack->enter("third");
140 $this->assertEquals($stack->getCurrent(), "third");
141 $this->assertTrue($stack->leave());
142 $this->assertTrue($stack->leave());
143 $this->assertEquals($stack->getCurrent(), "one");
154 function b() { function in TestParser
160 $handler = $this->createMock('TestParser');
161 $handler->expects($this->never())->method('accept');
163 $this->assertFalse($lexer->parse("abcdef"));
166 $handler = $this->createMock('TestParser');
167 $handler->expects($this->never())->method('accept');
169 $lexer->addPattern("a+");
170 $this->assertTrue($lexer->parse(""));
185 $handler = $this->createMock('TestParser');
187 ->expects($this->exactly($acceptArgumentCount))
188 ->method('accept')
189 ->withConsecutive(...$acceptArguments)
190 ->willReturnOnConsecutiveCalls(...array_fill(0, $acceptArgumentCount, true));
193 $lexer->addPattern("a+");
194 $this->assertTrue($lexer->parse("aaaxayyyaxaaaz"));
198 ["a", $this->anything(), 0],
199 ["b", $this->anything(), 1],
200 ["a", $this->anything(), 2],
201 ["bb", $this->anything(), 3],
202 ["x", $this->anything(), 5],
203 ["b", $this->anything(), 6],
204 ["a", $this->anything(), 7],
205 ["xxxxxx", $this->anything(), 8],
206 ["a", $this->anything(), 14],
207 ["x", $this->anything(), 15],
211 $handler = $this->createPartialMock('TestParser', ['accept']);
213 ->expects($this->exactly($acceptArgumentCount))
214 ->method('accept')
215 ->withConsecutive(...$acceptArguments)
216 ->willReturnOnConsecutiveCalls(...array_fill(0, $acceptArgumentCount, true));
219 $lexer->addPattern("a+");
220 $lexer->addPattern("b+");
221 $this->assertTrue($lexer->parse("ababbxbaxxxxxxax"));
229 ["b", DOKU_LEXER_UNMATCHED, 1],
239 $handler = $this->createMock('TestParser');
241 ->expects($this->exactly($aArgumentCount))
242 ->method('a')
243 ->withConsecutive(...$aArguments)
244 ->willReturnOnConsecutiveCalls(...array_fill(0, $aArgumentCount, true));
247 $lexer->addPattern("a+", "a");
248 $lexer->addPattern("b+", "b");
249 $this->assertTrue($lexer->parse("abaabxbaaaxaaaax"));
255 ["b", DOKU_LEXER_UNMATCHED, 1],
257 ["b", DOKU_LEXER_UNMATCHED, 4],
260 'b' => [
263 ["b", DOKU_LEXER_MATCHED, 10],
272 $handler = $this->createMock('TestParser');
276 ->expects($this->exactly($count))
277 ->method($method)
278 ->withConsecutive(...$arguments)
279 ->willReturnOnConsecutiveCalls(...array_fill(0, $count, true));
283 $lexer->addPattern("a+", "a");
284 $lexer->addEntryPattern(":", "a", "b");
285 $lexer->addPattern("b+", "b");
286 $this->assertTrue($lexer->parse("abaabaaa:ababbabbba"));
292 ["b", DOKU_LEXER_UNMATCHED, 2],
294 ["b", DOKU_LEXER_UNMATCHED, 5],
295 // some b calls in between here
297 ["b", DOKU_LEXER_UNMATCHED, 15],
299 'b' => [
308 $handler = $this->createMock('TestParser');
312 ->expects($this->exactly($count))
313 ->method($method)
314 ->withConsecutive(...$arguments)
315 ->willReturnOnConsecutiveCalls(...array_fill(0, $count, true));
319 $lexer->addPattern("a+", "a");
320 $lexer->addEntryPattern("(", "a", "b");
321 $lexer->addPattern("b+", "b");
322 $lexer->addExitPattern(")", "b");
323 $this->assertTrue($lexer->parse("aabaab(bbabb)aab"));
333 'b' => [
334 ["b", DOKU_LEXER_SPECIAL, 2],
339 $handler = $this->createMock('TestParser');
343 ->expects($this->exactly($count))
344 ->method($method)
345 ->withConsecutive(...$arguments)
346 ->willReturnOnConsecutiveCalls(...array_fill(0, $count, true));
350 $lexer->addPattern("a+", "a");
351 $lexer->addSpecialPattern("b+", "a", "b");
352 $this->assertTrue($lexer->parse("aabaaxxbbbxx"));
361 $handler = $this->createMock('TestParser');
363 ->expects($this->exactly($aArgumentCount))
364 ->method('a')
365 ->withConsecutive(...$aArguments)
366 ->willReturnOnConsecutiveCalls(...array_fill(0, $aArgumentCount, true));
369 $lexer->addPattern("a+", "a");
370 $lexer->addExitPattern(")", "a");
371 $this->assertFalse($lexer->parse("aa)aa"));
384 ["b", DOKU_LEXER_UNMATCHED, 9],
388 $handler = $this->createMock('TestParser');
390 ->expects($this->exactly($aArgumentCount))
391 ->method('a')
392 ->withConsecutive(...$aArguments)
393 ->willReturnOnConsecutiveCalls(...array_fill(0, $aArgumentCount, true));
396 $lexer->addPattern("a+", "mode_a");
397 $lexer->addEntryPattern("(", "mode_a", "mode_b");
398 $lexer->addPattern("b+", "mode_b");
399 $lexer->addExitPattern(")", "mode_b");
400 $lexer->mapHandler("mode_a", "a");
401 $lexer->mapHandler("mode_b", "a");
402 $this->assertTrue($lexer->parse("aa(bbabb)b"));
422 ["b", DOKU_LEXER_SPECIAL, strpos($doc, 'b')],
429 $handler = $this->createMock('TestParserByteIndex');
430 $handler->expects($this->any())->method('ignore')->will($this->returnValue(true));
432 ->expects($this->exactly($caughtArgumentCount))
433 ->method('caught')
434 ->withConsecutive(...$caughtArguments)
435 ->willReturnOnConsecutiveCalls(...array_fill(0, $caughtArgumentCount, true));
438 $lexer->addEntryPattern("<file>", "ignore", "caught");
439 $lexer->addExitPattern("</file>", "caught");
440 $lexer->addSpecialPattern('b','caught','special');
441 $lexer->mapHandler('special','caught');
442 $lexer->addPattern('c','caught');
444 $this->assertTrue($lexer->parse($doc));
452 ["b", DOKU_LEXER_SPECIAL, strpos($doc, 'b')],
459 $handler = $this->createMock('TestParserByteIndex');
460 $handler->expects($this->any())->method('ignore')->will($this->returnValue(true));
462 ->expects($this->exactly($caughtArgumentCount))
463 ->method('caught')
464 ->withConsecutive(...$caughtArguments)
465 ->willReturnOnConsecutiveCalls(...array_fill(0, $caughtArgumentCount, true));
468 $lexer->addEntryPattern('<file>(?=.*</file>)', "ignore", "caught");
469 $lexer->addExitPattern("</file>", "caught");
470 $lexer->addSpecialPattern('b','caught','special');
471 $lexer->mapHandler('special','caught');
472 $lexer->addPattern('c','caught');
474 $this->assertTrue($lexer->parse($doc));
482 ["b", DOKU_LEXER_SPECIAL, strpos($doc, 'b')],
489 $handler = $this->createMock('TestParserByteIndex');
490 $handler->expects($this->any())->method('ignore')->will($this->returnValue(true));
492 ->expects($this->exactly($caughtArgumentCount))
493 ->method('caught')
494 ->withConsecutive(...$caughtArguments)
495 ->willReturnOnConsecutiveCalls(...array_fill(0, $caughtArgumentCount, true));
498 $lexer->addEntryPattern('<file>(?!foo)', "ignore", "caught");
499 $lexer->addExitPattern("</file>", "caught");
500 $lexer->addSpecialPattern('b','caught','special');
501 $lexer->mapHandler('special','caught');
502 $lexer->addPattern('c','caught');
504 $this->assertTrue($lexer->parse($doc));
512 ["b", DOKU_LEXER_SPECIAL, strpos($doc, 'b')],
519 $handler = $this->createMock('TestParserByteIndex');
520 $handler->expects($this->any())->method('ignore')->will($this->returnValue(true));
522 ->expects($this->exactly($caughtArgumentCount))
523 ->method('caught')
524 ->withConsecutive(...$caughtArguments)
525 ->willReturnOnConsecutiveCalls(...array_fill(0, $caughtArgumentCount, true));
528 $lexer->addEntryPattern('<file>', "ignore", "caught");
529 $lexer->addExitPattern("(?<=d)</file>", "caught");
530 $lexer->addSpecialPattern('b','caught','special');
531 $lexer->mapHandler('special','caught');
532 $lexer->addPattern('c','caught');
534 $this->assertTrue($lexer->parse($doc));
542 ["b", DOKU_LEXER_SPECIAL, strpos($doc, 'b')],
549 $handler = $this->createMock('TestParserByteIndex');
550 $handler->expects($this->any())->method('ignore')->will($this->returnValue(true));
552 ->expects($this->exactly($caughtArgumentCount))
553 ->method('caught')
554 ->withConsecutive(...$caughtArguments)
555 ->willReturnOnConsecutiveCalls(...array_fill(0, $caughtArgumentCount, true));
558 $lexer->addEntryPattern('<file>', 'ignore', 'caught');
559 $lexer->addExitPattern('(?<!c)</file>', 'caught');
560 $lexer->addSpecialPattern('b','caught','special');
561 $lexer->mapHandler('special','caught');
562 $lexer->addPattern('c','caught');
564 $this->assertTrue($lexer->parse($doc));
569 * when there are non-captured elements in the pattern.
573 $pattern = '\bFOO\b';
575 $handler = $this->createMock('TestParserByteIndex');
576 $handler->expects($this->any())->method('ignore')->will($this->returnValue(true));
581 $handler->expects($this->once())->method('caught')
582 ->with("FOO", DOKU_LEXER_SPECIAL, $matches[0][1])->will($this->returnValue(true));
585 $lexer->addSpecialPattern($pattern,'ignore','caught');
587 $this->assertTrue($lexer->parse($doc));