git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add new parser command instruction
commit2142a8d7c150dea9e9e7c77a7e6aac13beeddfb7 authorAntoine R. Dumont <antoine.romain.dumont@gmail.com> dateThu 30 Oct 2014, 19:55 (12 years ago) parent78d6f7a
2 files changed+12−1
psci/Commands.hs+5 psci/Parser.hs+7−1
psci/Commands.hs+5
@@ -34,6 +34,10 @@ data Command
3434 --
3535 | Import ModuleName
3636 -- |
37+ -- Browse a module
38+ --
39+ | Browse ModuleName
40+ -- |
3741 -- Load a file for use with importing
3842 --
3943 | LoadFile FilePath
@@ -65,6 +69,7 @@ help :: [[String]]
6569help =
6670 [ [":? ", "Show this help menu"]
6771 , [":i <module> ", "Import <module> for use in PSCI"]
72+ , [":b <module> ", "Browse <module>"]
6873 , [":m <file> ", "Load <file> for importing"]
6974 , [":q ", "Quit PSCi"]
7075 , [":r ", "Reset"]
psci/Parser.hs+7−1
@@ -42,7 +42,7 @@ psciLet = Let <$> (P.Let <$> (P.reserved "let" *> P.indented *> C.mark (many1 (C
4242--
4343parseCommand :: String -> Either ParseError Command
4444parseCommand = P.runIndentParser "" $ choice
45− [ P.whiteSpace *> char ':' *> (psciHelp <|> psciImport <|> psciLoadFile <|> psciQuit <|> psciReload <|> psciTypeOf <|> psciKindOf)
45+ [ P.whiteSpace *> char ':' *> (psciHelp <|> psciImport <|> psciLoadFile <|> psciQuit <|> psciReload <|> psciTypeOf <|> psciKindOf <|> psciBrowse)
4646 , try psciLet
4747 , psciExpression
4848 ] <* eof
@@ -97,3 +97,9 @@ psciTypeOf = TypeOf <$> (char 't' *> P.whiteSpace *> P.parseValue)
9797--
9898psciKindOf :: Parsec String P.ParseState Command
9999psciKindOf = KindOf <$> (char 'k' *> P.whiteSpace *> P.parseType)
100+
101+-- |
102+-- Parses 'Commands.Browse' command.
103+--
104+psciBrowse :: Parsec String P.ParseState Command
105+psciBrowse = Browse <$> (char 'b' *> P.whiteSpace *> P.moduleName)