`-` is interpretated as a number rather than a string
krtschmr opened this issue · 1 comments
krtschmr commented
https://github.com/rubysolo/dentaku/blob/main/lib/dentaku/ast/comparators.rb#L32
would not match on IF(b11="-", 0, 1)
which then follows to convert it to BigDecimal, yet "-"
is a string
the regex is -?\d*(\.\d+)?
which reads like "an optional minus sign, followed by an optional digit and an option dot or digit"
while -.5
should be matched (it's up for discussion i guess) clearly a -.
isn't a number and neither is -
krtschmr commented
i fixed it now by explicitly returning if it's either -
or -.
. both values would match the regex otherwise and thus been casted to BigDecimal
. Works great for our project now! 💪🏿