79 lines
3.5 KiB
YAML
79 lines
3.5 KiB
YAML
# JavaScript syntax file for Diffuse
|
|
# Copyright (C) 2008-2009 Derrick Moser <derrick_moser@yahoo.com>
|
|
syntax JavaScript normal text
|
|
syntax_files JavaScript '\.js$'
|
|
|
|
# colours
|
|
colour javascript_comment 0.2 0.4 0.64
|
|
colour javascript_fixme 1.0 0.5 0.0
|
|
colour javascript_import 0.46 0.31 0.48
|
|
colour javascript_keyword 0.77 0.63 0.0
|
|
colour javascript_type 0.3 0.6 0.02
|
|
colour javascript_regex 0.8 0.0 0.0
|
|
colour javascript_regexsep 0.77 0.63 0.0
|
|
colour javascript_literal 1.0 0.2 0.8
|
|
colour javascript_string 0.8 0.0 0.0
|
|
colour javascript_escapedchar 0.46 0.31 0.48
|
|
colour javascript_punctuation 0.5 0.5 0.5
|
|
|
|
# whitespace
|
|
syntax_pattern normal normal text '[ \t\r\n]+'
|
|
syntax_pattern expr expr text '[ \t\r\n]+'
|
|
|
|
# C++ style comments
|
|
syntax_pattern normal cpp_comment javascript_comment '//'
|
|
syntax_pattern expr cpp_comment javascript_comment '//'
|
|
syntax_pattern cpp_comment normal javascript_comment '(\r\n|\r|\n)$'
|
|
syntax_pattern cpp_comment cpp_comment javascript_comment '\\(\r\n|\r|\n)$'
|
|
syntax_pattern cpp_comment cpp_comment javascript_fixme '\b(TODO|FIXME|XXX)\b'
|
|
syntax_pattern cpp_comment cpp_comment javascript_comment '.[^\\TFX\r\n]*'
|
|
|
|
# C style comments
|
|
syntax_pattern normal comment javascript_comment '/\*'
|
|
syntax_pattern expr comment javascript_comment '/\*'
|
|
syntax_pattern comment normal javascript_comment '\*/'
|
|
syntax_pattern comment comment javascript_fixme '\b(TODO|FIXME|XXX)\b'
|
|
syntax_pattern comment comment javascript_comment '.[^\*TFX]*'
|
|
|
|
# char
|
|
syntax_pattern normal char javascript_string "'"
|
|
syntax_pattern char char javascript_escapedchar '(\\([0-7]{1,3}|u[0-9a-f]{1,4}|.))+' ignorecase
|
|
syntax_pattern char expr javascript_string "'"
|
|
syntax_pattern char char javascript_string ".[^\\\\']*"
|
|
|
|
# string
|
|
syntax_pattern normal string javascript_string '"'
|
|
syntax_pattern string string javascript_escapedchar '(\\([0-7]{1,3}|u[0-9a-f]{1,4}|.))+' ignorecase
|
|
syntax_pattern string expr javascript_string '"'
|
|
syntax_pattern string string javascript_string '.[^\\"]*'
|
|
|
|
# literals
|
|
syntax_pattern normal expr javascript_literal '(0x[0-9a-f]+|0[0-7]+|((0|[1-9][0-9]*)(\.[0-9]*)?|\.[0-9]+)(e[\+\-]?[0-9]+)?)' ignorecase
|
|
syntax_pattern normal expr javascript_literal '\b(true|false|Infinity|NaN|null|undefined)\b'
|
|
|
|
# import keywords
|
|
syntax_pattern normal normal javascript_import '\b(import|package)\b'
|
|
|
|
# typing keywords
|
|
syntax_pattern normal normal javascript_type '\b(abstract|boolean|byte|char|class|const|double|enum|export|float|function|int|interface|long|native|private|protected|public|short|static|synchronized|transient|var|void|volatile)\b'
|
|
|
|
# keywords
|
|
syntax_pattern normal normal javascript_keyword '\b(break|case|catch|continue|debugger|default|delete|do|else|extends|final|finally|for|goto|if|implements|in|instanceof|new|return|switch|throw|throws|try|typeof|while|with)\b'
|
|
syntax_pattern normal expr javascript_keyword '\b(super|this)\b'
|
|
|
|
# regular expressions
|
|
syntax_pattern normal regex javascript_regexsep '/'
|
|
syntax_pattern regex expr javascript_regexsep '/[gim]*'
|
|
syntax_pattern regex regex javascript_escapedchar '\\(c.|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{1,4}|.)'
|
|
syntax_pattern regex regex javascript_regex '.[^\\/]*'
|
|
|
|
# punctuation
|
|
syntax_pattern normal normal javascript_punctuation '[\^\*%~!\+\-=\|\&\(\{\[:;,\?\<\>\}]+'
|
|
syntax_pattern normal normal javascript_punctuation '\.'
|
|
syntax_pattern normal expr javascript_punctuation '[\)\]]+'
|
|
syntax_pattern expr normal javascript_punctuation '/'
|
|
|
|
# parsing optimisation
|
|
syntax_pattern normal expr text '[\$a-z_][\$a-z_0-9]*' ignorecase
|
|
syntax_pattern expr normal javascript_punctuation ''
|