lib: superficial parser cleanups

This commit is contained in:
Alex Chen 2018-05-24 20:34:00 -06:00 committed by Simon Michael
parent 2a492696a9
commit d56fca1ba2

View File

@ -603,7 +603,8 @@ nosymbolamountp = do
<?> "no-symbol amount"
commoditysymbolp :: TextParser m CommoditySymbol
commoditysymbolp = (quotedcommoditysymbolp <|> simplecommoditysymbolp) <?> "commodity symbol"
commoditysymbolp =
quotedcommoditysymbolp <|> simplecommoditysymbolp <?> "commodity symbol"
quotedcommoditysymbolp :: TextParser m CommoditySymbol
quotedcommoditysymbolp =
@ -617,11 +618,7 @@ priceamountp :: Monad m => JournalParser m Price
priceamountp = option NoPrice $ try $ do
lift (skipMany spacenonewline)
char '@'
m <- optional $ char '@'
let priceConstructor = case m of
Just _ -> TotalPrice
Nothing -> UnitPrice
priceConstructor <- char '@' *> pure TotalPrice <|> pure UnitPrice
lift (skipMany spacenonewline)
priceAmount <- amountwithoutpricep
@ -688,12 +685,7 @@ numberp suggestedStyle = do
<?> "numberp"
exponentp :: TextParser m Int
exponentp = do
char' 'e'
sign <- signp
d <- decimal
pure $ sign d
<?> "exponentp"
exponentp = char' 'e' *> signp <*> decimal <?> "exponentp"
-- | Interpret a raw number as a decimal number.
--