Created
January 10, 2017 13:39
-
-
Save maxgorovenko/6567faef9a274a56f1d9bb7ca17e7438 to your computer and use it in GitHub Desktop.
React JS syntax highlight definition for Atlassian Fisheye and Crucible. Save the file in <FISHEYE_INST>/syntax and update <FISHEYE_INST>/syntax/filemap to reactjs file extensions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntaxdef react { | |
/\s+/m : ; | |
/(abstract|b(oolean|reak|yte)|c(a(se|tch)|har|lass|on(st|tinue))\ | |
|d(e(fault|lete)|o(|uble))|e(lse|x(tends|port))|f(alse|inal(|ly)|loat|or|unction)|goto\ | |
|i(f|mp(lements|ort)|n(stanceof|t(|erface)))|long|n(ative|ew|ull)\ | |
|p(ackage|r(ivate|otected)|ublic)|return|s(hort|tatic|uper|witch|ynchronized)\ | |
|t(h(is|row(|s))|r(ansient|ue|y))|undefined|v(ar|o(id|latile))|w(ith|hile))\b/ : { | |
region { | |
type=keyword; | |
index=word; | |
} | |
} | |
/[\p{L}_\$][\p{L}\p{N}_\$]*/ : { | |
region { | |
type=identifier; | |
index=word; | |
} | |
} | |
# string literals | |
/"/ : { | |
context { | |
/\\"/: ; | |
/\\./: ; | |
/$/m : exit; | |
"\"" : exit; | |
} | |
region ${ALL} { | |
type=string; | |
} | |
} | |
/ < | |
([%@!?=$\s]+)? # leading punctuation (opt) | |
([\p{N}\p{L}._:-]+ ) # tag name | |
/mx : { | |
context { #context for matching attributes | |
/ | |
([%@!?$\s]+)? # trailing punctuation (opt) | |
(\/\s*)? # trailing slash (opt) | |
> # closing angle brackets | |
/mx : exit; | |
/ | |
([\p{N}\p{L}._:-]+) # attribute name | |
\s*=\s* # equals | |
(\{\s?\{[^\{\}]*\}\s?\}) # {{..}} | |
/mx : { | |
region ${1} { | |
type=attrib; | |
} | |
region ${2} { | |
type=symbol; | |
} | |
} | |
/ | |
([\p{N}\p{L}._:-]+) # attribute name | |
\s*=\s* # equals | |
(\{[^\{\}]*\}) # {..} | |
/mx : { | |
region ${1} { | |
type=attrib; | |
} | |
region ${2} { | |
type=symbol; | |
} | |
} | |
/ | |
([\p{N}\p{L}._:-]+) # attribute name | |
\s*=\s* # equals | |
("[^"]*?"|'[^']*?'|[^\{\}\s>]+) # attribute data - should consume '>' if encountered inside " or ' | |
/mx : { | |
region ${1} { | |
type=attrib; | |
} | |
region ${2} { | |
type=string; | |
findlinks=true; | |
} | |
} | |
} | |
region ${ALL} { | |
type=starttag; | |
} | |
} | |
/ <\/ | |
([%@!?=$\s]+)? # leading punctuation (opt) | |
([\p{N}\p{L}._:-]+) # tag name | |
([%@!?=$\s]+)? # trailing punctuation (opt) | |
(\/\s*)? # trailing slash (opt) | |
> /mx : { | |
region { | |
type=endtag; | |
} | |
} | |
# char literal | |
/'/ : { | |
context { | |
/\\./: ; | |
/$/m : exit; | |
"'" : exit; | |
} | |
region ${ALL} { | |
type=char_literal; | |
} | |
} | |
/\/\/.*$/m : { | |
todo(${0}); | |
region { | |
type=comment; | |
index=prose; | |
findlinks=true; | |
} | |
} | |
/(0x[0-9a-f]+l?)|([0-9]+(\.[0-9]*)?|\.[0-9]+)(e(\+|-)?[0-9]+)?(f|l|d)?/i : { | |
region { | |
type=numeric; | |
} | |
} | |
/\/\*(.*?)\*\//s : { | |
todo(${1}); | |
region { | |
type=comment; | |
findlinks=true; | |
} | |
region ${1} { | |
index=prose; | |
} | |
} | |
context todo { | |
/(?i)todo\s.*/ : { | |
region { | |
type=todo; | |
} | |
} | |
} | |
# regex | |
/ | |
\/ | |
([^\n\r*\\\/]|\\[^\r\n])# RegularExpressionFirstChar | |
/x : { | |
context { # RegularExpresionChar* | |
/\\[^\r\n]/ : ; | |
/\// : exit; | |
/[\r\n]/ : exit; # for safety | |
} | |
region ${ALL} { | |
type=string; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment