If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

JavaScript highlighter doesn't handle quotes in regexes

RESOLVED INVALID

Status

Skywriter
Syntax Highlighting
RESOLVED INVALID
8 years ago
7 years ago

People

(Reporter: Kevin Dangoor, Assigned: pcwalton)

Tracking

0.7.0
x86
Mac OS X

Details

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
Created attachment 443071 [details] [diff] [review]
steglasi's patch for JS highlighter

From steglasi on the mailing list:

While I was working on my PHP Highlighter I noticed the javascript
highlighter was going a little nutty when it came across my regex's
that included quotes in them (thinking they were beginnings of
strings) or comments in cases where there were /* or // in it.

So I made a quick change to the javascript highlighter so it would
consider the regex a string when surrounded in forward slashes. You
can find the diff at the following url:

http://www.subpacket.com/bespin/diffs/javascript_regex.diff

This should be applied to bespinclient/plugins/supported/
javascript.js.

Hope this helps make things look a little nicer for those editing js!
(Reporter)

Comment 1

7 years ago
This is a diversion from pwalton's current work, but it's likely something that he can eyeball quickly to see if there are any issues.
Assignee: nobody → pwalton
(Reporter)

Comment 2

7 years ago
This particular fix is a bit *too* simple and will get tripped up on division. JavaScript's regex engine may not even offer a way to do this properly.

Punting for now... the parser-based syntax highlighter will likely do better here.
Target Milestone: 0.8 → ---
(Assignee)

Updated

7 years ago
Depends on: 553317
(Assignee)

Comment 3

7 years ago
Changeset 0c93a5cb0dba makes this a little better, by limiting the damage to the line with the regex.
(Reporter)

Comment 4

7 years ago
ACETRANSITION

The Skywriter project has merged with Ajax.org's Ace project (the full server part of which is their Cloud9 IDE project). Background on the change is here:

http://mozillalabs.com/skywriter/2011/01/18/mozilla-skywriter-has-been-merged-into-ace/

The bugs in the Skywriter product are not necessarily relevant for Ace and quite a bit of code has changed. For that reason, I'm closing all of these bugs. Problems that you have with Ace should be filed in the Ace issue tracker at GitHub:

https://github.com/ajaxorg/ace/issues
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.