1
0
mirror of https://github.com/cmur2/joe-syntax.git synced 2024-10-31 14:56:16 +01:00
joe-syntax/js.jsf

514 lines
8.6 KiB
Plaintext
Raw Normal View History

# JOE syntax highlight file for JavaScript
2014-08-29 22:28:56 +02:00
# Define colors
2014-08-29 22:28:56 +02:00
=Idle
=Comment green
=CommentLabel bold green
=Constant cyan
2014-08-29 22:28:56 +02:00
=String cyan
=StringEscape bold cyan
=Regexp cyan
=RegexpEscape bold cyan
=RegexpOptions cyan
=Number cyan
=Type bold
2014-08-29 22:28:56 +02:00
=CustomType
=Keyword bold
2014-08-29 22:28:56 +02:00
=Global bold
=Exports
=ExportItem
=Operator bold
=Bad inverse bold red
=Brace magenta
2014-08-29 22:28:56 +02:00
=Assign bold
=Paren
=Bracket
=Semicolon
=Comma
=PropSep
=Syntax
=Ident
=Method
# from html.jsf to support embedded languages
=TagEdge green
:begin Idle
2014-08-29 22:28:56 +02:00
* begin noeat call=.js()
.subr js
:idle Idle
2014-08-29 22:28:56 +02:00
* idle
2014-09-13 21:38:41 +02:00
"/" re_or_comment recolor=-1
2014-08-29 22:28:56 +02:00
"0" first_digit recolor=-1
"1-9" decimal recolor=-1
"." maybe_float
"\"" string recolor=-1 save_c
"'" string recolor=-1 save_c
"A-Z" type_match mark buffer recolor=-1
"$a-z_" ident mark buffer recolor=-1
"{}" brace recolor=-1
"()" paren noeat recolor=-1
";" semicolon recolor=-1
"," comma recolor=-1
"=" assign_maybe recolor=-1
"[]" bracket noeat recolor=-1
"\-" subtract recolor=-1
"+" add recolor=-1
"*|&^%" mutate_maybe recolor=-1
":?~" syntax recolor=-1
.ifdef html
2014-08-29 22:28:56 +02:00
"<" maybe_done recolor=-1
">!" eqmixer_maybe recolor=-1
.else
.ifdef php
2014-08-29 22:28:56 +02:00
"<" maybe_done recolor=-1
">!" eqmixer_maybe recolor=-1
.else
2014-08-29 22:28:56 +02:00
.ifdef mason
"<" maybe_done recolor=-1
">!" eqmixer_maybe recolor=-1
.else
"<>!" eqmixer_maybe recolor=-1
.endif
.endif
.endif
2014-08-29 22:28:56 +02:00
:subtract Assign
* mutate_maybe noeat
"\-" assign recolor=-2
:add Assign
* mutate_maybe noeat
"+" assign recolor=-2
:mutate_maybe Assign
* syntax recolor=-2 noeat
"=" assign recolor=-2
:syntax Syntax
* idle recolor=-1 noeat
:assign Assign
* idle recolor=-1 noeat
:eqmixer_maybe Syntax
* idle recolor=-1 noeat
"=" eqmixer_maybe
:assign_maybe Assign
* idle recolor=-1 noeat
"=" equality recolor=-2
:equality Syntax
* idle recolor=-1 noeat
"=" syntax
:maybe_done TagEdge
2014-08-29 22:28:56 +02:00
* eqmixer_maybe noeat
"/" idle noeat return recolor=-2
.ifdef php
2014-08-29 22:28:56 +02:00
"?" rtn_embed call=php.php()
.endif
.ifdef mason
"&%" rtn_embed call=perl.perl()
.endif
2014-08-29 22:28:56 +02:00
:rtn_embed TagEdge
* idle noeat
:no_regex Idle
* idle noeat
"/" maybe_comment recolor=-1
" " no_regex
:after_term Idle
* after_term
"\n" idle
"/" maybe_comment recolor=-1
"." prop_sep recolor=-1
"a-z" infix_operator buffer recolor=-1
"\"'A-Z_0-9" bad_after_term recolor=-1
"{}" brace recolor=-1
"()" paren noeat recolor=-1
";" semicolon recolor=-1
"=" assign_maybe recolor=-1
"," comma recolor=-1
"[]" bracket noeat recolor=-1
"\-" subtract recolor=-1
"+" add recolor=-1
"*|&^%" mutate_maybe recolor=-1
":?~" syntax recolor=-1
.ifdef html
"<" maybe_done recolor=-1
">!" eqmixer_maybe recolor=-1
.else
.ifdef php
"<" maybe_done recolor=-1
">!" eqmixer_maybe recolor=-1
.else
.ifdef mason
"<" maybe_done recolor=-1
">!" eqmixer_maybe recolor=-1
.else
"<>!" eqmixer_maybe recolor=-1
.endif
.endif
.endif
2014-08-29 22:28:56 +02:00
:ident_only Idle
* bad_after_term recolor=-1
"A-Z" type_match mark buffer recolor=-1
"$a-z_" ident mark buffer recolor=-1
" \t" ident_only
"\n" idle
2014-08-29 22:28:56 +02:00
:bad_after_term Bad
* after_term noeat markend strings
done
"\"'" after_term
"a-zA-Z0-9_." bad_after_term
2014-09-13 21:38:41 +02:00
:re_or_comment Syntax
2014-08-29 22:28:56 +02:00
* regex recolor=-2
"*/" maybe_comment noeat
2014-08-29 22:28:56 +02:00
:maybe_comment Syntax
* syntax noeat
"*" comment recolor=-2
"/" line_comment recolor=-2
"=" assign recolor=-2
:comment Comment
2014-08-29 22:28:56 +02:00
* comment
# might be TODO label
2014-08-29 22:28:56 +02:00
"BFHNTX" comment noeat call=.comment_todo()
"*" maybe_end_comment
:maybe_end_comment Comment
2014-08-29 22:28:56 +02:00
* comment noeat
"/" idle
"*" maybe_end_comment
:line_comment Comment
2014-08-29 22:28:56 +02:00
* line_comment
# might be TODO label
2014-08-29 22:28:56 +02:00
"BFHNTX" line_comment noeat call=.comment_todo()
"\n" idle
2014-08-29 22:28:56 +02:00
:regex Regexp
* regex
"\\" regex_quote recolor=-1
"/" regex_mod
2014-08-29 22:28:56 +02:00
:regex_quote RegexpEscape
* regex
2014-08-29 22:28:56 +02:00
:regex_mod RegexpOptions
* after_term noeat
"igm" regex_mod
:brace Brace
* idle noeat
:paren Paren
"(" idle
")" no_regex
:bracket Bracket
"[" idle
"]" after_term
:syntax Syntax
* idle noeat
:comma Comma
* idle noeat
:semicolon Semicolon
* idle noeat
:first_digit Number
2014-08-29 22:28:56 +02:00
* after_term noeat
"xX" hex
"." float
"eE" epart
"0-7" octal
"89" bad_number recolor=-1
:bad_number Bad
2014-08-29 22:28:56 +02:00
* after_term noeat
"0-9" bad_number
:octal Number
2014-08-29 22:28:56 +02:00
* after_term noeat
"0-7" octal
"89" bad_number recolor=-1
:hex Number
2014-08-29 22:28:56 +02:00
* after_term noeat
"0-9A-Fa-f" hex
:decimal Number
2014-08-29 22:28:56 +02:00
* after_term noeat
"0-9" decimal
"eE" epart
"." float
:maybe_float Number
2014-08-29 22:28:56 +02:00
* prop_sep noeat recolor=-2
"0-9" float recolor=-2
:prop_sep PropSep
* ident_only noeat
:float Number
2014-08-29 22:28:56 +02:00
* after_term noeat
"eE" epart
"0-9" float
:epart Number
2014-08-29 22:28:56 +02:00
* after_term noeat
"0-9+\-" enum
:enum Number
2014-08-29 22:28:56 +02:00
* after_term noeat
"0-9" enum
:string String
* string_body noeat mark
:string_body String
* string
"\n" string_bad
& after_term
"\\" string_escape recolor=-1
:string_bad Bad
* string_bad
"\\" string_bad_escape
& after_term
:string_bad_escape Bad
* string_bad
:string_escape StringEscape
* string
"x" string_hex1
"0-7" string_octal2
"\n" string_bad noeat
:string_hex1 StringEscape
* string noeat
"0-9a-fA-F" string_hex2
:string_hex2 StringEscape
* string noeat
"0-9a-fA-F" string
:string_octal2 StringEscape
* string noeat
"0-7" string_octal3
:string_octal3 StringEscape
* string noeat
"0-7" string
:infix_operator Bad
* bad_op noeat markend strings
"in" operator
"instanceof" operator
done
2014-08-29 22:28:56 +02:00
"a-zA-Z0-9_" infix_operator
:bad_op Bad
2014-09-13 21:38:41 +02:00
* idle noeat
2014-08-29 22:28:56 +02:00
"a-zA-Z0-9_" bad_op
:operator Operator
* idle noeat
:type_match CustomType
* type_end noeat markend strings
"Infinity" lit
"NaN" lit
"Array" type
"ArrayBuffer" type
"Boolean" type
"DataView" type
"Date" type
"Error" type
"EvalError" type
"Function" type
"Float32Array" type
"Float64Array" type
"Int16Array" type
"Int32Array" type
"Int8Array" type
"JSON" type
"Math" type
"Number" type
"Object" type
"RangeError" type
"ReferenceError" type
"RegExp" type
"String" type
"SyntaxError" type
"TypeError" type
"Uint16Array" type
"Uint32Array" type
"Uint8Array" type
"Uint8ClampedArray" type
"URIError" type
# node.js
"Buffer" type
done
"a-zA-Z0-9_" type_match
:type_end Idle
* after_term noeat
" " type_end
"." prop_sep recolor=-1
:ident Ident
* ident_end noeat markend strings
"delete" operator
"in" operator
"instanceof" operator
"typeof" operator
"new" operator
"arguments" kw
"break" kw
"case" kw
"catch" kw
"continue" kw
"default" kw
"do" kw
"else" kw
"finally" kw
"for" kw
"function" kw
"if" kw
"let" kw
"return" kw
"switch" kw
"throw" kw
"try" kw
"var" kw
"void" kw
"while" kw
"with" kw
"false" lit
"null" lit
"true" lit
"const" global
"decodeURI" global
"decodeURIComponent" global
"encodeURI" global
"encodeURIComponent" global
"escape" global
"eval" global
"isFinite" global
"isNaN" global
"parseFloat" global
"parseInt" global
"undefined" global
"unescape" global
"setImmediate" global
"this" quasikw
"prototype" quasikw
# node.js
"exports" export
"module" global
"process" global
"global" global
"console" global
"setTimeout" global
"setInterval" global
"clearInterval" global
"clearTimeout" global
"require" quasikw
"__filename" quasikw
"__dirname" quasikw
# By convention...
"self" quasikw
done
"$a-zA-Z0-9_" ident
:ident_end Idle
* after_term noeat
" " ident_end
"." prop_sep recolor=-1
"(" method_start recolor=-1
:method_start Paren
* method_end noeat recolormark
:method_end Method
* idle noeat
:type Type
2014-08-29 22:28:56 +02:00
* after_term noeat
:kw Keyword
2014-08-29 22:28:56 +02:00
* idle noeat
:quasikw Keyword
* after_term noeat
:global Global
2014-08-29 22:28:56 +02:00
* after_term noeat
:export Exports
2014-08-29 22:28:56 +02:00
* export_end noeat
2014-08-29 22:28:56 +02:00
:export_end Exports
* after_term noeat
" " export_end
"." export_item_start
2014-08-29 22:28:56 +02:00
:export_item_start ExportItem
* bad_after_term recolor=-1 noeat
" " export_item_start
"a-zA-Z_" export_item
2014-08-29 22:28:56 +02:00
:export_item ExportItem
* after_term noeat
"a-zA-Z0-9_" export_item
:lit Constant
2014-09-13 21:38:41 +02:00
* lit_end noeat
2014-08-29 22:28:56 +02:00
:lit_end Constant
* after_term noeat
" " lit_end
"." prop_sep recolor=-1
.end
.subr comment_todo
# initial state
2014-09-13 21:38:41 +02:00
:todo_init Comment
* todo_guess buffer
# highlight common TODO labels
2014-09-13 21:38:41 +02:00
:todo_guess Comment
* todo_unknown noeat strings
"BUG" todo
"FIXME" todo
"HACK" todo
"NOTE" todo
"TODO" todo
"XXX" todo
done
2014-09-13 21:38:41 +02:00
"A-Z" todo_guess
2014-09-13 21:38:41 +02:00
:todo_unknown Comment
* NULL noeat return
2014-09-13 21:38:41 +02:00
:todo CommentLabel
* NULL noeat return
.end