Allow slashed module names and use their base name
This commit is contained in:
parent
c311d22c85
commit
cda4a8a345
1 changed files with 2 additions and 2 deletions
|
@ -12,7 +12,7 @@ import Control.Monad.Trans (lift)
|
||||||
import Control.Monad.Trans.State (StateT, runStateT, evalStateT, get, put)
|
import Control.Monad.Trans.State (StateT, runStateT, evalStateT, get, put)
|
||||||
import System.IO (Handle, hPutStr, hGetLine, hFlush, hClose, hIsEOF, openBinaryFile, IOMode(..), stdout, stdin)
|
import System.IO (Handle, hPutStr, hGetLine, hFlush, hClose, hIsEOF, openBinaryFile, IOMode(..), stdout, stdin)
|
||||||
import System.Directory (doesFileExist)
|
import System.Directory (doesFileExist)
|
||||||
import System.FilePath (FilePath, splitExtension)
|
import System.FilePath (FilePath, splitExtension, takeBaseName)
|
||||||
import AST
|
import AST
|
||||||
import Parser (parseProgram)
|
import Parser (parseProgram)
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ _Import (StrV modname) = do
|
||||||
let path = modname ++ ".lamb"
|
let path = modname ++ ".lamb"
|
||||||
exists <- doesFileExist path
|
exists <- doesFileExist path
|
||||||
if exists then
|
if exists then
|
||||||
return (path, fst $ splitExtension path)
|
return (path, takeBaseName path)
|
||||||
else error $ "module " ++ modname ++ " couldn't be found"
|
else error $ "module " ++ modname ++ " couldn't be found"
|
||||||
|
|
||||||
initialState = ([stdout, stdin],
|
initialState = ([stdout, stdin],
|
||||||
|
|
Loading…
Reference in a new issue