License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- initPos :: (Word, Word)
- tabWidth :: Num a => a
- extractLine :: Code Pos -> Code Int
- extractCol :: Code Pos -> Code Int
- liftPos :: Word -> Word -> Code Pos
- updatePos :: Code Char -> Word -> Word -> Code Pos
- updatePosQ :: Code Char -> Code Pos -> Code Pos
- updatePosNewlineOnly :: Code Char -> Word -> Code Pos
- updatePosNewlineOnlyQ :: Code Char -> Code Pos -> Code Pos
- shiftLineAndSetCol :: Word -> Word -> Word -> (Word, Word)
- shiftCol :: Word -> Word -> Word -> (Word, Word)
- shiftAlignAndShiftCol :: Word -> Word -> Word -> Word -> (Word, Word)
- shiftLineAndSetColQ :: Word -> Word -> Code Pos -> Code Pos
- shiftColQ :: Word -> Code Pos -> Code Pos
- shiftAlignAndShiftColQ :: Word -> Word -> Code Pos -> Code Pos
- toNextTab :: Word -> Word
Documentation
initPos :: (Word, Word) Source #
The initial position used by the parser. This is some representation of (1, 1).
Since: 1.8.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
Shift a static line by a given amount and then set the column
Since: 2.1.0.0
Shift a static postion's column by a given amount
Since: 2.1.0.0
shiftAlignAndShiftCol Source #
:: 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
Shift a dynamic line by a given amount and then set the column
Since: 2.1.0.0
Shift a dynamic postion's column by a given amount
Since: 2.1.0.0