Skip to content

Commit

Permalink
allow parsing _ inside nums
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTaelin committed Oct 30, 2024
1 parent 9b9955f commit fcd6939
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Kind/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ parseFloat = withSrc $ P.try $ do
return $ Flt (sign value)

parseNum = withSrc $ P.choice
[ P.try (string_skp "0x") >> (Num . read . ("0x" ++) <$> P.many1 P.hexDigit)
, P.try (string_skp "0b") >> (Num . read . ("0b" ++) <$> P.many1 (oneOf "01"))
, Num . read <$> P.many1 digit
[ P.try (string_skp "0x") >> (Num . read . filter (/= '_') . ("0x" ++) <$> P.many1 (P.hexDigit <|> char_skp '_'))
, P.try (string_skp "0b") >> (Num . read . filter (/= '_') . ("0b" ++) <$> P.many1 (oneOf "01" <|> char_skp '_'))
, Num . read . filter (/= '_') <$> P.many1 (digit <|> char_skp '_')
]

parseOp2 = withSrc $ do
Expand Down

0 comments on commit fcd6939

Please sign in to comment.