File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -39,5 +39,5 @@ data Declaration
3939 | ExternDataDeclaration ProperName Kind
4040 | FixityDeclaration Fixity String
4141 | ModuleDeclaration ProperName [Declaration ]
42- | ImportDeclaration [ ProperName ] (Maybe [Ident ])
42+ | ImportDeclaration ModulePath (Maybe [Ident ])
4343 deriving (Show , D.Data , D.Typeable )
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import qualified Data.Map as M
2828import qualified Text.Parsec as P
2929import qualified Text.Parsec.Pos as P
3030
31+ import Language.PureScript.Names
3132import Language.PureScript.Values
3233import Language.PureScript.Types
3334import Language.PureScript.Parser.State
@@ -100,13 +101,16 @@ parseImportDeclaration :: P.Parsec String ParseState Declaration
100101parseImportDeclaration = do
101102 reserved " import"
102103 indented
103- module_ <- P. sepBy1 properName (lexeme $ P. char ' .' )
104+ segments <- P. sepBy1 properName (lexeme $ P. char ' .' )
104105 idents <- P. optionMaybe $ do
105106 lexeme $ indented *> P. char ' ('
106107 idents <- P. sepBy1 parseIdent (lexeme $ indented *> P. char ' ,' )
107108 lexeme $ indented *> P. char ' )'
108109 return idents
109- return $ ImportDeclaration module_ idents
110+ let modulePath = (mkModulePath (ModulePath [head segments]) (tail segments))
111+ return $ ImportDeclaration modulePath idents
112+ where mkModulePath path (s: ss) = mkModulePath (subModule path s) ss
113+ mkModulePath path _ = path
110114
111115parseDeclaration :: P. Parsec String ParseState Declaration
112116parseDeclaration = P. choice
You can’t perform that action at this time.
0 commit comments