Shoutbox

Script Editor Colouring - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! Bug Reports (/forumdisplay.php?fid=7)
+----- Thread: Script Editor Colouring (/showthread.php?tid=70138)

Script Editor Colouring by phalanxii on 01-01-2007 at 06:24 AM

This a very minor "visual" bug that doesn't affect the function of MP!L at all.

The colouring in the script editor becomes confused when using quotation marks are used in regular expressions. According to MSDN, the quotation mark character in a regular expression is not a special character (but rather a literal character). This means that a quotation mark in a regular expression literally matches a quotation mark, as opposed to a string.

The script editor colouring however gets confused and colours it as the beginning of a string. For example:

code:
Debug.Trace(/"/.test("\""));
The script debugging shows no errors (and displays True), so I'm fairly sure that there's no problem with the syntax.

Thanks for your attention. (Y)
RE: Script Editor Colouring by deAd on 01-01-2007 at 07:45 PM

On the topic of syntax highlighting, block comments (/* */) aren't green. :sad:


RE: Script Editor Colouring by CookieRevised on 01-01-2007 at 08:08 PM

quote:
Originally posted by deAd
On the topic of syntax highlighting, block comments (/* */) aren't green. :sad:
This is known. It is also used by some developpers especially because of that.

RE: Script Editor Colouring by phalanxii on 01-30-2007 at 11:08 AM

Another script editor colouring bug:

code:
Debug.Trace("\\\"");
It appears that the editor takes the apostrophe as part of the string if there is a backslash before it ("\"" resulting in "), unless there is another backslash before that backslash ("\\" resulting in \). However, as seen above, it doesn't take into account a third back slash ("\\\"" resulting in \").
RE: Script Editor Colouring by CookieRevised on 01-30-2007 at 11:35 PM

quote:
Originally posted by phalanxii
Another script editor colouring bug:
code:
Debug.Trace("\\\"");
It appears that the editor takes the apostrophe as part of the string if there is a backslash before it ("\"" resulting in "), unless there is another backslash before that backslash ("\\" resulting in \). However, as seen above, it doesn't take into account a third back slash ("\\\"" resulting in \").
That is not a bug and is actually as it should be...

Backslashes are special escape characters which tell JScript that a literal character is following. Such an 'escape character' or 'metacharacter' is needed if you want to use special characters like \ and " in a string.

\\ will result in the character \
\" will result in the character "
\n will result in a new line character
\x50 will result in the character with hexadecimal code 0x50
etc...

This is the same in many more languages too...

See JScript documentation.
RE: Script Editor Colouring by ddunk on 01-30-2007 at 11:39 PM

quote:
Originally posted by CookieRevised
quote:
Originally posted by phalanxii
Another script editor colouring bug:
code:
Debug.Trace("\\\"");
It appears that the editor takes the apostrophe as part of the string if there is a backslash before it ("\"" resulting in "), unless there is another backslash before that backslash ("\\" resulting in \). However, as seen above, it doesn't take into account a third back slash ("\\\"" resulting in \").
That is not a bug and is actually as it should be...

Backslashes are special escape characters which tell JScript that a literal character is folowing. Such an 'escape character' is needed if you want to use special characters like \ and " in a string.

\\ will result in the character \
\" will result in the character "
\x50 will result in the character with hexadecimal code 0x50
etc...

This is the same in many more languages too...
In that case, shouldn't it be:

open string (")
escape a \ (\\)
escape a " (\")
close string (")
?

And therefore the original poster is correct in saying there is an error?

RE: Script Editor Colouring by CookieRevised on 01-30-2007 at 11:43 PM

quote:
Originally posted by ddunk
In that case, shouldn't it be:

open string (")
escape a \ (\\)
escape a " (\")
close string (")
?

And therefore the original poster is correct in saying there is an error?
It _is _
open string (")
escape a \ (\\)
escape a " (\")
close string (")


There is a coloring error in the editor yes, but there isn't an error in the output or whatever else, which is what I've replied upon because this isn't clear in his post... and apparently also not in my post, sorry...
RE: Script Editor Colouring by phalanxii on 01-31-2007 at 04:40 AM

Yes, I was talking strictly about the script colouring. Sorry about any confusion, I just wanted to comment on the nature of the bug.