Skip to content

Bad parsing of integers as scientific#15

Draft
tchoutri wants to merge 7 commits into
fuzzypixelz:mainfrom
tchoutri:bad-parsing-of-integers-as-scientific
Draft

Bad parsing of integers as scientific#15
tchoutri wants to merge 7 commits into
fuzzypixelz:mainfrom
tchoutri:bad-parsing-of-integers-as-scientific

Conversation

@tchoutri

@tchoutri tchoutri commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@tchoutri

tchoutri commented Aug 7, 2025

Copy link
Copy Markdown
Contributor Author

It would appear that the implementation of the digits helper in the number parser is problematic:

digits = T.cons <$> satisfy isNumDigit <*> takeWhileP
  (Just "digit")
  (\c -> isNumDigit c || c == '_')
ghci> parse decimal_ "toto.kdl" "0.0"
Right 0

I suspect the takeWhileP to simply stop the parsing until the period, which gives us a nice round integer for the decimal parser to accept. I'll experiment with making the parser fail when it encounters a ¬digit.

@tchoutri tchoutri force-pushed the bad-parsing-of-integers-as-scientific branch 4 times, most recently from 4bd786b to 9513ae9 Compare August 7, 2025 21:24
@tchoutri tchoutri force-pushed the bad-parsing-of-integers-as-scientific branch from 9513ae9 to 6888513 Compare August 7, 2025 21:30
@tchoutri tchoutri force-pushed the bad-parsing-of-integers-as-scientific branch from 3b87d2a to 2913d8a Compare November 12, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant