Class CharCursor

java.lang.Object
io.github.protasm.jvmud.compiler.sourcepos.CharCursor

public final class CharCursor extends Object
Stateless text + stateful index; safe peeking; maintains line/column via LineMap.
  • Constructor Details

    • CharCursor

      public CharCursor(LineMap map)
  • Method Details

    • index

      public int index()
    • end

      public boolean end()
    • peek

      public char peek()
    • peekNext

      public char peekNext()
    • sourceLength

      public int sourceLength()
    • canPeekNext

      public boolean canPeekNext()
    • advance

      public char advance()
      Advance one char and return it.
    • advanceWhile

      public int advanceWhile(IntPredicate pred)
      Advance while predicate holds; returns chars consumed.
    • rewind

      public void rewind(int to)
    • pos

      public SourcePos pos()
      Current 1-based source position.
    • spanFrom

      public SourceSpan spanFrom(int startOffset, int endOffset)
    • fileName

      public String fileName()
      Helper/convenience methods.
    • line

      public int line()
    • column

      public int column()
    • map

      public LineMap map()