Class TokenBuffer.Cursor
java.lang.Object
io.github.protasm.jvmud.compiler.token.TokenBuffer.Cursor
- Enclosing class:
TokenBuffer
Parser-facing reader over this buffer.
-
Method Summary
Modifier and TypeMethodDescriptionToken<?> advance()Advance by one; stays on EOF once past end.Token<?> advanceThrough(TokenType type) Consume repeated occurrences of a single type.booleanTrue if current token matches any of the given types (no consume).Token<?> Consume exactly one of the expected types or throw.Token<?> current()booleanisAtEnd()intmark()booleanIf current matches any type, consume and return true; else false.Token<?> peek(int k) Lookahead where peek(0)==current().intposition()Token<?> previous()voidrewind(int mark)
-
Method Details
-
position
public int position() -
isAtEnd
public boolean isAtEnd() -
mark
public int mark() -
rewind
public void rewind(int mark) -
peek
Lookahead where peek(0)==current(). Never throws; returns EOF past end. -
current
-
previous
-
advance
Advance by one; stays on EOF once past end. Returns the consumed token. -
check
True if current token matches any of the given types (no consume). -
match
If current matches any type, consume and return true; else false. -
consume
-
advanceThrough
-