yoya / js2-mode

Automatically exported from code.google.com/p/js2-mode
0 stars 0 forks source link

Mis-parses regular expression with a / inside a character class #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Here's the code:

    var patterns = {
        traditional:
/^(?:[A-Za-z0-9+/]{4})*[A-Za-z0-9+/]{2}(?:[A-Za-z0-9+/]{2}|[A-Za-z0-9+/]=|==)$/,
        urlSafe:    
/^(?:[A-Za-z0-9\-_]{4})*[A-Za-z0-9\-_]{2}(?:[A-Za-z0-9\-_]{2}|[A-Za-z0-9\-_]=|==
)$/
    };

The mis-highlighting begins at the / within the character class in the 
first pattern, which your parser interprets as the end of the pattern.  

The obvious work-around is to use new RegExp for patterns that contain
slashes, which is honestly a pretty good idea in the first place. 

This is Ubuntu 7.10 with the latest emacs-snapshot from
http://ppa.launchpad.net/avassalotti/ubuntu.

(defvar js2-mode-version 20080330
  "Release number for `js2-mode'.")

$ emacs --version
GNU Emacs 23.0.60.1
Copyright (C) 2008 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

$ uname -a
Linux demandred 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686
GNU/Linux

Original issue reported on code.google.com by ryandjoh...@gmail.com on 31 Mar 2008 at 8:31

GoogleCodeExporter commented 8 years ago
Cool!  You've found a bug in Mozilla Rhino's parser that I copied during my 
port. 
I'll report it over in Rhino-land and get it fixed here ASAP.

Original comment by steve.ye...@gmail.com on 14 Apr 2008 at 10:53

GoogleCodeExporter commented 8 years ago
This is fixed in the svn repository, and will be in the next release.

Original comment by steve.ye...@gmail.com on 14 Apr 2008 at 7:00

GoogleCodeExporter commented 8 years ago
It was great to hear back from you on this. Awesome that you're feeding it back 
into
Rhino. :-)

Original comment by ryandjoh...@gmail.com on 14 Apr 2008 at 8:11

GoogleCodeExporter commented 8 years ago

Original comment by steve.ye...@gmail.com on 16 Apr 2008 at 9:43

GoogleCodeExporter commented 8 years ago

Original comment by steve.ye...@gmail.com on 19 Apr 2008 at 10:52