|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499 |
- %YAML 1.2
- ---
- # http://www.sublimetext.com/docs/3/syntax.html
- name: fsharp
- file_extensions:
- - fs
- scope: source.fsharp
- contexts:
- main:
- - include: compiler_directives
- - include: comments
- - include: constants
- - include: strings
- - include: chars
- - include: double_tick
- - include: definition
- - include: abstract_definition
- - include: attributes
- - include: modules
- - include: anonymous_functions
- - include: du_declaration
- - include: record_declaration
- - include: keywords
- - include: records
- - include: cexprs
- - include: text
- abstract_definition:
- - match: '\b(abstract)\s+(member)?(\s+\[\<.*\>\])?\s*([_[:alpha:]0-9,\._`\s]+)(:)'
- captures:
- 1: keyword.fsharp
- 2: keyword.fsharp
- 3: support.function.attribute.fsharp
- 5: keyword.fsharp
- push:
- - meta_scope: abstract.definition.fsharp
- - match: \s*(with)\b|=|$
- captures:
- 1: keyword.fsharp
- pop: true
- - include: comments
- - include: common_declaration
- - match: '\?{0,1}([[:alpha:]0-9''`^._ ]+)\s*(:)(\s*([?[:alpha:]0-9''`^._ ]+)){0,1}'
- captures:
- 1: variable.parameter.fsharp
- 2: keyword.symbol.fsharp
- 3: entity.name.type.fsharp
- - match: '(?!with|get|set\b)\b([\w0-9''`^._]+)'
- captures:
- 1: entity.name.type.fsharp
- - include: keywords
- anonymous_functions:
- - match: \b(fun)\b
- captures:
- 1: keyword.fsharp
- push:
- - meta_scope: function.anonymous
- - match: (->)
- captures:
- 1: keyword.fsharp
- pop: true
- - include: comments
- - include: member_declaration
- - match: '(:)(\s*([?[:alpha:]0-9''`<>^._ ]+))*'
- captures:
- 1: keyword.symbol.fsharp
- 2: entity.name.type.fsharp
- - include: variables
- attributes:
- - match: '\[\<'
- push:
- - meta_scope: support.function.attribute.fsharp
- - match: '\>\]|\]'
- pop: true
- - include: main
- cexprs:
- - match: '\b(async|seq|promise|task|maybe|asyncMaybe|controller|scope|application|pipeline)\s*\{'
- scope: cexpr.fsharp
- captures:
- 0: keyword.fsharp
- chars:
- - match: ('\\?.')
- scope: char.fsharp
- captures:
- 1: string.quoted.single.fsharp
- comments:
- - match: ^\s*(\(\*\*(?!\)))(?!\*\))$
- captures:
- 1: comment.block.fsharp
- push:
- - meta_scope: comment.block.markdown.fsharp
- - match: \*\)
- captures:
- 1: comment.block.fsharp
- pop: true
- - include: scope:text.html.markdown
- - match: ^(\s*\*\)$)
- scope: comment.block.markdown.fsharp.end
- captures:
- 1: comment.block.fsharp
- - match: (\(\*(?!\)))
- captures:
- 1: comment.block.fsharp
- push:
- - meta_scope: comment.block.fsharp
- - match: (\*\))
- captures:
- 1: comment.block.fsharp
- pop: true
- - match: ///
- push:
- - meta_scope: comment.line.markdown.fsharp
- - match: (\r)?\n
- pop: true
- - include: scope:text.html.markdown
- - match: //.*$
- scope: comment.line.double-slash.fsharp
- common_declaration:
- - match: '\s*(->)\s*([[:alpha:]0-9''`^._ ]+)(<)'
- captures:
- 1: keyword.symbol.fsharp
- 2: entity.name.type.fsharp
- 3: keyword.symbol.fsharp
- push:
- - match: (>)
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - match: "([[:alpha:]0-9'`^._ ]+)"
- captures:
- 1: entity.name.type.fsharp
- - include: keywords
- - match: '\s*(->)\s*(?!with|get|set\b)\b([\w0-9''`^._]+)'
- captures:
- 1: keyword.symbol.fsharp
- 2: entity.name.type.fsharp
- - match: '\?{0,1}([[:alpha:]0-9''`^._ ]+)\s*(:)(\s*([?[:alpha:]0-9''`^._ ]+)(<))'
- captures:
- 1: variable.parameter.fsharp
- 2: keyword.symbol.fsharp
- 3: keyword.symbol.fsharp
- 4: entity.name.type.fsharp
- push:
- - match: (>)
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - match: "([[:alpha:]0-9'`^._ ]+)"
- captures:
- 1: entity.name.type.fsharp
- - include: keywords
- compiler_directives:
- - match: \s?(#if|#elif|#else|#elseif|#endif|#light|#nowarn)
- scope: compiler_directive.fsharp
- captures:
- 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
- - match: \b(true|false|null|unit)\b
- scope: constant.others.fsharp
- definition:
- - match: '\b(val mutable|val|let mutable|let inline|let|member val|member|static member|override|let!)(\s+rec|mutable)?(\s+\[\<.*\>\])?\s*(private|internal|public)?\s+(\[[^-=]*\]|[_[:alpha:]]([_[:alpha:]0-9,\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\._`\s]+|(?<=,)\s)*)?'
- captures:
- 1: keyword.fsharp
- 2: keyword.fsharp
- 3: support.function.attribute.fsharp
- 4: keyword.fsharp
- 5: variable.fsharp
- push:
- - meta_scope: binding.fsharp
- - match: \s*(with\b|=|\n+=|(?<=\=))
- captures:
- 1: keyword.fsharp
- pop: true
- - include: comments
- - include: attributes
- - match: (:)\s*(\()
- captures:
- 1: keyword.symbol.fsharp
- 2: keyword.symbol.fsharp
- push:
- - match: '(\)\s*(([?[:alpha:]0-9''`^._ ]+))+)'
- captures:
- 1: keyword.symbol.fsharp
- 2: entity.name.type.fsharp
- pop: true
- - include: tuple_signature
- - match: '(:)\s*([?[:alpha:]0-9''`^._ ]+)*'
- captures:
- 1: keyword.symbol.fsharp
- 2: entity.name.type.fsharp
- - match: '(->)\s*(\()?\s*([?[:alpha:]0-9''`^._ ]+)*'
- captures:
- 1: keyword.symbol.fsharp
- 2: keyword.symbol.fsharp
- 3: entity.name.type.fsharp
- - match: (\*)\s*(\()
- captures:
- 1: keyword.symbol.fsharp
- 2: keyword.symbol.fsharp
- push:
- - match: '(\)\s*(([?[:alpha:]0-9''`^._ ]+))+)'
- captures:
- 1: keyword.symbol.fsharp
- 2: entity.name.type.fsharp
- pop: true
- - include: tuple_signature
- - match: '(\*)(\s*([?[:alpha:]0-9''`^._ ]+))*'
- captures:
- 1: keyword.symbol.fsharp
- 2: entity.name.type.fsharp
- - match: '(<(?![[:space:]]*\)))'
- captures:
- 1: keyword.symbol.fsharp
- push:
- - match: (>)
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - include: generic_declaration
- - match: "({)"
- captures:
- 1: keyword.symbol.fsharp
- push:
- - match: "(})"
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - include: record_signature
- - include: variables
- - include: keywords
- double_tick:
- - match: (``)(.*)(``)
- scope: variable.other.binding.fsharp
- captures:
- 1: string.quoted.single.fsharp
- 2: variable.other.binding.fsharp
- 3: string.quoted.single.fsharp
- du_declaration:
- - match: \b(of)\b
- captures:
- 1: keyword.fsharp
- push:
- - meta_scope: du_declaration.fsharp
- - match: $|(\|)
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - include: comments
- - match: '([[:alpha:]0-9''`<>^._]+|``[[:alpha:]0-9'' <>^._]+``)\s*(:)\s*([[:alpha:]0-9''`<>^._]+|``[[:alpha:]0-9'' <>^._]+``)'
- captures:
- 1: variable.parameter.fsharp
- 2: keyword.symbol.fsharp
- 3: entity.name.type.fsharp
- - match: "([[:alpha:]0-9'`^._]+)|``([[:alpha:]0-9'^._ ]+)``"
- captures:
- 1: entity.name.type.fsharp
- - include: keywords
- generic_declaration:
- - match: "([^<>,*()-])"
- captures:
- 1: entity.name.type.fsharp
- - match: (<)
- captures:
- 1: keyword.symbol.fsharp
- push:
- - match: (>)
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - match: "([^<>,*()-])"
- captures:
- 1: entity.name.type.fsharp
- - include: tuple_signature
- - include: generic_declaration
- - include: keywords
- keywords:
- - match: \b(private|to|public|internal|function|yield!|yield|class|exception|match|delegate|of|new|in|as|if|then|else|elif|for|begin|end|inherit|do|let\!|return\!|return|interface|with|abstract|property|union|enum|member|try|finally|and|when|use|use\!|struct|while|mutable)(?!')\b
- scope: keyword.fsharp
- - match: '(&&&|\|\|\||\^\^\^|~~~|<<<|>>>|\|>|\->|\<\-|:>|:\?>|:|\[|\]|\;|<>|=|@|\|\||&&|{|}|\||_|\.\.|\,|\+|\-|\*|\/|\^|\!|\>|\>\=|\>\>|\<|\<\=|\(|\)|\<\<)'
- scope: keyword.symbol.fsharp
- member_declaration:
- - match: (\()
- captures:
- 1: keyword.symbol.fsharp
- push:
- - match: (\))
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - include: comments
- - include: common_declaration
- - match: '\?{0,1}([[:alpha:]0-9''`^._ ]+)\s*(:{0,1})(\s*([?[:alpha:]0-9''`<>^._ ]+)){0,1}'
- captures:
- 1: variable.parameter.fsharp
- 2: keyword.symbol.fsharp
- 3: entity.name.type.fsharp
- - include: keywords
- modules:
- - match: '\b(namespace|module)\s*(public|internal|private)?\s+([[:alpha:]][[:alpha:]0-9''_. ]*)'
- captures:
- 1: keyword.fsharp
- 2: keyword.fsharp
- 3: entity.name.section.fsharp
- push:
- - meta_scope: entity.name.section.fsharp
- - match: (\s?=|\s|$)
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - match: '(\.)([A-Z][[:alpha:]0-9''_]*)'
- scope: entity.name.section.fsharp
- captures:
- 1: punctuation.separator.namespace-reference.fsharp
- 2: entity.name.section.fsharp
- - match: '\b(open)\s+([[:alpha:]][[:alpha:]0-9''_]*)(?=(\.[A-Z][[:alpha:]0-9_]*)*)'
- captures:
- 1: keyword.fsharp
- 2: entity.name.section.fsharp
- push:
- - meta_scope: namespace.open.fsharp
- - match: (\s|$)
- pop: true
- - match: '(\.)([[:alpha:]][[:alpha:]0-9''_]*)'
- scope: entity.name.section.fsharp
- captures:
- 1: punctuation.separator.namespace-reference.fsharp
- 2: entity.name.section.fsharp
- - match: '^\s*(module)\s+([A-Z][[:alpha:]0-9''_]*)\s*(=)\s*([A-Z][[:alpha:]0-9''_]*)'
- captures:
- 1: keyword.fsharp
- 2: entity.name.type.namespace.fsharp
- 3: punctuation.separator.namespace-definition.fsharp
- 4: entity.name.section.fsharp
- push:
- - meta_scope: namespace.alias.fsharp
- - match: (\s|$)
- pop: true
- - match: '(\.)([A-Z][[:alpha:]0-9''_]*)'
- scope: entity.name.section.fsharp
- captures:
- 1: punctuation.separator.namespace-reference.fsharp
- 2: entity.name.section.fsharp
- record_declaration:
- - match: '(\{)'
- captures:
- 1: keyword.symbol.fsharp
- push:
- - match: '(?<=\})'
- pop: true
- - include: comments
- - match: '(((mutable)\s[[:alpha:]]+)|[[:alpha:]0-9''`<>^._]*)\s*((?<!:):(?!:))\s*'
- captures:
- 3: keyword.fsharp
- 4: keyword.symbol.fsharp
- push:
- - match: '$|(;|\})'
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - include: comments
- - match: "([[:alpha:]0-9'`^_ ]+)"
- captures:
- 1: entity.name.type.fsharp
- - include: keywords
- - include: chars
- - include: compiler_directives
- - include: constants
- - include: strings
- - include: chars
- - include: double_tick
- - include: definition
- - include: attributes
- - include: anonymous_functions
- - include: keywords
- - include: cexprs
- - include: text
- record_signature:
- - match: "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)"
- captures:
- 1: keyword.symbol.fsharp
- 2: variable.parameter.fsharp
- - match: "({)"
- captures:
- 1: keyword.symbol.fsharp
- push:
- - match: "(})"
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - match: "[[:alpha:]0-9'`^_ ]+(=)([[:alpha:]0-9'`^_ ]+)"
- captures:
- 1: keyword.symbol.fsharp
- 2: variable.parameter.fsharp
- - include: record_signature
- - include: keywords
- records:
- - match: '\b(type)[\s]+(private|internal|public)?\s*'
- captures:
- 1: keyword.fsharp
- 2: keyword.fsharp
- 3: support.function.attribute.fsharp
- push:
- - meta_scope: record.fsharp
- - match: '\s*((with)|((as)\s*([[:alpha:]0-9'']+))|(=)|[\n=]|(\(\)))'
- captures:
- 2: keyword.fsharp
- 3: keyword.fsharp
- 4: keyword.fsharp
- 5: variable.parameter.fsharp
- 6: keyword.symbol.fsharp
- 7: constant.language.unit.fsharp
- pop: true
- - include: comments
- - include: attributes
- - match: "([[:alpha:]0-9'`^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)(<)"
- captures:
- 1: entity.name.type.fsharp
- 2: keyword.symbol.fsharp
- - match: \s*(>)\s*(private|internal|public)?
- captures:
- 1: keyword.symbol.fsharp
- 2: keyword.fsharp
- - match: "([[:alpha:]0-9'`^._ ]+)"
- captures:
- 1: entity.name.type.fsharp
- - include: member_declaration
- - include: keywords
- string_formatter:
- - match: (%0?-?(\d+)?((a|t)|(\.\d+)?(f|F|e|E|g|G|M)|(b|c|s|d|i|x|X|o|u)|(s|b|O)|(\+?A)))
- scope: entity.name.type.format.specifier.fsharp
- captures:
- 1: keyword.format.specifier.fsharp
- strings:
- - match: '(?=[^\\])(@")'
- captures:
- 1: punctuation.definition.string.begin.fsharp
- push:
- - meta_scope: string.quoted.literal.fsharp
- - match: (")(?!")
- captures:
- 1: punctuation.definition.string.end.fsharp
- pop: true
- - match: '"(")'
- scope: constant.character.string.escape.fsharp
- - match: '(?=[^\\])(""")'
- captures:
- 1: punctuation.definition.string.begin.fsharp
- push:
- - meta_scope: string.quoted.triple.fsharp
- - match: (""")
- captures:
- 1: punctuation.definition.string.end.fsharp
- pop: true
- - include: string_formatter
- - match: '(?=[^\\])(")'
- captures:
- 1: punctuation.definition.string.begin.fsharp
- push:
- - meta_scope: string.quoted.double.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
- - include: string_formatter
- text:
- - match: \\
- scope: text.fsharp
- tuple_signature:
- - match: "(([?[:alpha:]0-9'`^._ ]+))+"
- captures:
- 1: entity.name.type.fsharp
- - match: (\()
- captures:
- 1: keyword.symbol.fsharp
- push:
- - match: (\))
- captures:
- 1: keyword.symbol.fsharp
- pop: true
- - match: "(([?[:alpha:]0-9'`^._ ]+))+"
- captures:
- 1: entity.name.type.fsharp
- - include: tuple_signature
- - include: keywords
- variables:
- - match: \(\)
- scope: constant.language.unit.fsharp
- - match: '``[[:alpha:]0-9''`^:,._ ]+``|[[:alpha:]0-9''`<>^._ ]\w*'
- scope: variable.parameter.fsharp
|