Skip to content

SourcePos: Also track a character offset#96

Open
sjakobi wants to merge 1 commit intohaskell:masterfrom
sjakobi:offset
Open

SourcePos: Also track a character offset#96
sjakobi wants to merge 1 commit intohaskell:masterfrom
sjakobi:offset

Conversation

@sjakobi
Copy link
Member

@sjakobi sjakobi commented May 16, 2018

The purpose of this parameter is to have character offset into the input stream.

Currently I use the following code to keep track of the offset:

handleNewline = do
  p0 <- P.getPosition
  _ <- P.char '\n'
  P.setPosition (P.incSourceColumn p0 1)

The downside of this addition is that while setSourceColumn and incSourceColumn could in principle also update the offset parameter, setSourceLine and setSourceLine cannot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants