String-values in modifications fail if the modifications do not apply, as they end up in the "multiply/add" path.
I fix this by splitting in two sub-functions, which lets us report errors more accurately.
I've profiled this to be rather equivalent to our current implementation in terms of speed.
Further, as noted by @Freagarach , I did not allow multiple token replacement (to avoid ordering issues). However, tokens-modifiers are somewhat likely to conflict, and general usage should be sane enough with multiple techs, so I think these can be allowed.