PaesslerAG / gval

Expression evaluation in golang
BSD 3-Clause "New" or "Revised" License
713 stars 83 forks source link

Error when Not Adding Space for New Operator #64

Closed plasticmacaroni closed 2 years ago

plasticmacaroni commented 2 years ago

Update - I got things working by adding custom regex to add spaces to my evaluation:

e.g. 4d2 would roll 4 "d2" dice. By adding custom logic to turn 4d2 into "4 d 2" I was able to get things working. Thanks for the support!

generikvault commented 2 years ago

hi, I'm not sure if this can be done. If this is possible than by reconfiguring the Scanner inside the Parser with an Init extension. Try something like IsIdentRune = func(ch rune, i int) bool {return unicode.IsDigit(ch)}