1module Parse.Module (moduleDef, getModuleName, imports) where
3import Control.Applicative ((<$>), (<*>))
4import Data.List (intercalate)
5import Text.Parsec hiding (newline,spaces)
8import SourceSyntax.Module (ImportMethod(..), Imports)
10varList :: IParser [String]
11varList = commaSep1 (var <|> parens symOp)
13getModuleName :: String -> Maybe String
15 case iParse getModuleName source of
16 Right name -> Just name
21 (names, _) <- moduleDef
22 return (intercalate "." names)
24moduleDef :: IParser ([String], [String])
26 try (reserved "module")
28 names <- dotSep1 capVar <?> "name of module"
30 exports <- option [] (parens varList)
31 whitespace <?> "reserved word 'where'"
33 return (names, exports)
35imports :: IParser Imports
36imports = option [] ((:) <$> import' <*> many (try (freshLine >> import')))
38import' :: IParser (String, ImportMethod)
42 name <- intercalate "." <$> dotSep1 capVar
43 (,) name <$> option (As name) method
45 method :: IParser ImportMethod
46 method = try $ do whitespace
49 as' :: IParser ImportMethod
53 As <$> capVar <?> "alias for module"
55 importing' :: IParser ImportMethod
57 parens (choice [ const (Hiding []) <$> string ".."
58 , Importing <$> varList
59 ] <?> "listing of imported values (x,y,z)")
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list