Helper function to split string into groups based on regexp. Possibility to retrieve...
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / string / tokenizer / Tokenizer.java
index 6aa56b4..14554be 100755 (executable)
@@ -94,7 +94,7 @@ public class Tokenizer {
 
             if (currentIndex >= source.length()) { // reached end of input
                 if (hasAccumulatedToken(tokenAccumulator))
-                    return new TokenizerMatch(tokenAccumulator.toString(), null, null);
+                    return new TokenizerMatch(tokenAccumulator.toString(), null, null, this);
                 else
                     return null;
             }
@@ -108,7 +108,7 @@ public class Tokenizer {
 
             if (matchResult.terminator.termination == PRESERVE) {
                 if (hasAccumulatedToken(tokenAccumulator))
-                    return new TokenizerMatch(tokenAccumulator.toString(), null, null);
+                    return new TokenizerMatch(tokenAccumulator.toString(), null, null, this);
 
                 currentIndex = matchResult.matcher.end();
                 return matchResult;
@@ -116,7 +116,7 @@ public class Tokenizer {
                 currentIndex = matchResult.matcher.end();
 
                 if (hasAccumulatedToken(tokenAccumulator))
-                    return new TokenizerMatch(tokenAccumulator.toString(), null, null);
+                    return new TokenizerMatch(tokenAccumulator.toString(), null, null, this);
             }
         }
     }
@@ -127,7 +127,7 @@ public class Tokenizer {
                 Matcher match = terminator.match(source, currentIndex);
                 if (match.find()) {
                     String token = source.substring(match.start(), match.end());
-                    return new TokenizerMatch(token, terminator, match);
+                    return new TokenizerMatch(token, terminator, match, this);
                 }
             }
         return null;