Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

More parser woes

May
13,834
211
This works.

Code:
v:\> echo %@len[A[]
2

Why doesn't this work? I've only replaced A with %@char[65].

Code:
v:\> echo %@len[%@char[65][]
TCC: Syntax error "@char[65"
 
Maybe it's really after multiple "%" ... regardless what follows then?
 
Nope, that seems not the reason with the 2nd "%", it's not so easy.
 
But could be always be after a 2nd function "%@functionname[]" ... where "%@" within "len" seems enough to produce a syntax error.
 
This works.

Code:
v:\> echo %@len[A[]
2

Why doesn't this work? I've only replaced A with %@char[65].

Code:
v:\> echo %@len[%@char[65][]
TCC: Syntax error "@char[65"

WAD. The '[' character here is considered a quoting character (and is looking for a matching endquote character). This is necessary to support nested variable expansion.

Your first example works because there isn't nested expansion.

This is 30+ year old behavior, and is not going to change without a really good reason and several months of beta testing, as it could have calamitous side-effects.
 
Back
Top