It's not currently possible to use $, { or } inside $COMMANDTOKEN$s, which is what this PR fixes. Whenever the parser encounters one of these symbols, it checks whether a \ precedes them, and if that is true, it treats those symbols literally.
A couple caveats:
The parser doesn't check whether { is actually escaped, since you require it to be preceded by a space anyway.
However, if a { is escaped inside a command token, the backslash is removed.
No backslashes are removed anywhere but command tokens, even though escaped characters are treated as such. But I can't see a use for escaping characters outside command tokens, so it's probably fine.
This PR adds escaping of special symbols.
It's not currently possible to use
$
,{
or}
inside$COMMANDTOKEN$
s, which is what this PR fixes. Whenever the parser encounters one of these symbols, it checks whether a\
precedes them, and if that is true, it treats those symbols literally.A couple caveats:
{
is actually escaped, since you require it to be preceded by a space anyway.{
is escaped inside a command token, the backslash is removed.