| Copyright | (c) comp 2020 |
|---|---|
| License | MIT |
| Maintainer | onecomputer00@gmail.com |
| Stability | stable |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Hectoparsec.Pos
Contents
Description
Data type for source position.
Positional data
The position of a token within the source text.
Constructors
| Pos | |
initialPos :: FilePath -> Pos Source #
Creates a Pos for the start of a source text (line 1, column 1) with a given file path.
Arguments
| :: (a -> Bool) | Whether the token is a new line. |
| -> a | The token. |
| -> Pos | The position to update. |
| -> Pos |
Updates position based on a character-like token.
Tokens which are considered newlines will increment the line number by 1 and set the column number to 1. Otherwise, the column number is incremented by one.