%YAML 1.2 --- name: MLF file_extensions: - mlf scope: source.mlf contexts: main: - include: comments - include: annotations - include: keywords - include: types - include: strings - include: numbers - include: operators comments: - match: '///' scope: punctuation.definition.comment.mlf push: - meta_scope: comment.line.documentation.mlf - match: $ pop: true - match: '//' scope: punctuation.definition.comment.mlf push: - meta_scope: comment.line.double-slash.mlf - match: $ pop: true annotations: # Annotation with selectors and args: @rust,typescript:deprecated(true) - match: '@([a-zA-Z_][a-zA-Z0-9_]*(?:,[a-zA-Z_][a-zA-Z0-9_]*)*):([a-zA-Z_][a-zA-Z0-9_]*)' scope: meta.annotation.mlf captures: 1: entity.name.namespace.mlf 2: entity.name.function.annotation.mlf push: - match: '\(' scope: punctuation.section.arguments.begin.mlf set: - meta_scope: meta.annotation.arguments.mlf - match: '\)' scope: punctuation.section.arguments.end.mlf pop: true - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*(:)' captures: 1: variable.parameter.mlf 2: punctuation.separator.mlf - include: strings - include: numbers - match: '\b(true|false)\b' scope: constant.language.mlf - match: ',' scope: punctuation.separator.mlf - match: '(?=\S)' pop: true # Bare annotation with args: @deprecated(true) - match: '@([a-zA-Z_][a-zA-Z0-9_]*)' scope: meta.annotation.mlf captures: 1: entity.name.function.annotation.mlf push: - match: '\(' scope: punctuation.section.arguments.begin.mlf set: - meta_scope: meta.annotation.arguments.mlf - match: '\)' scope: punctuation.section.arguments.end.mlf pop: true - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*(:)' captures: 1: variable.parameter.mlf 2: punctuation.separator.mlf - include: strings - include: numbers - match: '\b(true|false)\b' scope: constant.language.mlf - match: ',' scope: punctuation.separator.mlf - match: '(?=\S)' pop: true keywords: - match: '\b(namespace|use|as|record|inline|def|type|token|query|procedure|subscription|throws|constrained|error)\b' scope: keyword.control.mlf - match: '\b(main|defs)\b' scope: keyword.other.mlf types: # Primitive types - match: '\b(null|boolean|integer|string|bytes|blob|unknown)\b' scope: storage.type.builtin.mlf # Format types - match: '\b(Datetime|Uri|AtUri|Did|Handle|Nsid|Cid|AtIdentifier|Language|Tid|RecordKey)\b' scope: storage.type.format.mlf # User-defined types (capitalized identifiers) - match: '\b[A-Z][a-zA-Z0-9_]*\b' scope: entity.name.type.mlf strings: - match: '"' scope: punctuation.definition.string.begin.mlf push: - meta_scope: string.quoted.double.mlf - match: '\\.' scope: constant.character.escape.mlf - match: '"' scope: punctuation.definition.string.end.mlf pop: true numbers: - match: '\b\d+\b' scope: constant.numeric.integer.mlf operators: - match: '[{}()\[\]]' scope: punctuation.section.mlf - match: '[,;:.]' scope: punctuation.separator.mlf - match: '!' scope: keyword.operator.required.mlf - match: '\|' scope: keyword.operator.union.mlf - match: '\*' scope: keyword.operator.wildcard.mlf - match: '=' scope: keyword.operator.assignment.mlf