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

Parsley.Internal.Backend.Machine.PosOps

Description

This module contains the implementations of updates on positions: these depend on the number of bits in a word, or if the full-width-positions flag was set on the parsley-core library.

Since: 1.8.0.0

Synopsis

Documentation

initPos :: (Word, Word) Source #

The initial position used by the parser. This is some representation of (1, 1).

Since: 1.8.0.0

tabWidth :: Num a => a Source #

The size of a tab.

Since: 2.1.0.0

extractLine :: Code Pos -> Code Int Source #

Given the opaque representation of a position, extracts the line number out of it.

Since: 1.8.0.0

extractCol :: Code Pos -> Code Int Source #

Given the opaque representation of a position, extracts the column number out of it.

Since: 1.8.0.0

liftPos :: Word -> Word -> Code Pos Source #

Converts a static position into a dynamic one.

Since: 2.1.0.0

updatePos :: Code Char -> Word -> Word -> Code Pos Source #

Given a dynamic character and a static position, produces a new dynamic position.

Since: 2.1.0.0

updatePosQ :: Code Char -> Code Pos -> Code Pos Source #

Given a dynamic character and a dynamic position, returns the representation of the updated position.

Since: 2.1.0.0

updatePosNewlineOnly :: Code Char -> Word -> Code Pos Source #

Given a dynamic character and a static position, produces a new dynamic position. For this variant, newlines are the only character than can affect the update.

Since: 2.1.0.0

updatePosNewlineOnlyQ :: Code Char -> Code Pos -> Code Pos Source #

Given a dynamic character and a dynamic position, returns the representation of the updated position. For this variant, newlines are the only character than can affect the update.

Since: 2.1.0.0

shiftLineAndSetCol Source #

Arguments

:: Word

The amount to shift the line by

-> Word

The new column

-> Word

The line

-> (Word, Word) 

Shift a static line by a given amount and then set the column

Since: 2.1.0.0

shiftCol Source #

Arguments

:: Word

The amount to shift the column by

-> Word

The line

-> Word

The column

-> (Word, Word) 

Shift a static postion's column by a given amount

Since: 2.1.0.0

shiftAlignAndShiftCol Source #

Arguments

:: Word

Amount to shift column by before the tab shift

-> Word

Amount to shift column by after the tab shift

-> Word

The line

-> Word

The new column

-> (Word, Word) 

Shift a static position by first adjusting the column, then aligning to a tab, then shifting further

Since: 2.1.0.0

shiftLineAndSetColQ Source #

Arguments

:: Word

The amount to shift the line by

-> Word

The new column

-> Code Pos 
-> Code Pos 

Shift a dynamic line by a given amount and then set the column

Since: 2.1.0.0

shiftColQ Source #

Arguments

:: Word

The amount to shift the column by

-> Code Pos 
-> Code Pos 

Shift a dynamic postion's column by a given amount

Since: 2.1.0.0

shiftAlignAndShiftColQ Source #

Arguments

:: Word

Amount to shift column by before the tab shift

-> Word

Amount to shift column by after the tab shift

-> Code Pos 
-> Code Pos 

Shift a dynamic position by first adjusting the column, then aligning to a tab, then shifting further

Since: 2.1.0.0

toNextTab :: Word -> Word Source #

Advances a column to the next tab column.

Since: 2.1.0.0