Re: regexp in javascript.lang (again)

Lorenzo Bettini <[email protected]> Tue, 02 Sep 2008 16:04:20 +0200
Newsgroups gmane.comp.gnu.source-highlight.general
Message-ID <[email protected]>
[email protected] wrote:
> I think the current regexp in javascript.lang matches too much:
> 
> regexp = '/(\\.|[^\\/])+/[gim]*(?![*/])'
> 
> This matches /* */ comments that do not span multiple lines.  (Note that 
> /* */ comments that do span multiple lines are highlighted correctly as 
> comments.)
> 
> I think this would fix the problem:
> 
> regexp = '/(\\.|[^*\\/])(\\.|[^\\/])*/[gim]*(?![*/])'
> 
> Does that seem reasonable? (aside from its increasing ugliness)
>

I think you're right!
and it's not that ugly after all :-)

-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net