git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Include source name in SourcePos info
commite4f4281ec12263e307b88c17b3210d5a04d54539 authorGary Burgess <gary.burgess@gmail.com> dateSat 29 Mar 2014, 15:22 (13 years ago) parent726c60e
2 files changed+7−4
src/Language/PureScript/Declarations.hs+6−3 src/Language/PureScript/Parser/Declarations.hs+1−1
src/Language/PureScript/Declarations.hs+6−3
@@ -45,11 +45,14 @@ instance Show Associativity where
4545-- Source position information
4646--
4747data SourcePos = SourcePos
48− {
48+ { -- |
49+ -- Source name
50+ --
51+ sourceName :: String
4952 -- |
5053 -- Line number
5154 --
52− sourcePosLine :: Int
55+ , sourcePosLine :: Int
5356 -- |
5457 -- Column number
5558 --
@@ -57,7 +60,7 @@ data SourcePos = SourcePos
5760 } deriving (D.Data, D.Typeable)
5861
5962instance Show SourcePos where
60− show sp = "line " ++ show (sourcePosLine sp) ++ ", column " ++ show (sourcePosColumn sp)
63+ show sp = (sourceName sp) ++ " line " ++ show (sourcePosLine sp) ++ ", column " ++ show (sourcePosColumn sp)
6164
6265-- |
6366-- Fixity data for infix operators
src/Language/PureScript/Parser/Declarations.hs+1−1
@@ -44,7 +44,7 @@ import qualified Text.Parsec.Expr as P
4444sourcePos :: P.Parsec s u SourcePos
4545sourcePos = toSourcePos <$> P.getPosition
4646 where
47− toSourcePos p = SourcePos (P.sourceLine p) (P.sourceColumn p)
47+ toSourcePos p = SourcePos (P.sourceName p) (P.sourceLine p) (P.sourceColumn p)
4848
4949parseDataDeclaration :: P.Parsec String ParseState Declaration
5050parseDataDeclaration = do