stephan-tolksdorf / fparsec

A parser combinator library for F#
517 stars 46 forks source link

Make it possible to specify a culture for parsing floats #109

Open keimpema opened 1 month ago

keimpema commented 1 month ago

I would like to be able to use the built-in number parsers (pfloat, numberLiteral) with a specific culture so that I can parse numbers with a comma as a decimal separator. Correct me if I'm wrong, but this does not seem possible at the moment.

hglee commented 1 month ago

It is hard coded, you need to write new number parser.

https://github.com/stephan-tolksdorf/fparsec/blob/156cbd751fac67ca7cc04cf661710f1f90a216a5/FParsec/CharParsers.fs#L996

https://github.com/stephan-tolksdorf/fparsec/blob/156cbd751fac67ca7cc04cf661710f1f90a216a5/FParsec/CharParsers.fs#L1153

https://github.com/stephan-tolksdorf/fparsec/blob/156cbd751fac67ca7cc04cf661710f1f90a216a5/FParsecCS/HexFloat.cs#L233