This project has moved and is read-only. For the latest updates, please go here.

Culture dependant NumberLiteral

Oct 25, 2013 at 9:53 AM
As I have checked NumberLiteral I see you are using strictly only "." as decimal separator which does not always have to be correct (for different cultures).
Would be really nice to be able to have property where I could inject CultureInfo (there may be some default) which would set all Culture dependant characters (or to be able to set those characters explicitly).

Well you really have there public field DecimalSeparator, but inside of your methods you are using identification of other numberLiterals with decimal separator other than '.' does not work and throws "syntax error, unexpected input"...
Nov 9, 2013 at 5:37 PM
about DecimalSeparator property - will look at it, thanks.
Culture-aware terminal - well, not so sure. I think Culture is mostly about representation, i.e. converting (binary) -> Text. While Irony and parsers in general is about reverse. So it would be quite risky undertaking, even if this could be done. To put it simply, there's no way to assure that grammar/parser working perfectly in one culture would work in another. Like in some cultures, comma is used instead of dot as decimal separator. But then comma is also commonly used in languages as list delimiter, so switching the Culture-aware NumberLiteral to this culture may actually completely break the parser. Finally, there are just a few (2 at most) props in Culture that concern number parsing, so it's better to have them exposed directly on number literal