git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Include source name in SourcePos info
e4f4281Gary Burgess
src/Language/PureScript/Declarations.hs+6−3
@@ -45,11 +45,14 @@ instance Show Associativity where
45-- Source position information
45-- Source position information
46--
46--
47data SourcePos = SourcePos
47data SourcePos = SourcePos
48− {
48+ { -- |
49+ -- Source name
50+ --
51+ sourceName :: String
49 -- |
52 -- |
50 -- Line number
53 -- Line number
51 --
54 --
52− sourcePosLine :: Int
55+ , sourcePosLine :: Int
53 -- |
56 -- |
54 -- Column number
57 -- Column number
55 --
58 --
@@ -57,7 +60,7 @@ data SourcePos = SourcePos
57 } deriving (D.Data, D.Typeable)
60 } deriving (D.Data, D.Typeable)
58
61
59instance Show SourcePos where
62instance 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)
61
64
62-- |
65-- |
63-- Fixity data for infix operators
66-- Fixity data for infix operators
src/Language/PureScript/Parser/Declarations.hs+1−1
@@ -44,7 +44,7 @@ import qualified Text.Parsec.Expr as P
44sourcePos :: P.Parsec s u SourcePos
44sourcePos :: P.Parsec s u SourcePos
45sourcePos = toSourcePos <$> P.getPosition
45sourcePos = toSourcePos <$> P.getPosition
46 where
46 where
47− toSourcePos p = SourcePos (P.sourceLine p) (P.sourceColumn p)
47+ toSourcePos p = SourcePos (P.sourceName p) (P.sourceLine p) (P.sourceColumn p)
48
48
49parseDataDeclaration :: P.Parsec String ParseState Declaration
49parseDataDeclaration :: P.Parsec String ParseState Declaration
50parseDataDeclaration = do
50parseDataDeclaration = do