Created
June 30, 2015 15:56
-
-
Save kimsk/358b4ba0c9cde1fcdd0c to your computer and use it in GitHub Desktop.
F# Syntax Highlighting for FishEye
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 fsharp { | |
/\s+/m : ; | |
# inline doc-comment | |
/\/\/\/(.*)$/m : { | |
doccomment(${1}); | |
region { | |
type=comment; | |
index=prose; | |
findlinks=true; | |
} | |
} | |
# multiline doc-comment | |
/\/\*\*(.*?)\*\//s : { | |
doccomment(${1}); | |
region { | |
type=comment; | |
index=prose; | |
findlinks=true; | |
} | |
} | |
context doccomment { | |
# find xml tag-like things | |
/ < \/? | |
([\p{N}\p{L}:_-]+) | |
((\s+[\p{N}\p{L}:_-]+((="[^"]*")|(=[^\s>]+))?)*) | |
\s* | |
\/? > | |
/mx : { | |
region { | |
type=commentmeta; | |
} | |
} | |
} | |
# inline comment | |
/\/\/.*$/m : { | |
region { | |
type=comment; | |
index=prose; | |
findlinks=true; | |
} | |
} | |
# multiline comment | |
/(\*(.*?)\*)/s : { | |
region { | |
type=comment; | |
index=prose; | |
findlinks=true; | |
} | |
} | |
# numeric | |
/(0x[0-9a-f]+l?)|([0-9]+(\.[0-9]*)?|\.[0-9]+)(e(\+|-)?[0-9]+)?(f|l|d)?/i : { | |
region { | |
type=numeric; | |
} | |
} | |
# string literal | |
/"/ : { | |
context { | |
/\\"/: ; | |
/\\./: ; | |
/$/m : exit; | |
"\"" : exit; | |
} | |
region ${ALL} { | |
type=string; | |
} | |
} | |
# verbatim string literal | |
/@"/ : { | |
context { | |
/"{2}/: ; | |
/\\./: ; | |
"\"" : exit; | |
} | |
region ${ALL} { | |
type=string; | |
} | |
} | |
# char literal | |
/'(\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\x[0-9a-fA-F]{1,4}|\\.|.)'/ : { | |
region { | |
type=char_literal; | |
} | |
region ${1} { | |
index=word; | |
} | |
} | |
# keywords | |
/(abstract|and|as|assert|base|begin|class|default|delegate|do|done\ | |
|downcast|downto|elif|else|end|exception|extern|false|finally|for\ | |
|fun|function|if|in|inherit|inline|interface|internal|lazy|let\ | |
|match|member|module|mutable|namespace|new|null|of|open|or\ | |
|override|private|public|rec|return|static|struct|then|to\ | |
|true|try|type|upcast|use|val|void|when|while|with|yield)\b/ : { | |
region { | |
type=keyword; | |
index=word; | |
} | |
} | |
# preprocessing directive | |
/^[^\r\n]*#[^\r\n]*(def(ault|ine)|e(l(if|se)|nd(if|region)|rror)|if|line|region|undef|warning).*$/m : { | |
region { | |
type=preprocessor; | |
index=prose; | |
} | |
} | |
# identifier | |
/[\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}_][\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}\p{Nd}\p{Pc}\p{Cf}]*/ : { | |
region { | |
type=identifier; | |
index=word; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions
fsharp.def
inFISHEYE_INST/syntax
directory.FISHEYE_HOME/filename.map
to yourFISHEYE_INST/syntax
directory and add the lines below to thefilename.map
fileReferences: