Welcome!

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

SignUp Now!

Fixed DO /L with stringset starting with /n /e

samintz

Scott Mintz
May
1,582
27
I have a foo.BTM script containing:
Code:
do i in /L %*
if not %@index[%i,/] == -1 echos ` `%i
enddo

If I invoke it as:
Code:
foo a1 /n /e a2 a3
It spits out /n /e correctly. However, if I invoke it as:

Code:
foo /n /e a1 a2 a3
TCC hangs. Ctrl+C/Ctrl+Break do nothing. I expected the above code to iterate over the stringset and display /n /e. I can work around it by quoting the stringset, but then I have to unquote everything before using the loop variable.

TCC 15.01.39 x64 Windows 7 [Version 6.1.7601]
 
This sends TCC into a tizzy ... full CPU and you can't break out of it.
Code:
do a in /l /n /g /t (echo %a)
It seems that after encountering "/L", "/C", or "/P", DO should stop looking for more switches.
 
This sends TCC into a tizzy ... full CPU and you can't break out of it.
Code:
do a in /l /n /g /t (echo %a)
It seems that after encountering "/L", "/C", or "/P", DO should stop looking for more switches.

It does. The problem is that the /N is found *before* the /L, and DO keeps looking for the missing arguments to /N. (Multi-character switches are processed before single-character switches.)

It's behaved this way for about 20 years. I'm not going to write a custom parser for DO, but I'll see if I can hack something horrible to post-process the pre-processing.
 

Similar threads

Back
Top