Monday, September 19, 2016

nano syntax highlighting for javascript ES2015/ES6 and Node.js

Not able to find an up-to-date nano syntax file for javascript and node.js, thus I manually modified an old version as below:

## BL's version for ES6 or ES2015
syntax "JavaScript" "\.js$"

color brightgreen  "\<[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\>"
color brightgreen  "\<[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
color brightgreen  "\<[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
color brightgreen  "\<(null|undefined|NaN|Infinity)\>"
color brightgreen  "\<(true|false)\>"
color cyan  "\<(break|case|catch|class|const|continue|debugger|default|delete|do|)\>"
color cyan  "\<(else|export|extends|finally|for|function|if|import|in|instanceof|new|return)\>"
color cyan  "\<(super|switch|this|throw|try|typeof|var|void|while|with|yield)\>"
color cyan  "\<(enum|implements|interface|let|package|private|protected|pubic|static)\>"
color cyan  "\<(async|await)\>"
color brightcyan "\<(global|process|console|setTimeout|clearTimeout|setInterval|clearInterval)\>"
color brightcyan "\<(module|exports|require)\>"
color brightcyan "\<(eval|uneval|isFinite|isNaN|parseFloat|parseInt|decodeURI)\>"
color brightcyan "\<(decodeURIComponent|encodeURI|encodeURIComponent)\>"
color brightcyan "\<(Array|Date|Math|Number|Object|String)\>"
color brightmagenta  "/[^*]([^/]|(\\/))*[^\\]/[gim]*"
color brightblack start="/\*" end="\*/"
color brightblack "//.*$"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color yellow start="`" end="`"

No comments:

Post a Comment