corda/test/regex
Johannes Schindelin 62d1964779 Regex: add a method to reverse the PikeVM program
A program for the PikeVM corresponds to a regular expression pattern. The
program matches the character sequence in left-to-right order. However,
for look-behind expressions, we will want to match the character sequence
backwards.

To this end, it is nice that regular expression patterns can be reversed
in a straight-forward manner. However, it would be nice if we could avoid
multiple parsing passes and simply parse even look-behind expressions as
if they were look-ahead ones, and then simply reverse the program for that
part.

Happily, it is not difficult to reverse the program so it is equivalent to
matching the pattern backwards.

There is one catch, though. Imagine matching the sequence "a" against the
regular expression "(a?)a?". If we match forward, the group will match the
letter "a", when matching backwards, it will match the empty string. So,
while the reverse pattern is equivalent to the forward pattern in terms of
"does the pattern match that sequence", but not its sub-matches. For that
reason, Java simply ignores capturing groups in look-behind patterns (and
for consistency, the same holds for look-ahead patterns).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
..
CharacterMatcher.java Regex: add a class for matching character classes 2013-12-03 12:28:10 -06:00
Compiler.java Regex: support lookaheads 2013-12-03 12:28:11 -06:00
Matcher.java Prepare the Matcher class for multiple groups 2013-12-03 12:28:10 -06:00
Pattern.java Regex: Implement reluctant '?', '*' and '+' 2013-12-03 12:28:11 -06:00
PikeVM.java Regex: add a method to reverse the PikeVM program 2013-12-03 12:28:11 -06:00
PikeVMOpcodes.java Regex: add a method to reverse the PikeVM program 2013-12-03 12:28:11 -06:00
RegexMatcher.java Regex: implement find() 2013-12-03 12:28:11 -06:00
RegexPattern.java Implement Pattern / Matcher classes based on the PikeVM 2013-12-03 12:28:10 -06:00
TrivialMatcher.java Refactor Pattern / Matcher classes 2013-12-03 12:28:10 -06:00
TrivialPattern.java Regex compiler: fall back to TrivialPattern when possible 2013-12-03 12:28:10 -06:00