git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add new parser command instruction
2142a8dAntoine R. Dumont
psci/Commands.hs+5
@@ -34,6 +34,10 @@ data Command
34 --
34 --
35 | Import ModuleName
35 | Import ModuleName
36 -- |
36 -- |
37+ -- Browse a module
38+ --
39+ | Browse ModuleName
40+ -- |
37 -- Load a file for use with importing
41 -- Load a file for use with importing
38 --
42 --
39 | LoadFile FilePath
43 | LoadFile FilePath
@@ -65,6 +69,7 @@ help :: [[String]]
65help =
69help =
66 [ [":? ", "Show this help menu"]
70 [ [":? ", "Show this help menu"]
67 , [":i <module> ", "Import <module> for use in PSCI"]
71 , [":i <module> ", "Import <module> for use in PSCI"]
72+ , [":b <module> ", "Browse <module>"]
68 , [":m <file> ", "Load <file> for importing"]
73 , [":m <file> ", "Load <file> for importing"]
69 , [":q ", "Quit PSCi"]
74 , [":q ", "Quit PSCi"]
70 , [":r ", "Reset"]
75 , [":r ", "Reset"]
psci/Parser.hs+7−1
@@ -42,7 +42,7 @@ psciLet = Let <$> (P.Let <$> (P.reserved "let" *> P.indented *> C.mark (many1 (C
42--
42--
43parseCommand :: String -> Either ParseError Command
43parseCommand :: String -> Either ParseError Command
44parseCommand = P.runIndentParser "" $ choice
44parseCommand = 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)
46 , try psciLet
46 , try psciLet
47 , psciExpression
47 , psciExpression
48 ] <* eof
48 ] <* eof
@@ -97,3 +97,9 @@ psciTypeOf = TypeOf <$> (char 't' *> P.whiteSpace *> P.parseValue)
97--
97--
98psciKindOf :: Parsec String P.ParseState Command
98psciKindOf :: Parsec String P.ParseState Command
99psciKindOf = KindOf <$> (char 'k' *> P.whiteSpace *> P.parseType)
99psciKindOf = 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)