Commit 5fa21989 authored by Jurrien Stutterheim's avatar Jurrien Stutterheim

CPM: stricter parsers

parent cedf34b8
......@@ -106,7 +106,7 @@ spstrtok = sptoken o fromString
* Parser for the project commands
*/
pProject :: CParser Char CpmAction a
pProject = spstrtok "project" &> (pProjectWithName <|> yield (Project "" ProjectHelp))
pProject = spstrtok "project" &> (pProjectWithName <!> yield (Project "" ProjectHelp))
where pProjectWithName = pNotSpace <&> \pn -> pProjectAction <@ Project (toString pn)
pProjectAction = (spstrtok "create" <@ const CreateProject)
<|> (spstrtok "show" <@ const ShowProject)
......@@ -130,7 +130,7 @@ pPathAction = pPathAction <@ ProjectPath
* Parser to toggle the --force flag
*/
pForce :: CParser Char Bool a
pForce = (spstrtok "--force" <@ const True) <|> (yield False)
pForce = (spstrtok "--force" <@ const True) <!> (yield False)
/**
* Parser for the argument to specify where the IDEEnvs file is
......@@ -143,12 +143,12 @@ pIDEEnvs = (spstrtok "--envs" &> (<?> (spsymbol '=')) &> pNotSpace <@ toString)
* Parser for module-related actions
*/
pModule :: CParser Char CpmAction a
pModule = spstrtok "module" &> (pModuleWithName <|> yield (Module "" ModuleHelp))
pModule = spstrtok "module" &> (pModuleWithName <!> yield (Module "" ModuleHelp))
where pModuleWithName = pNotSpace <&> \mn -> pModuleAction <@ Module (toString mn)
pModuleAction = (spstrtok "create" &> pModuleType <@ CreateModule)
<!> (pHelp ModuleHelp)
pModuleType = (spstrtok "application" <@ const ApplicationModule)
<|> (yield LibraryModule)
<!> (yield LibraryModule)
/**
* Parser for the help command
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment