[Parsec] Extracting line and column numbers
Hi, I'm using the Parsec library to parse strings for a small experimental language. I'd like to decorate each node in the abstract syntax tree with a pair (Int, Int) that represents the line and column number in the strings. Unfortunately, the SourcePos class in the Parsec library is abstract and I cannot extract the line and column numbers from a SourcePos value. What are my options? With kind regards, Stefan Holdermans
On Tue, Jan 13, 2004 at 12:44:10PM +0100, Stefan Holdermans wrote:
Hi,
I'm using the Parsec library to parse strings for a small experimental language. I'd like to decorate each node in the abstract syntax tree with a pair (Int, Int) that represents the line and column number in the strings. Unfortunately, the SourcePos class in the Parsec library is abstract and I cannot extract the line and column numbers from a SourcePos value. What are my options?
What about these? type Column = Int type Line = Int sourceColumn :: SourcePos -> Column sourceLine :: SourcePos -> Line Regards, Tomasz -- .signature: Too many levels of symbolic links
Tomasz Zielonka wrote:
On Tue, Jan 13, 2004 at 12:44:10PM +0100, Stefan Holdermans wrote:
abstract and I cannot extract the line and column numbers from a SourcePos value. What are my options?
What about these?
sourceColumn :: SourcePos -> Column sourceLine :: SourcePos -> Line
These signatures are missing in the source, therefore they are not listed in the documentation generated by haddock. Christian
What about these?
sourceColumn :: SourcePos -> Column sourceLine :: SourcePos -> Line
These signatures are missing in the source, therefore they are not listed in the documentation generated by haddock.
I'll fix this in the Parsec sources, so the GHC 6.2+ will have it. Maybe I'll even get around to documenting Parsec with Haddock comments some day... -- Daan.
At 10:28 14/01/04 +0100, Daan Leijen wrote:
I'll fix this in the Parsec sources, so the GHC 6.2+ will have it. Maybe I'll even get around to documenting Parsec with Haddock comments some day...
If I may say so, I think you did a pretty good job of documenting Parsec... #g ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact
participants (5)
-
Christian Maeder -
Daan Leijen -
Graham Klyne -
Stefan Holdermans -
Tomasz Zielonka