parsley-core-1.6.0.0: A fast parser combinator library backed by Typed Template Haskell
LicenseBSD-3-Clause
MaintainerJamie Willis
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Parsley.Internal.Backend.Machine.Types.Offset

Description

This module contains the statically refined Offset type, which can be used to reason about input in different parts of a parser as it is evaluated.

Since: 1.4.0.0

Synopsis

Documentation

data Offset o Source #

Augments a regular Code (Rep o) with information about its origins and how much input is known to have been consumed since it came into existence. This can be used to statically evaluate handlers (see staHandlerEval).

Since: 1.5.0.0

Instances

Instances details
Show (Offset o) Source # 
Instance details

Defined in Parsley.Internal.Backend.Machine.Types.Offset

Methods

showsPrec :: Int -> Offset o -> ShowS #

show :: Offset o -> String #

showList :: [Offset o] -> ShowS #

mkOffset :: Code (Rep o) -> Word -> Offset o Source #

Makes a fresh Offset that has not had any input consumed off of it yet.

Since: 1.4.0.0

offset :: Offset o -> Code (Rep o) Source #

The underlying code that represents the current offset into the input.

moveOne :: Offset o -> Code (Rep o) -> Offset o Source #

Updates an Offset with its new underlying representation of a real runtime offset and records that another character has been consumed.

Since: 1.4.0.0

moveN :: Maybe Word -> Offset o -> Code (Rep o) -> Offset o Source #

Updates an Offset with its new underlying representation of a real runtime offset and records that several more characters have been consumed. Here, Nothing represents an unknown but non-zero amount of characters.

Since: 1.5.0.0

same :: Offset o -> Offset o -> Maybe Bool Source #

Given two Offsets, this determines whether or not they represent the same offset into the input stream at runtime. This comparison only makes sense when both Offsets share the same origin, hence the Maybe.

Since: 1.4.0.0