Skip to content

Instantly share code, notes, and snippets.

@disktnk
Last active August 29, 2015 13:55
Show Gist options
  • Save disktnk/8756964 to your computer and use it in GitHub Desktop.
Save disktnk/8756964 to your computer and use it in GitHub Desktop.
F# Syntax on Sublime Text 2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>fs</string>
<string>fsi</string>
<string>fsx</string>
</array>
<key>foldingStartMarker</key>
<string></string>
<key>foldingStopMarker</key>
<string></string>
<key>name</key>
<string>F#</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
<dict>
<key>include</key>
<string>#constants</string>
</dict>
<dict>
<key>include</key>
<string>#structure</string>
</dict>
<dict>
<key>include</key>
<string>#attributes</string>
</dict>
<dict>
<key>include</key>
<string>#strings</string>
</dict>
<dict>
<key>include</key>
<string>#definition</string>
</dict>
<dict>
<key>include</key>
<string>#method_calls</string>
</dict>
<dict>
<key>include</key>
<string>#modules</string>
</dict>
<dict>
<key>include</key>
<string>#anonymous_functions</string>
</dict>
<dict>
<key>include</key>
<string>#keywords</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>anonymous_functions</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\b(fun)\b</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.function-definition.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(-&gt;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.fsharp</string>
</dict>
</dict>
<key>name</key>
<string>meta.function.anonymous</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#variables</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>attributes</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\[\&lt;</string>
<key>end</key>
<string>\&gt;\]</string>
<key>name</key>
<string>support.function.attribute.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>characters</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(')</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(')</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fsharp</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\$[ \t]*</string>
<key>name</key>
<string>punctuation.separator.string.ignore-eol.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\\([\\""ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})</string>
<key>name</key>
<string>constant.character.string.escape.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\\(?![\\'ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8}).</string>
<key>name</key>
<string>invalid.illeagal.character.string.fsharp</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>comments</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>comment.block.empty.fsharp</string>
</dict>
</dict>
<key>match</key>
<string>\(\*\*?(\*)\)</string>
<key>name</key>
<string>comment.block.fsharp</string>
</dict>
<dict>
<key>begin</key>
<string>\(\*[^\)]</string>
<key>end</key>
<string>\*\)</string>
<key>name</key>
<string>comment.block.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>//.*$</string>
<key>name</key>
<string>comment.line.double-slash.fsharp</string>
</dict>
</array>
</dict>
<key>constants</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\(\)</string>
<key>name</key>
<string>constant.language.unit.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\b-?[0-9][0-9_]*((\.([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))</string>
<key>name</key>
<string>constant.numeric.floating-point.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\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_]*)))</string>
<key>name</key>
<string>constant.numeric.integer.nativeint.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>'(.|\\(u\h{4}|U\h{8}|[bnrt'"\\]))'</string>
<key>name</key>
<string>constant.character.fsharp</string>
</dict>
</array>
</dict>
<key>definition</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\b(val|val|let|and|member|override|use)\s?(rec|inline|mutable)?(\s+\(?([a-zA-Z.\|_][a-zA-Z0-9.|_]*)\)?\w*)\b</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.binding.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.other.function-recursive.fsharp</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>variable.other.binding.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>=|$</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.function.type-constraint.fsharp</string>
</dict>
</dict>
<key>name</key>
<string>meta.binding.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#variables</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.binding.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.other.function-recursive.fsharp</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>constant.language.unit.fsharp</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>constant.language.ignored.fsharp</string>
</dict>
</dict>
<key>match</key>
<string>\b(let)\s+((\(\))|(_))\s+=</string>
<key>name</key>
<string>meta.expression.fsharp</string>
</dict>
</array>
</dict>
<key>keywords</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>^\s*#\s*(light|if|else|endif|r|I|load|time|help|quit)\b</string>
<key>end</key>
<string>(\s|$)</string>
<key>name</key>
<string>meta.preprocessor.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\b(new|in|as|if|then|else|elif|for|begin|end|match|with|type|inherit|true|false|null|do|of|yield)\b</string>
<key>name</key>
<string>keyword.other.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>(\|&gt;|\|?&gt;|\-&gt;|\&lt;\-|:&gt;|:|\[|\]|\;|\||_)</string>
<key>name</key>
<string>entity.name</string>
</dict>
</array>
</dict>
<key>method_calls</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>applyEndPatternLast</key>
<integer>1</integer>
<key>begin</key>
<string>(?&lt;!\w)([a-z]\w*)(\.)</string>
<key>end</key>
<string>(?=.)</string>
<key>name</key>
<string>meta.method-call.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.method-call.fsharp</string>
</dict>
</dict>
<key>match</key>
<string>[A-Z]\w*(\.)</string>
<key>name</key>
<string>meta.method.fsharp</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>modules</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\b(namespace|module)\s+([a-zA-Z][a-zA-Z0-9'_.]*)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.section.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(\s|$)</string>
<key>name</key>
<string>meta.module.namespace.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.module-reference.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</dict>
<key>match</key>
<string>(\.)([A-Z][a-zA-Z0-9'_]*)</string>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>\b(open)\s+([A-Z][a-zA-Z0-9'_]*)(?=(\.[A-Z][a-zA-Z0-9_]*)*)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(\s|$)</string>
<key>name</key>
<string>meta.module.open.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.module-reference.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</dict>
<key>match</key>
<string>(\.)([A-Z][a-zA-Z0-9'_]*)</string>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^\s*(module)\s+([A-Z][a-zA-Z0-9'_]*)\s*(=)\s*([A-Z][a-zA-Z0-9'_]*)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.module-definition.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.type.module.fsharp</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.separator.module-definition.fsharp</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(\s|$)</string>
<key>name</key>
<string>meta.module.alias.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.module-reference.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</dict>
<key>match</key>
<string>(\.)([A-Z][a-zA-Z0-9'_]*)</string>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</array>
</dict>
<dict>
<key>applyEndPatternLast</key>
<integer>1</integer>
<key>begin</key>
<string>(?&lt;!\w)([A-Z][a-zA-Z0-9_]*)(\.)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.separator.module-reference.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(?=.)</string>
<key>name</key>
<string>meta.module.reference.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.module-reference.fsharp</string>
</dict>
</dict>
<key>match</key>
<string>[A-Z][a-zA-Z0-9_]+(\.)</string>
<key>name</key>
<string>support.other.module.fsharp</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>strings</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?=[^\\])(""")</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(""")</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fsharp</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\$[ \t]*</string>
<key>name</key>
<string>punctuation.separator.string.ignore-eol.fsharp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?=[^\\])(@")</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(")</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fsharp</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\$[ \t]*</string>
<key>name</key>
<string>punctuation.separator.string.ignore-eol.fsharp</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?=[^\\])(")</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(")</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fsharp</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\$[ \t]*</string>
<key>name</key>
<string>punctuation.separator.string.ignore-eol.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\\([\\'ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})</string>
<key>name</key>
<string>constant.character.string.escape.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\\(?![\\'ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8}).</string>
<key>name</key>
<string>invalid.illeagal.character.string.fsharp</string>
</dict>
</array>
</dict>
<!--<dict>
<key>begin</key>
<string>(?=[^\\])(')</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fsharp</string>
</dict>
</dict>
<key>end</key>
<string>(')</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fsharp</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\$[ \t]*</string>
<key>name</key>
<string>punctuation.separator.string.ignore-eol.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\\([\\"ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})</string>
<key>name</key>
<string>constant.character.string.escape.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>\\(?![\\"ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8}).</string>
<key>name</key>
<string>invalid.illeagal.character.string.fsharp</string>
</dict>
</array>
</dict>-->
</array>
</dict>
<key>structure</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\(</string>
<key>end</key>
<string>\)</string>
<key>name</key>
<string>meta.paren-group.fsharp</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>variables</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\(\)</string>
<key>name</key>
<string>variable.parameter.unit.fsharp</string>
</dict>
<dict>
<key>match</key>
<string>[a-zA-Z]\w*</string>
<key>name</key>
<string>variable.parameter.fsharp</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.fsharp</string>
<key>uuid</key>
<string>6017A74A-C6EA-47A0-8DF4-E59C931316FA</string>
</dict>
</plist>
@disktnk
Copy link
Author

disktnk commented Feb 1, 2014

  • ignore single quotation (') at string type
  • add character type ('), support unicode (\uXXXX, \UXXXXXXXX)
  • add keywords, "yield", "of"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment