struct Pars::ParseContext

Overview

A struct containing information about a parsing context. Used to chain Parsers together and retain input position.

Defined in:

pars/parse_context.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(input : Slice(UInt8) | String, pos : Int32 = 0) #

[View source]

Instance Method Detail

def byte : UInt8 #

Provides the parse head as a byte.


[View source]
def char : Char #

Provides the parse head as a Char.


[View source]
def exhausted? : Bool #

true if all of the input has been consumed.


[View source]
def head : Char | UInt8 #

Provide the current parse head directly.


[View source]
def input : String | Bytes #

The input the parser is working across.


[View source]
def next(offset = 1) : ParseContext #

Creates a new context at the next parse position.


[View source]
def pos : Int32 #

The correct parse offset within input.


[View source]
def to_s(io : IO) #

Provide a human readable verison of the conntext parse context.


[View source]