|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Thu Jul 15, 2010 10:43 am
Quote character |
The handling of the quote character seems a bit mixed up.
I've changed the quote character to something more useful for me. According to the help, this should only affect what I type at the command line.. but!
In the pattern wizard, it recognizes the "new" quote character and not the old one.
Even worse, the trigger matches using the "new" quote character (and not the old)! This I think must be a bug.
The strange thing is.. The "regex" display in the pattern wizard and the regex converter in the trigger editor behave correctly, ie they translate "~" to "\", and not my new quote character. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 15, 2010 4:41 pm |
No, the help file is wrong. I just noticed the same help topic when I was writing the TeSSH help files yesterday.
The quote character is used *everywhere*. Not just the command line, but in all of your scripts too. So the pattern wizard *should* use your new quote character. If there is a place where it still uses ~ instead, give more specific details.
And yes, Regular Expressions are completely different and only use the \ character for escaping and this cannot be changed. But when using the pattern wizard, CMUD should convert your zScript quote character into the \ regex character. |
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Thu Jul 15, 2010 4:54 pm |
Ok, so again my bug is reversed.
The regex display at the bottom of the pattern wizard, and the convert to regexp button in the settings editor both use ~ and not the character I've chosen. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Jul 15, 2010 6:30 pm |
You misunderstood Zugg's comment about the quote character in regex. The quote character in regex is always the backslash, \. Cmud will convert whatever quote character you choose for zscript into the backslash used by regex when it translates it. If you change the quote character from ~ to something else for your zscripts, then use a ~ within your script, the regex translation will also use a ~ because the ~ is no longer a special character in zscript.
Or am I misunderstanding and you are doing something else? |
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Thu Jul 15, 2010 7:54 pm |
You are both misunderstanding.
Let's say I want to match a *.. So with the default settings, I use "~*", and it works. If I convert it to regexp, it becomes "\*" which is correct.
If I change my quote character to "¬", the cmud pattern to match a * would change from "~*" to "¬*".
The bug, I think is that when I now convert the pattern to regexp, instead of "¬*" becoming "\*", it becomes "¬.*".
"~*" still becomes "\*".
So.. The regexp conversion ignores the change of quote char. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Jul 15, 2010 8:31 pm |
Perhaps the problem is using that specific character. It's not an ASCII character--perhaps that is causing problems. I just tried it with a quote character of "_" and it work fine.
|
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Thu Jul 15, 2010 11:46 pm |
No, it does it whichever character I choose. But. I created a new session, and it does work correctly there. So must be some strange setting or corruption somewhere in my files.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jul 16, 2010 1:55 pm |
I'm reaching now, but...does the session you have problems with contain multiple windows?
|
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Fri Jul 16, 2010 6:40 pm |
Rahab wrote: |
I'm reaching now, but...does the session you have problems with contain multiple windows? |
No.. Why? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Jul 16, 2010 10:44 pm |
The special characters are window-specific.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Sat Jul 24, 2010 1:52 pm |
I think there must definitely be a bug somewhere relating to the special characters. It's using my changed command character in the script editor! The help clearly says "These changes only effect the scripts entered on the command line."
I changed the character from # to ` some time ago for a particular window but didn't actually use any commands in scripts in that window, until now.
"#print test"
is compiling to
0000 STR '#print test'
0020 SEND
while "`print test" is compiling to
0000 STR 'test'
0012 CMD print (1)
|
|
|
|
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Sat Jul 24, 2010 4:47 pm |
Zugg wrote: |
No, the help file is wrong. I just noticed the same help topic when I was writing the TeSSH help files yesterday.
The quote character is used *everywhere*. Not just the command line, but in all of your scripts too. So the pattern wizard *should* use your new quote character. If there is a place where it still uses ~ instead, give more specific details.
And yes, Regular Expressions are completely different and only use the \ character for escaping and this cannot be changed. But when using the pattern wizard, CMUD should convert your zScript quote character into the \ regex character. |
|
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Mon Jul 26, 2010 2:01 pm |
GeneralStonewall wrote: |
... |
That is the quote character.. I am now talking about the command character, default of #.
Perhaps I should have created a new thread about it? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jul 26, 2010 5:32 pm |
ALL special characters changes are used EVERYWHERE in CMUD. If you change the command character from # to something else, then it will effect the command line, the script editor, and any other place the command character is used.
The documentation about "changes only effect scripts entered on the command line" is wrong. Not just for the quote character. And each window can have it's own special character settings.
So it is working as designed. If you changed it from # to ` in a particular window, then you need to use ` for any scripts in that window. |
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Mon Jul 26, 2010 6:11 pm |
Ahh.. Ouch
|
|
|
|
|
|