<modelVersion>4.0.0</modelVersion>
<groupId>eu.svjatoslav</groupId>
<artifactId>svjatoslavcommons</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.7-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Svjatoslav Commons</name>
<description>Collection many small but commonly useful functionalities</description>
final Stack<Integer> tokenIndexes = new Stack<>();
private final List<Terminator> terminators = new ArrayList<>();
- private final String source;
+ private String source;
private int currentIndex = 0;
public Tokenizer(final String source) {
this.source = source;
}
- public void addTerminator(final String startSequence,
- final boolean ignoreTerminator) {
+ public Tokenizer(){}
+
+ public Tokenizer setSource(String source){
+ this.source = source;
+ currentIndex = 0;
+ return this;
+ }
+
+ public Tokenizer addTerminator(final String startSequence,
+ final boolean ignoreTerminator) {
terminators.add(new Terminator(startSequence, ignoreTerminator));
+ return this;
}
- public void addTerminator(final String startSequence,
- final String endSequence, final boolean ignoreTerminator) {
+ public Tokenizer addTerminator(final String startSequence,
+ final String endSequence, final boolean ignoreTerminator) {
terminators.add(new Terminator(startSequence, endSequence,
ignoreTerminator));
+ return this;
}
public void expectNextToken(final String value)
}
- public boolean probeNextToken(final String token) {
+ public boolean isNextToken(final String token) {
if (token.equals(getNextToken().token))
return true;