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

Parsley.Internal.Backend.Machine.Types.Coins

Description

This module exposes Coins and the relevant operations. These are used by constant input analysis to side-step unnecessary length checks and character reads (in the case of lookahead).

Since: 1.5.0.0

Synopsis

Documentation

data Coins Source #

Packages together the known input that can be consumed after a length-check with the number of characters that can be rewound on a lookahead backtrack.

Since: 1.5.0.0

Constructors

Coins 

Fields

  • willConsume :: Int

    The number of tokens we know must be consumed along the path to succeed.

  • canReclaim :: Int

    The number of tokens we can reclaim if the parser backtracks.

Instances

Instances details
Show Coins Source # 
Instance details

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

Methods

showsPrec :: Int -> Coins -> ShowS #

show :: Coins -> String #

showList :: [Coins] -> ShowS #

int :: Int -> Coins Source #

Makes a Coins value with equal quantities of coins and characters.

Since: 1.5.0.0

zero :: Coins Source #

Makes a Coins value of 0.

Since: 1.5.0.0

minCoins :: Coins -> Coins -> Coins Source #

Takes the pairwise min of two Coins values.

Since: 1.5.0.0

maxCoins :: Coins -> Coins -> Coins Source #

Takes the pairwise max of two Coins values.

Since: 1.5.0.0

plus1 :: Coins -> Coins Source #

Adds 1 to all the Coins values.

Since: 1.5.0.0

plus :: Coins -> Coins -> Coins Source #

Performs the pairwise addition of two Coins values.

Since: 1.5.0.0

minus :: Coins -> Coins -> Coins Source #

Performs the pairwise subtraction of two Coins values.

Since: 1.5.0.0

plusNotReclaim :: Coins -> Int -> Coins Source #

A verson of plus where the reclaim value remains constant.

Since: 1.5.0.0