diff --git a/.gitmodules b/.gitmodules index c8ad56c4..805286af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -75,4 +75,7 @@ url = https://github.com/SublimeHaskell/SublimeHaskell [submodule "assets/syntaxes/Dart"] path = assets/syntaxes/Dart - url = https://github.com/guillermooo/dart-sublime-bundle \ No newline at end of file + url = https://github.com/guillermooo/dart-sublime-bundle +[submodule "assets/syntaxes/FSharp"] + path = assets/syntaxes/FSharp + url = https://github.com/hoest/sublimetext-fsharp diff --git a/assets/syntaxes/FSharp b/assets/syntaxes/FSharp new file mode 160000 index 00000000..da846f42 --- /dev/null +++ b/assets/syntaxes/FSharp @@ -0,0 +1 @@ +Subproject commit da846f42279d4b3293d0f08fd7b7f5d3c933ac13 diff --git a/assets/syntaxes/FSharp.sublime-syntax b/assets/syntaxes/FSharp.sublime-syntax new file mode 100644 index 00000000..5428f156 --- /dev/null +++ b/assets/syntaxes/FSharp.sublime-syntax @@ -0,0 +1,234 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: "F#" +file_extensions: + - fs + - fsi + - fsx +scope: source.fsharp +contexts: + main: + - include: comments + - include: constants + - include: structure + - include: attributes + - include: strings + - include: definition + - include: method_calls + - include: modules + - include: anonymous_functions + - include: keywords + anonymous_functions: + - match: \b(fun)\b + captures: + 1: keyword.other.function-definition.fsharp + push: + - meta_scope: meta.function.anonymous + - match: (->) + captures: + 1: keyword.other.fsharp + pop: true + - include: variables + attributes: + - match: '\[\<' + push: + - meta_scope: support.function.attribute.fsharp + - match: '\>\]' + pop: true + - include: main + characters: + - match: (') + captures: + 1: punctuation.definition.string.begin.fsharp + push: + - meta_scope: string.quoted.single.fsharp + - match: (') + captures: + 1: punctuation.definition.string.end.fsharp + pop: true + - match: '\\$[ \t]*' + scope: punctuation.separator.string.ignore-eol.fsharp + - match: '\\([\\""ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})' + scope: constant.character.string.escape.fsharp + - match: '\\(?![\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8}).' + scope: invalid.illeagal.character.string.fsharp + comments: + - match: \(\*\*?(\*)\) + scope: comment.block.fsharp + captures: + 1: comment.block.empty.fsharp + - match: '\(\*[^\)]' + push: + - meta_scope: comment.block.fsharp + - match: \*\) + pop: true + - include: comments + - match: //.*$ + scope: comment.line.double-slash.fsharp + constants: + - match: \(\) + scope: constant.language.unit.fsharp + - match: '\b-?[0-9][0-9_]*((\.([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))' + scope: constant.numeric.floating-point.fsharp + - match: '\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))' + scope: constant.numeric.integer.nativeint.fsharp + definition: + - match: '\b(val|val|let|and|member|override|use)\s?(rec|inline|mutable)?(\s+\(?([a-zA-Z.\|_][a-zA-Z0-9.|_]*)\)?\w*)\b' + captures: + 1: keyword.other.binding.fsharp + 2: keyword.other.function-recursive.fsharp + 3: variable.other.binding.fsharp + push: + - meta_scope: meta.binding.fsharp + - match: "=|$" + captures: + 1: punctuation.separator.function.type-constraint.fsharp + pop: true + - include: variables + - match: \b(let)\s+((\(\))|(_))\s+= + scope: meta.expression.fsharp + captures: + 1: keyword.other.binding.fsharp + 2: keyword.other.function-recursive.fsharp + 4: constant.language.unit.fsharp + 5: constant.language.ignored.fsharp + keywords: + - match: ^\s*#\s*(light|if|else|endif|r|I|load|time|help|quit)\b + push: + - meta_scope: meta.preprocessor.fsharp + - match: (\s|$) + pop: true + - match: \b(new|in|as|if|then|else|elif|for|begin|end|match|with|type|inherit|true|false|null|do)\b + scope: keyword.other.fsharp + - match: '(\|>|\|?>|\->|\<\-|:>|:|\[|\]|\;|\||_)' + scope: entity.name + method_calls: + - match: '(?