use of priv.bajdcc.util.Position in project jMiniLang by bajdcc.
the class ManageScopeSymbol method getEntryToken.
@Override
public Token getEntryToken() {
Token token = new Token();
token.kToken = TokenType.ID;
token.object = getEntryName();
token.position = new Position();
return token;
}
use of priv.bajdcc.util.Position in project jMiniLang by bajdcc.
the class RegexStringIterator method snapshot.
@Override
public void snapshot() {
stkIndex.push(data.iIndex);
stkPosition.push(new Position(position.iColumn, position.iLine));
}
use of priv.bajdcc.util.Position in project jMiniLang by bajdcc.
the class RegexStringIterator method cover.
@Override
public void cover() {
stkIndex.set(stkIndex.size() - 1, data.iIndex);
stkPosition.set(stkPosition.size() - 1, new Position(position));
}
use of priv.bajdcc.util.Position in project jMiniLang by bajdcc.
the class RegexStringIterator method restore.
@Override
public void restore() {
data.iIndex = stkIndex.pop();
position = new Position(stkPosition.pop());
}
use of priv.bajdcc.util.Position in project jMiniLang by bajdcc.
the class TokenAlgorithm method accept.
@Override
public boolean accept(IRegexStringIterator iterator, Token token) {
if (!iterator.available()) {
token.kToken = TokenType.EOF;
return true;
}
token.position = new Position(iterator.position());
iterator.snapshot();
if (regex.match(iterator, this)) {
// 匹配成功
if (getToken(strMatch, token, iterator) != null) {
// 自动转换单词
iterator.discard();
return true;
}
}
iterator.restore();
return false;
}