mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 07:20:09 -08:00
Fix bug causing the last character not to be matched.
This commit is contained in:
parent
c86e192d2e
commit
42db6b3c2f
|
@ -6,7 +6,6 @@ import org.nwapw.abacus.lexing.pattern.Pattern;
|
|||
import org.nwapw.abacus.lexing.pattern.PatternNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
|
||||
|
@ -31,10 +30,9 @@ public class Lexer<T> {
|
|||
for(Pattern<T> pattern : patterns){
|
||||
pattern.getHead().addInto(currentSet);
|
||||
}
|
||||
while(!currentSet.isEmpty() && index < from.length()){
|
||||
char currentChar = from.charAt(index);
|
||||
while(!currentSet.isEmpty()){
|
||||
for(PatternNode<T> node : currentSet){
|
||||
if(node.matches(currentChar)) {
|
||||
if(index < from.length() && node.matches(from.charAt(index))) {
|
||||
node.addOutputsInto(futureSet);
|
||||
} else if(node instanceof EndNode){
|
||||
matches.add(new Match<>(startAt, index, ((EndNode<T>) node).getPatternId()));
|
||||
|
|
Loading…
Reference in New Issue
Block a user