git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #170 from garyb/master
c866c63Phil Freeman
psc/Main.hs+2−2
@@ -28,10 +28,10 @@ preludeFilename :: IO FilePath
28preludeFilename = Paths.getDataFileName "libraries/prelude/prelude.purs"
28preludeFilename = Paths.getDataFileName "libraries/prelude/prelude.purs"
29
29
30readInput :: Maybe [FilePath] -> IO (Either ParseError [P.Module])
30readInput :: Maybe [FilePath] -> IO (Either ParseError [P.Module])
31−readInput Nothing = getContents >>= return . P.runIndentParser P.parseModules
31+readInput Nothing = getContents >>= return . P.runIndentParser "" P.parseModules
32readInput (Just input) = fmap (fmap concat . sequence) $ forM input $ \inputFile -> do
32readInput (Just input) = fmap (fmap concat . sequence) $ forM input $ \inputFile -> do
33 text <- U.readFile inputFile
33 text <- U.readFile inputFile
34− return $ P.runIndentParser P.parseModules text
34+ return $ P.runIndentParser inputFile P.parseModules text
35
35
36compile :: P.Options -> Maybe [FilePath] -> Maybe FilePath -> Maybe FilePath -> IO ()
36compile :: P.Options -> Maybe [FilePath] -> Maybe FilePath -> Maybe FilePath -> IO ()
37compile opts input output externs = do
37compile opts input output externs = do
psci/Main.hs+2−2
@@ -106,7 +106,7 @@ loadModule :: FilePath -> IO (Either String [P.Module])
106loadModule moduleFile = do
106loadModule moduleFile = do
107 print moduleFile
107 print moduleFile
108 moduleText <- U.readFile moduleFile
108 moduleText <- U.readFile moduleFile
109− return . either (Left . show) Right $ P.runIndentParser P.parseModules moduleText
109+ return . either (Left . show) Right $ P.runIndentParser "" P.parseModules moduleText
110
110
111main :: IO ()
111main :: IO ()
112main = do
112main = do
@@ -128,7 +128,7 @@ main = do
128 case cmd of
128 case cmd of
129 Empty -> go imports loadedModules
129 Empty -> go imports loadedModules
130 Expression ls -> do
130 Expression ls -> do
131− case P.runIndentParser (P.whiteSpace *> P.parseValue <* Parsec.eof) (unlines ls) of
131+ case P.runIndentParser "" (P.whiteSpace *> P.parseValue <* Parsec.eof) (unlines ls) of
132 Left err -> outputStrLn (show err)
132 Left err -> outputStrLn (show err)
133 Right decl -> handleDeclaration loadedModules imports decl
133 Right decl -> handleDeclaration loadedModules imports decl
134 go imports loadedModules
134 go imports loadedModules
src/Language/PureScript/Parser/Common.hs+2−2
@@ -399,5 +399,5 @@ same = checkIndentation (==) P.<?> "no indentation"
399-- |
399-- |
400-- Run a parser which supports indentation
400-- Run a parser which supports indentation
401--
401--
402−runIndentParser :: P.Parsec String ParseState a -> String -> Either P.ParseError a
402+runIndentParser :: FilePath -> P.Parsec String ParseState a -> String -> Either P.ParseError a
403−runIndentParser p = P.runParser p (ParseState 0) ""
403+runIndentParser filePath p = P.runParser p (ParseState 0) filePath
tests/Main.hs+1−1
@@ -39,7 +39,7 @@ preludeFilename = Paths.getDataFileName "libraries/prelude/prelude.purs"
39readInput :: [FilePath] -> IO (Either ParseError [P.Module])
39readInput :: [FilePath] -> IO (Either ParseError [P.Module])
40readInput inputFiles = fmap (fmap concat . sequence) $ forM inputFiles $ \inputFile -> do
40readInput inputFiles = fmap (fmap concat . sequence) $ forM inputFiles $ \inputFile -> do
41 text <- U.readFile inputFile
41 text <- U.readFile inputFile
42− return $ P.runIndentParser P.parseModules text
42+ return $ P.runIndentParser inputFile P.parseModules text
43
43
44compile :: P.Options -> [FilePath] -> IO (Either String String)
44compile :: P.Options -> [FilePath] -> IO (Either String String)
45compile opts inputFiles = do
45compile opts inputFiles = do