State

case class State[Token](input: IndexedSeq[Token], offset: Int, pos: Position)(implicit evidence$1: SourceMap[Token])

State of a parser.

A parser works with:

  • an array of tokens to explore (typically the characters that compose a string).
  • an offset in that array that represents how far we've parsed already.
  • the position of the last parsed token.

TODO: before writing documentation, we need to keep track of a token's START and END position. It makes things far easier to explain. With chars, a token's start position is always the previous token's end position. With more complex tokens, this might not hold - think of space-separated ints: "1 2". You cannot guess the start position of '2' just from '1': this doesn't tell you how many spaces there are before the next token starts.

Companion:
object
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def consume(parsed: Token): State[Token]
def consumeRep(parsed: Seq[Token]): State[Token]
def isEOF: Boolean
def startsAt(parsed: Token): Position

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product