lib: superficial parser cleanups
This commit is contained in:
parent
2a492696a9
commit
d56fca1ba2
@ -603,7 +603,8 @@ nosymbolamountp = do
|
|||||||
<?> "no-symbol amount"
|
<?> "no-symbol amount"
|
||||||
|
|
||||||
commoditysymbolp :: TextParser m CommoditySymbol
|
commoditysymbolp :: TextParser m CommoditySymbol
|
||||||
commoditysymbolp = (quotedcommoditysymbolp <|> simplecommoditysymbolp) <?> "commodity symbol"
|
commoditysymbolp =
|
||||||
|
quotedcommoditysymbolp <|> simplecommoditysymbolp <?> "commodity symbol"
|
||||||
|
|
||||||
quotedcommoditysymbolp :: TextParser m CommoditySymbol
|
quotedcommoditysymbolp :: TextParser m CommoditySymbol
|
||||||
quotedcommoditysymbolp =
|
quotedcommoditysymbolp =
|
||||||
@ -617,11 +618,7 @@ priceamountp :: Monad m => JournalParser m Price
|
|||||||
priceamountp = option NoPrice $ try $ do
|
priceamountp = option NoPrice $ try $ do
|
||||||
lift (skipMany spacenonewline)
|
lift (skipMany spacenonewline)
|
||||||
char '@'
|
char '@'
|
||||||
|
priceConstructor <- char '@' *> pure TotalPrice <|> pure UnitPrice
|
||||||
m <- optional $ char '@'
|
|
||||||
let priceConstructor = case m of
|
|
||||||
Just _ -> TotalPrice
|
|
||||||
Nothing -> UnitPrice
|
|
||||||
|
|
||||||
lift (skipMany spacenonewline)
|
lift (skipMany spacenonewline)
|
||||||
priceAmount <- amountwithoutpricep
|
priceAmount <- amountwithoutpricep
|
||||||
@ -688,12 +685,7 @@ numberp suggestedStyle = do
|
|||||||
<?> "numberp"
|
<?> "numberp"
|
||||||
|
|
||||||
exponentp :: TextParser m Int
|
exponentp :: TextParser m Int
|
||||||
exponentp = do
|
exponentp = char' 'e' *> signp <*> decimal <?> "exponentp"
|
||||||
char' 'e'
|
|
||||||
sign <- signp
|
|
||||||
d <- decimal
|
|
||||||
pure $ sign d
|
|
||||||
<?> "exponentp"
|
|
||||||
|
|
||||||
-- | Interpret a raw number as a decimal number.
|
-- | Interpret a raw number as a decimal number.
|
||||||
--
|
--
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user