About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Mondor
Novice


Joined: 26 Nov 2008
Posts: 33

PostPosted: Tue Dec 16, 2008 5:10 pm   

[3.03] Bug when using '?:' prior to '$var:' in regex trigger pattern
 
I think I have encountered this in earlier versions too. I was not able to find any earlier posts addressing this.

If I have a trigger pattern of the form
"He filed ($pronoun:this|that) bug with the (?:forum|circular file)...." then I am able to use $pronoun in my trigger script if the match occurred. The Trigger Tester shows that I've captured 'this' or 'that' in the $pronoun variable on a match and the trigger works as advertised.

If a ?: construct proceeds any $var: constructs in the pattern, the $var variables are not assigned on a match
"He filed (?:this|that) bug with the ($proper_channels:forum|circular file)...."
1) will show either 'forum' or 'circular file' assigned to %1, not $proper_channels in the Trigger Test on match.
2) the script will compile with no errors, BUT
3) $proper_channels will contain NULL (I think) when referenced by the trigger script

Thanks
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Dec 16, 2008 6:09 pm   
 
Looks like something is just counting parenthesis and not checking the the ?: for non-stored items. I've added this to the bug list.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Dec 17, 2008 6:00 pm   
 
Maybe it would be a good idea to connect the regex named capture syntax directly to local variables. The interface provides a complete list of the names when a regex is compiled, and named captures do not allow duplicate names by default.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Dec 17, 2008 6:03 pm   
 
That's how I thought I was doing it already, but I'll need to look at the code to see what is going wrong with this.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Dec 17, 2008 6:49 pm   
 
I never actually tested whether you connected the named captures since I didn't see anything in the version history indicating it. As far as I know the last interface bug involving named captures was found and fixed for 3.02. I doubt you could have properly connected them prior to that since I still hadn't gotten the interface that generates the full list of names perfected until then. I would have to dig through my list of change logs to be sure, but I don't think I added generation of a names list to the interface until 2.30.

Anyhow, the regex syntax for a name capture is "(?<name>pattern stuff)". This would add "name" to the list of names, and these are case sensitive even when the pattern is not; in fact the is no easy way to remove case sensitivity from the names. There are some other syntaxes supported for named captures, but the above is the Perl standard. The interface provides Names as a | seperated string list of each name. They are sorted into alphabetacal order. An asscoiated array of capture number is available if you want to use your own look up method or create a futher lookup table, otherwise the infterface will use the default binary tree search method when asked to retrieve a value for a named capture.
_________________
The only good questions are the ones we have never answered before.
Search the Forums

Last edited by Vijilante on Thu Dec 18, 2008 7:10 pm; edited 1 time in total
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Dec 17, 2008 10:39 pm   
 
Nope, I looked at the code and CMUD is pulling out the named patterns itself and ignoring the (?:). I'll add this to the bug list and try to use the named capture info returned by the regex routines themselves, or will just fix it so it handles the ?: stuff properly.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Dec 18, 2008 7:15 pm   
 
Sorry about any confusion, I forgot to disable HTML in my previous post so the forum was eating some stuff. It is corrected now.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net