regexp in javascript.lang (again)

View: New views
2 Messages — Rating Filter:   Alert me  

regexp in javascript.lang (again)

by gnombat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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)


_______________________________________________
Help-source-highlight mailing list
Help-source-highlight@...
http://lists.gnu.org/mailman/listinfo/help-source-highlight

Re: regexp in javascript.lang (again)

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

gnombat@... 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


_______________________________________________
Help-source-highlight mailing list
Help-source-highlight@...
http://lists.gnu.org/mailman/listinfo/help-source-highlight