use of de.be4.classicalb.core.preparser.node.TRhsBody in project probparsers by bendisposto.
the class PreLexer method collectRhs.
private void collectRhs() throws LexerException, IOException {
if (state.equals(State.DEFINITIONS_RHS) || (previousState != null && previousState.equals(State.DEFINITIONS_RHS))) {
if (rhsToken == null) {
// starting a new definition rhs
rhsToken = new TRhsBody("", -1, -1);
rhsBuffer = new StringBuilder();
} else {
final State nextState = getNextState();
// end of rhs reached?
if (nextState != null) {
// push current token back into reader
try {
unread(token);
} catch (IOException e) {
throw new IOException("Pushback buffer overflow on Token: " + token.getText());
}
// prepare rhs_body token to be the current one
((Token) rhsToken).setText(rhsBuffer.toString());
token = rhsToken;
rhsToken = null;
rhsBuffer = null;
state = nextState;
} else {
// first token after "==" sets start position
if (rhsToken.getLine() == -1) {
rhsToken.setLine(token.getLine());
rhsToken.setPos(token.getPos());
}
rhsBuffer.append(token.getText());
token = null;
}
}
}
}
Aggregations