NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
highlighting quotation mark(s) in javascript regexps
Veteran

Joined: 22 Feb 2006
Posts: 106
Reply with quote
There's a bug in the syntax colorization for javascript.

Here's the sample code to replicate the problem :

Code:
text = text.replace(/\'/g,'''); // 39 27


The algorithm used by PhpEd doesn't take into account the backslash symbol which escapes the quote and thus highlights '/g' as a string instead of '''

Thanks for fixing it Smile
View user's profileFind all posts by medifirstSend private message
Veteran

Joined: 22 Feb 2006
Posts: 106
Reply with quote
My previous post doesn't display as expected.


There's a bug in the syntax colorization for javascript.

Here's the sample code to replicate the problem :

Code:
text = text.replace(/\'/g,'&#39'); // 39 27


The algorithm used by PhpEd doesn't take into account the backslash symbol which escapes the quote and thus highlights '/g' as a string instead of '&#39'

Thanks for fixing it
Smile
View user's profileFind all posts by medifirstSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
I'm not sure if this can be solved at all...
If we change highlighter and it starts recognizing everything between / and / as a regexp, it will fail in many other cases, for example:

i = 5;
a = 8/4 + 55/i;

From the highlighter's perspectives /4 + 55/i will look like a regexp, whereas it is certainly not.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 22 Feb 2006
Posts: 106
Reply with quote
Hi Dmitri,

I'm glad to see that you're back from holidays and thanks for your answer.

To answer your remark, I'd say that I don't want the highlighter to recognize the regular expression between the '/', but rather not to recognize the backslash + quote as a string start, since the backslash is here to protect the quote...

What do u think ?
View user's profileFind all posts by medifirstSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
I think it's much easier Smile

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
highlighting quotation mark(s) in javascript regexps
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
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic