help-source-highlight
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-source-highlight] Highlighting regular expression literals in Java


From: gnombat
Subject: [Help-source-highlight] Highlighting regular expression literals in JavaScript code
Date: Thu, 09 Aug 2007 22:09:21 -0500
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

Source-highlight currently does not highlight JavaScript regular expression literals.

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:RegExp

I am wondering what would be the best way to highlight these? This is what I came up with:

include "c_comment.lang"

#
# Pattern for matching regular expression literals:
# The negative lookahead at the end protects against cases like this:
#   var foo = a / b;  /* foo is the quotient */
# Still fooled by things like this:
#   var foo = a / b / c;
#   var foo = a / f('foo/bar');
#
regexp = '/(\\.|[^\\/])+/(?![*/])'

include "number.lang"

include "c_string.lang"

keyword = "abstract|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|final|finally|for|function|goto|if|implements|in|instanceof|interface|native|new|null|private|protected|prototype|public|return|static|super|switch|synchronized|throw|throws|this|transient|true|try|typeof|var|volatile|while|with"

include "symbols.lang"

cbracket = "{|}"

include "function.lang"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]