"{STATE_KEYSTATE:}" works with "SHIFT" and "LSHIFT" again. Fixed.
On the subject of nested tokens:
This is going to make complex operations so much simpler, awesome feature!
Now that "{}" will be replaced with "", perhaps an escape sequence could be implemented to suppress this behavior?
I had typed up a report on the issue of the contents of "{CLIP}" getting interpreted as tokens, which wasn't a big issue then as it would only match semi-valid tokens within that string. However, with this implementation any text with curly braces may get blanked out.
Because VoiceAttack generally works with tokens(and having "\" as an escape character would cause issues by itself), I suggest something like "{LIT:}", which tells the parser to treat the contents of the token as literal.
As you've explained the way tokens are parsed, I'm hoping it'd be possible to parse every token until only the "{LIT:}" tokens remain, and then parse those as the last step.
This also ties in to the ability to allow some processing to the contents of "{LIT:}", by passing it a parameter for the recursion depth: "{LIT:{CLIP}:1}" would parse "{CLIP}", but not its contents, and because the recursion depth is "1", the token would be converted to "{LIT:Contents of clipboard}", which would then tell the parser to leave that token and its contents alone until the final pass.