scandum / tintin

TinTin++, aka tt++, is an extensible console MUD client.
https://tintin.mudhalla.net
GNU General Public License v3.0
204 stars 56 forks source link

#cursor get and curly braces #169

Closed nyankers closed 1 year ago

nyankers commented 1 year ago

Using #CURSOR GET has some odd behavior with curly braces. It basically seems like it's not escaping them, so when the variable is later used, they're treated as code braces rather than characters.

For example:

#macro {X} {
    #cursor {get} {t};
    #if {{$t} == {}} {
        #echo {nothing};
    };
    #else {
        #echo {something: %s} {$t};
    };
}

This throw error messages if the buffer contains { but will work if it contains other stuff, such as blah{.

The error message: #ERROR: GET BRACED ARGUMENT: UNMATCHED BRACE.

However, using it as an index to another variable (whether using $ or &), even blah{ will spam the above error message:

#var {lookup} {{a}{alpha}}
#macro {Z} {
    #cursor {get} {t};
    #echo {%s} {${lookup[$t]}};
}
scandum commented 1 year ago

Thanks, I added it to my todo list. Thought I had fixed it a while ago, but apparently not.

scandum commented 1 year ago

Should be fixed in yesterday's release. It goes through the generic escaping routine now, so ; and some other characters are escaped as well.