I don't know if it would help at all, but it appears how you handle []'s doesn't have this flaw. If I understand correctly, brackets are supposed to force parsing in that nested region first, then jump back to the beginning and then parse the entire string. If the same parsing routine is invoked for it all then [ ]'s should suffer the same fate, yet they don't.

This is the same observation that Sat made for /var. My reply is the same as that for /var. [] brackets work in a completely different way, at a completely different point in the parser.

I keep saying this: the scripting language grew organically. Every feature in it was patched on, over a period of 25 years, with no over-arching grand plan or design.

I cannot make feature X work like feature Y, not without rewriting the parser, shfiting code around to different points in the parser, breaking backward compatibility, etc.

It works the way it does because that is how it was implemented X years ago.