TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

#parse behaves poorly when passed a list

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
moebius



Joined: 27 Jan 2005
Posts: 96

PostPosted: Wed Nov 12, 2008 12:39 am    Post subject: #parse behaves poorly when passed a list Reply with quote

The #parse function does not behave well when you give it a list:

Code:
#parse {{a b c}} { }
#Unmatched braces error!
#OK. VARIABLE {parse} HAS BEEN SET TO {{}}.
#OK. VARIABLE {parse} HAS BEEN SET TO {a}.
#OK. VARIABLE {parse} HAS BEEN SET TO { }.
#OK. VARIABLE {parse} HAS BEEN SET TO {b}.
#OK. VARIABLE {parse} HAS BEEN SET TO { }.
#OK. VARIABLE {parse} HAS BEEN SET TO {c}.
#OK. VARIABLE {parse} HAS BEEN SET TO {}.


Is there an expected behavior in this case? Two suggested possibilities: 1) flatten the list (e.g. parse the concatenation of all elements) or 2) parse the first simple element

Whatever it is, it should at least not give an error.
_________________
StrangeMUD - strangemud.net:9332
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3857

PostPosted: Wed Nov 12, 2008 9:05 am    Post subject: Reply with quote

I'd say the error is correct because tintin doesn't handle unexpected braces well.

If you want to parse a list you could try using:

Code:

#forall {{a b c} {d e f}} {#parse {&0} {#showme &0:(&&0)}
Back to top
View user's profile Send private message Send e-mail
moebius



Joined: 27 Jan 2005
Posts: 96

PostPosted: Wed Nov 12, 2008 10:57 am    Post subject: Reply with quote

Hmm, that may be a good solution.

Still, though, "Unmatched braces" is a misleading error message. Perhaps it should be something like "list found when plain value expected" or something of that nature.
_________________
StrangeMUD - strangemud.net:9332
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3857

PostPosted: Wed Nov 12, 2008 1:36 pm    Post subject: Reply with quote

The error message is from the #variable {parse} {{} call.

I guess I could get rid of setting the parse variable so people can only use &0, given it doesn't really add functionality.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group