Welcome!

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

SignUp Now!

@FORMAT (commas in string) inside @IF?

May
12,806
161
I spent a couple hours figuring out a bug in a BTM and it boils down to this.

This works as expected.

1688143354886.png


This works differently. The comma between xxx and yyy is being seen as belonging to @IF but the ,yyy still contributes to @FORMAT's length.

1688143437900.png


1688144250043.png


Escaping that comma isn't perfect. It fixes the problem with @IF but the escape character itself contributes to @FORMAT's length even though it's not printed.

1688143850290.png


1688143912753.png


I figure the escape character shouldn't contribute to @FORMAT's length (and that that might be hard or impossible).
 
The comma between xxx and yyy is being seen as belonging to @IF.

1688143437900.png


1688144250043.png
What about that first observation. Doesn't the parser know that the comma between xxx and yyy is inside the %FORMAT? I thought (naively as usual) that when parsing nested variable functions the parser would know which ] ends which function.
 
WAD - TCC is doing exactly what you told it to.

The %@FORMAT[12,xxx,yyy] returns " xxx,yyy".

So %@IF is being passed the argument: "1==1, xxx,yyy,".

It's unclear to me what you are actually trying to do, or why you would think that @IF would know what a nested function was doing.
 

Similar threads

Back
Top