git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
use ModulePath instead of [ProperName]
b938f71Bogdan Popa
src/Language/PureScript/Declarations.hs+1−1
@@ -39,5 +39,5 @@ data Declaration
39 | ExternDataDeclaration ProperName Kind
39 | ExternDataDeclaration ProperName Kind
40 | FixityDeclaration Fixity String
40 | FixityDeclaration Fixity String
41 | ModuleDeclaration ProperName [Declaration]
41 | ModuleDeclaration ProperName [Declaration]
42− | ImportDeclaration [ProperName] (Maybe [Ident])
42+ | ImportDeclaration ModulePath (Maybe [Ident])
43 deriving (Show, D.Data, D.Typeable)
43 deriving (Show, D.Data, D.Typeable)
src/Language/PureScript/Parser/Declarations.hs+6−2
@@ -28,6 +28,7 @@ import qualified Data.Map as M
28import qualified Text.Parsec as P
28import qualified Text.Parsec as P
29import qualified Text.Parsec.Pos as P
29import qualified Text.Parsec.Pos as P
30
30
31+import Language.PureScript.Names
31import Language.PureScript.Values
32import Language.PureScript.Values
32import Language.PureScript.Types
33import Language.PureScript.Types
33import Language.PureScript.Parser.State
34import Language.PureScript.Parser.State
@@ -100,13 +101,16 @@ parseImportDeclaration :: P.Parsec String ParseState Declaration
100parseImportDeclaration = do
101parseImportDeclaration = do
101 reserved "import"
102 reserved "import"
102 indented
103 indented
103− module_ <- P.sepBy1 properName (lexeme $ P.char '.')
104+ segments <- P.sepBy1 properName (lexeme $ P.char '.')
104 idents <- P.optionMaybe $ do
105 idents <- P.optionMaybe $ do
105 lexeme $ indented *> P.char '('
106 lexeme $ indented *> P.char '('
106 idents <- P.sepBy1 parseIdent (lexeme $ indented *> P.char ',')
107 idents <- P.sepBy1 parseIdent (lexeme $ indented *> P.char ',')
107 lexeme $ indented *> P.char ')'
108 lexeme $ indented *> P.char ')'
108 return idents
109 return idents
110+ let modulePath = (mkModulePath (ModulePath [head segments]) (tail segments))
109− return $ ImportDeclaration module_ idents
111+ return $ ImportDeclaration modulePath idents
112+ where mkModulePath path (s:ss) = mkModulePath (subModule path s) ss
113+ mkModulePath path _ = path
110
114
111parseDeclaration :: P.Parsec String ParseState Declaration
115parseDeclaration :: P.Parsec String ParseState Declaration
112parseDeclaration = P.choice
116parseDeclaration = P.choice