ParseState
public final class ParseState<Token>
Represents the state of the parser. Stores the generator from which the subsequent symbols to parse are obtained.
-
Construct a
ParseStatefrom a forkable sequence. Provided as an optimization.Declaration
Swift
public convenience init<Sequence: SequenceType where Sequence.Generator: ForkableGeneratorType, Sequence.Generator.Element == Token>(_ sequence: Sequence) -
Returns the next token from the generator, otherwise throws a
ParseErrorif no more tokens are availible.Declaration
Swift
public func read() throws -> Token
-
Save the current
ParseStatefor later restoration.Declaration
Swift
@warn_unused_result public func checkpoint() -> ParseStateCheckpoint<Token> -
Restore the
ParseStateto what is was whencheckpointwas created.Declaration
Swift
public func restore(checkpoint: ParseStateCheckpoint<Token>)
ParseState Class Reference