I have re-engineered the expression engine using Antlr and ended up with a decently powerful expression parser and easy integration of custom functions.
In both JEP and the new parser I decided to go with a preprocessor for the dice rolling XdY instead of build it into the expression language. I use a pair of regular expressions like so:
Code: Select all
s/[dD](\d+)/roll(1, $1)/g
s/(\d+)[dD](\d+)/roll($1, $2)/g
Also, I plan on putting an editor for the JavaScript into DiceTool and putting all of the customizations, preprocessor, javascript and tabs into the save file so that they are easily portable.