blob: b709d65ee1b386377efd2eb02903a6775bead7a1 [file] [log] [blame]
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "FIDL",
"scopeName": "source.fidl",
"patterns": [
{
"include": "#comments"
},
{
"include": "#attributes"
},
{
"name": "meta.library.fidl",
"match": "\\b(library)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)\\s*(;)",
"captures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "entity.name.type"
},
"3": {
"name": "punctuation.terminator"
}
}
},
{
"name": "meta.library.fidl",
"match": "\\b(using)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)\\s*(;)",
"captures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "entity.name.type"
},
"3": {
"name": "punctuation.terminator"
}
}
},
{
"name": "meta.library.fidl",
"match": "\\b(using)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)\\s*\\b(as)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)\\s*(;)",
"captures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "entity.name.type"
},
"3": {
"name": "keyword.control"
},
"4": {
"name": "entity.name.type"
},
"5": {
"name": "punctuation.terminator"
}
}
},
{
"name": "meta.type-alias.fidl",
"begin": "\\b(alias)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)\\s*(=)\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)",
"beginCaptures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "variable.alias"
},
"3": {
"name": "punctuation.separator"
},
"4": {
"name": "entity.name.type"
}
},
"end": "(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator"
}
},
"patterns": [
{
"include": "#type-constructor"
}
]
},
{
"name": "meta.const.fidl",
"begin": "\\b(const)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)\\s*((?:\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*|(\\b(?:bool|float32|float64|int8|int16|int32|int64|uint8|uint16|uint32|uint64)\\b)))\\s*(=)",
"beginCaptures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "variable.constant"
},
"3": {
"name": "storage.type"
},
"4": {
"name": "storage.type.basic"
},
"5": {
"name": "punctuation.separator"
}
},
"end": "(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator"
}
},
"patterns": [
{
"include": "#const-value"
}
]
},
{
"name": "meta.protocol-block.fidl",
"begin": "\\b(protocol)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)\\s*{",
"beginCaptures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "entity.name.type"
}
},
"end": "}",
"endCaptures": {},
"patterns": [
{
"include": "#comments"
},
{
"include": "#attributes"
},
{
"match": "\\b(compose)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)",
"captures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "entity.name.type"
}
}
},
{
"include": "#method"
}
]
},
{
"name": "meta.type.fidl",
"begin": "\\b(type)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)\\s*(=)",
"beginCaptures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "entity.name.type"
},
"3": {
"name": "punctuation.separator"
}
},
"end": "(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator"
}
},
"patterns": [
{
"include": "#type-constructor"
}
]
}
],
"repository": {
"comments": {
"patterns": [
{
"name": "invalid.illegal.stray-comment-end.fidl",
"match": "\\*/.*\\n",
"captures": {}
},
{
"name": "comment.line.documentation.fidl",
"match": "///.*\\n",
"captures": {}
},
{
"name": "comment.line.double-slash.fidl",
"match": "//.*\\n",
"captures": {}
}
]
},
"attribute-with-args": {
"patterns": [
{
"name": "meta.attribute.with-args.fidl",
"begin": "(@\\s*\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)\\s*\\(",
"beginCaptures": {
"1": {
"name": "entity.other.attribute-name"
}
},
"end": "\\)",
"endCaptures": {},
"patterns": [
{
"match": "(?:(,))?\\s*\\b[a-zA-Z_][0-9a-zA-Z_]*\\b\\s*(=)",
"captures": {
"1": {
"name": "punctuation.separator"
},
"2": {
"name": "punctuation.separator"
}
}
},
{
"include": "#const-value"
}
]
}
]
},
"attribute-no-args": {
"patterns": [
{
"name": "meta.attribute.no-args.fidl",
"match": "(@\\s*\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)",
"captures": {
"1": {
"name": "entity.other.attribute-name"
}
}
}
]
},
"attributes": {
"patterns": [
{
"include": "#attribute-with-args"
},
{
"include": "#attribute-no-args"
}
]
},
"method": {
"patterns": [
{
"name": "meta.method.fidl",
"begin": "(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)",
"beginCaptures": {
"1": {
"name": "entity.name.function"
}
},
"end": "(?:\\b(error)\\b\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*))?\\s*(;)",
"endCaptures": {
"1": {
"name": "keyword.control"
},
"2": {
"name": "entity.name.type"
},
"3": {
"name": "punctuation.terminator"
}
},
"patterns": [
{
"include": "#method-argument"
},
{
"match": "(->)",
"captures": {
"1": {
"name": "punctuation.separator"
}
}
}
]
}
]
},
"const-value": {
"patterns": [
{
"name": "meta.separator.fidl",
"match": "(\\|)",
"captures": {
"1": {
"name": "punctuation.separator"
}
}
},
{
"name": "storage.type.operand.fidl",
"match": "(?:(?:(-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:0(?:b|B)[01]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)\\b)|(\\b(?:true|false)\\b)|(\"(?:[^\\\"]|\\.)*\"))|\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)",
"captures": {
"1": {
"name": "constant.numeric"
},
"2": {
"name": "constant.language"
},
"3": {
"name": "string.quoted.double"
}
}
}
]
},
"numeric-const-value": {
"patterns": [
{
"name": "meta.separator.fidl",
"match": "(\\|)",
"captures": {
"1": {
"name": "punctuation.separator"
}
}
},
{
"name": "storage.type.operand.fidl",
"match": "(?:(-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:0(?:b|B)[01]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)\\b)|\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)",
"captures": {
"1": {
"name": "constant.numeric"
}
}
}
]
},
"default-value": {
"patterns": [
{
"name": "meta.separator.fidl",
"match": "(=)",
"captures": {
"1": {
"name": "punctuation.separator"
}
}
},
{
"include": "#const-value"
}
]
},
"method-argument": {
"patterns": [
{
"name": "meta.method.arguments.fidl",
"begin": "\\(",
"beginCaptures": {},
"end": "\\)",
"endCaptures": {},
"patterns": [
{
"include": "#type-constructor"
}
]
}
]
},
"type-constructor": {
"patterns": [
{
"include": "#type-constructor-inline"
},
{
"include": "#type-constructor-inline-arg"
},
{
"include": "#type-constructor-reference"
},
{
"include": "#type-constraints"
}
]
},
"type-constructor-inline": {
"patterns": [
{
"name": "meta.type-constructor-inline.fidl",
"begin": "((?:(?:\\bstrict\\b|\\bflexible\\b|\\bresource\\b)\\s*)*)\\s*(?:\\b(union)\\b|\\b(struct)\\b|\\b(table)\\b|\\b(enum)\\b|\\b(bits)\\b)\\s*(?:(:)\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*))?\\s*{",
"beginCaptures": {
"1": {
"name": "storage.type.modifier"
},
"2": {
"name": "keyword.control"
},
"3": {
"name": "keyword.control"
},
"4": {
"name": "keyword.control"
},
"5": {
"name": "keyword.control"
},
"6": {
"name": "keyword.control"
},
"7": {
"name": "punctuation.separator"
},
"8": {
"name": "entity.name.type"
}
},
"end": "}",
"endCaptures": {},
"patterns": [
{
"include": "#comments"
},
{
"include": "#attributes"
},
{
"include": "#layout-member"
}
]
}
]
},
"type-constructor-inline-arg": {
"patterns": [
{
"name": "meta.type-constructor-inline-arg.fidl",
"begin": "(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)\\s*<\\s*((?:(?:\\bstrict\\b|\\bflexible\\b|\\bresource\\b)\\s*)*)\\s*(?:\\b(union)\\b|\\b(struct)\\b|\\b(table)\\b|\\b(enum)\\b|\\b(bits)\\b)\\s*(?:(:)\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*))?\\s*{",
"beginCaptures": {
"1": {
"name": "entity.name.type"
},
"2": {
"name": "storage.type.modifier"
},
"3": {
"name": "keyword.control"
},
"4": {
"name": "keyword.control"
},
"5": {
"name": "keyword.control"
},
"6": {
"name": "keyword.control"
},
"7": {
"name": "keyword.control"
},
"8": {
"name": "punctuation.separator"
},
"9": {
"name": "entity.name.type"
}
},
"end": "(?:,\\s*(?:(?:(-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:0(?:b|B)[01]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)\\b)|(\\b(?:true|false)\\b)|(\"(?:[^\\\"]|\\.)*\"))|\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*))?\\s*>",
"endCaptures": {
"1": {
"name": "constant.numeric"
},
"2": {
"name": "constant.language"
},
"3": {
"name": "string.quoted.double"
}
},
"patterns": [
{
"include": "#comments"
},
{
"include": "#attributes"
},
{
"include": "#layout-member"
}
]
}
]
},
"type-constructor-reference": {
"patterns": [
{
"name": "meta.type-constructor-reference.fidl",
"match": "(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)\\s*(?:(<)\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*)\\s*(?:(,)\\s*(?:(-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:0(?:b|B)[01]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)\\b)|\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*))?\\s*(>))?",
"captures": {
"1": {
"name": "entity.name.type"
},
"2": {
"name": "punctuation.bracket.angle"
},
"3": {
"name": "entity.name.type"
},
"4": {
"name": "punctuation.separator"
},
"5": {
"name": "constant.numeric"
},
"6": {
"name": "punctuation.bracket.angle"
}
}
}
]
},
"type-constraints": {
"patterns": [
{
"include": "#type-constraints-list"
},
{
"include": "#type-constraints-singleton"
}
]
},
"type-constraints-list": {
"patterns": [
{
"name": "meta.type-constraints-list.fidl",
"begin": ":<",
"beginCaptures": {},
"end": ">",
"endCaptures": {},
"patterns": [
{
"include": "#const-value"
}
]
}
]
},
"type-constraints-singleton": {
"patterns": [
{
"name": "meta.type-constraints-singleton.fidl",
"match": ":\\s*((?:(?:(-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:0(?:b|B)[01]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)\\b)|(\\b(?:true|false)\\b)|(\"(?:[^\\\"]|\\.)*\"))|\\b[a-zA-Z_][0-9a-zA-Z_]*\\b(?:\\.\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)*))",
"captures": {
"1": {
"name": "storage.type.constraint"
},
"2": {
"name": "constant.numeric"
},
"3": {
"name": "constant.language"
},
"4": {
"name": "string.quoted.double"
}
}
}
]
},
"layout-member": {
"patterns": [
{
"include": "#layout-member-reserved"
},
{
"include": "#layout-member-value"
},
{
"include": "#layout-member-struct"
},
{
"include": "#layout-member-ordinaled"
}
]
},
"layout-member-reserved": {
"patterns": [
{
"name": "meta.layout.reserved-member.fidl",
"match": "(-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:0(?:b|B)[01]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)\\b)\\s*(:)\\s*\\b(reserved)\\b\\s*(;)",
"captures": {
"1": {
"name": "constant.numeric"
},
"2": {
"name": "punctuation.separator"
},
"3": {
"name": "keyword.control"
},
"4": {
"name": "punctuation.terminator"
}
}
}
]
},
"layout-member-ordinaled": {
"patterns": [
{
"name": "meta.layout.ordinaled-member.fidl",
"begin": "(-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:0(?:b|B)[01]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)\\b)\\s*(:)\\s*(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)",
"beginCaptures": {
"1": {
"name": "constant.numeric"
},
"2": {
"name": "punctuation.separator"
},
"3": {
"name": "variable"
}
},
"end": "(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator"
}
},
"patterns": [
{
"include": "#type-constructor"
}
]
}
]
},
"layout-member-struct": {
"patterns": [
{
"name": "meta.layout.struct-struct-member.fidl",
"begin": "(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)",
"beginCaptures": {
"1": {
"name": "variable"
}
},
"end": "(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator"
}
},
"patterns": [
{
"include": "#type-constructor"
},
{
"include": "#default-value"
}
]
}
]
},
"layout-member-value": {
"patterns": [
{
"name": "meta.layout.value-member.fidl",
"begin": "(\\b[a-zA-Z_][0-9a-zA-Z_]*\\b)\\s*(=)",
"beginCaptures": {
"1": {
"name": "variable"
},
"2": {
"name": "punctuation.separator"
}
},
"end": "(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator"
}
},
"patterns": [
{
"include": "#numeric-const-value"
}
]
}
]
}
}
}