Skip to content

Commit

Permalink
fix parser, display help
Browse files Browse the repository at this point in the history
  • Loading branch information
emilypi committed Aug 18, 2023
1 parent 181d801 commit 4c6645a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion pact-core/Pact/Core/Repl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ main = do
Just input -> case parseReplActionText (T.strip input) of
Nothing -> do
outputStrLn "Error: Expected supported command or expression. See :help for more information."
outputStrLn $ show $ parseReplActionText input
loop
Just ra -> case ra of
RALoad txt -> let
Expand Down
1 change: 1 addition & 0 deletions pact-core/Pact/Core/Repl/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ helpCommand = outputStrLn $ List.intercalate "\n"
, " tc-type show inferred type information"
, " specializer show specializer phase information"
, " untyped-core show untyped core phase information"
, ""
]


Expand Down
21 changes: 11 additions & 10 deletions pact-core/Pact/Core/Repl/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,20 @@ parseReplAction =
where
execute =
RAExecuteExpr <$> MP.takeRest
cmdKw kw = MP.chunk kw *> MP.space1
cmd = do
_ <- MP.char ':'
load <|> setFlag <|> showHelp
showHelp = pure RAShowHelp
setFlag =
cmdKw "debug" *> (RASetDebugFlag <$> parseReplDebugUpdate)

-- tc = do
-- cmdKw "type"
-- RATypecheck <$> MP.takeRest
load <|> setDebugFlag <|> showHelp

cmdKwWithArg kw = MP.chunk kw *> MP.space1

Check failure on line 208 in pact-core/Pact/Core/Repl/Types.hs

View workflow job for this annotation

GitHub Actions / build (8.10.7, 3.8, ubuntu-latest)

• Illegal equational constraint MP.Token s ~ Char

Check failure on line 208 in pact-core/Pact/Core/Repl/Types.hs

View workflow job for this annotation

GitHub Actions / build (8.10.7, 3.8, macOS-latest)

• Illegal equational constraint MP.Token s ~ Char

Check failure on line 208 in pact-core/Pact/Core/Repl/Types.hs

View workflow job for this annotation

GitHub Actions / build (8.10.7, 3.8, windows-latest)

• Illegal equational constraint MP.Token s ~ Char

showHelp =
RAShowHelp <$ MP.chunk "help"

setDebugFlag =
cmdKwWithArg "debug" *> (RASetDebugFlag <$> parseReplDebugUpdate)

load = do
cmdKw "load"
cmdKwWithArg "load"
let c = MP.char '\"'
RALoad <$> MP.between c c (MP.takeWhile1P Nothing (/= '\"'))

Expand Down

0 comments on commit 4c6645a

Please sign in to comment.