rzel / mini-java

Automatically exported from code.google.com/p/mini-java
0 stars 0 forks source link

Add Matchers #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Matchers will be used as the "input" for the DFA compiled from the regular
expression. Instead of using DFA.getState() directly, the regex.match()
first iterates through all possible inputs, convert them to Matchers and
calls "match()" on the actual character input. If match() returns true,
then regex passes the Matcher as the input to the DFA.getState() method.

NOTE: don't be confused with the regex.match() itself, which takes a string
as input.

Original issue reported on code.google.com by lemontree.cool on 2 Oct 2008 at 3:44

GoogleCodeExporter commented 9 years ago
Matcher is not a valid solution. Consider the following regex: (\dA)|0. If we 
use
Matchers then the result DFA is no longer a DFA.

Original comment by lemontree.cool on 2 Oct 2008 at 9:26

GoogleCodeExporter commented 9 years ago
What about make the RegexTokenizer expand the specail characters into 
alternatives?
like: \d --> (0|1|2|3...8|9). But there would be a performance impact for this 
solution.

Original comment by lemontree.cool on 2 Oct 2008 at 9:33

GoogleCodeExporter commented 9 years ago

Original comment by lemontree.cool on 3 Oct 2008 at 4:07