Lorenzo Bettini wrote:
[email protected] wrote:
include "c_comment.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"

(symbol,normal,symbol) = `(\+\+|--|\)|\])(\s*)(/=?(?![*/]))`
(number,normal,symbol) =
`(0x[[:xdigit:]]+|(?:[[:digit:]]*\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?)(\s*)(/(?![*/]))`
(normal,symbol) = `([[:alpha:]$_][[:alnum:]$_]*\s*)(/=?(?![*/]))`

regexp = '/(\\.|[^*\\/])(\\.|[^\\/])*/[gim]*'

include "number.lang"

include "c_string.lang"

include "symbols.lang"

cbracket = "{|}"

include "function.lang"


Actually it works also this way, and it reuses most of java.lang (see the attached file);

what do you think?

The keyword definition has to occur before the definitions with the division operator in order to correctly match things like this:

/* unusual, but valid JavaScript */
throw /foo/;

/* this is more likely to occur in practice */
function f() {
  return /foo/;
}

/* or this */
function g(bar) {
  return /foo/.test(bar);
}


_______________________________________________
Help-source-highlight mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-source-highlight

Reply via email to