From 66e164070389f4e90e348cb808444bc043fe2c08 Mon Sep 17 00:00:00 2001 From: Vihang Mehta Date: Mon, 18 Jan 2016 14:12:53 -0800 Subject: [PATCH] Retain XML for tmLanguage --- Protobuf.JSON-tmLanguage | 358 ++++++++++---------- Protobuf.YAML-tmLanguage | 16 +- Protobuf.tmLanguage | 696 ++++++++++++++++++++++++--------------- 3 files changed, 608 insertions(+), 462 deletions(-) diff --git a/Protobuf.JSON-tmLanguage b/Protobuf.JSON-tmLanguage index ab8c736..854ec7f 100644 --- a/Protobuf.JSON-tmLanguage +++ b/Protobuf.JSON-tmLanguage @@ -1,274 +1,274 @@ { + "uuid": "750ac1f3-b172-48de-b1a4-a3c310c4a293", + "scopeName": "source.proto", + "name": "Protocol Buffer", "patterns": [ { "include": "#comments" - }, + }, { "include": "#storagetypes" - }, + }, { "include": "#enum" - }, + }, { "include": "#message" - }, + }, { "include": "#option" - }, + }, { "include": "#constants" - }, + }, { "include": "#strings" - }, + }, { "include": "#oneof" - }, + }, { "include": "#packaging" - }, + }, { "include": "#service" - }, + }, { - "name": "constant.numeric.proto", + "name": "constant.numeric.proto", "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b" } - ], - "scopeName": "source.proto", + ], + "fileTypes": [ + "proto" + ], "repository": { - "option": { + "message": { + "beginCaptures": { + "3": { + "name": "entity.name.class.message.proto" + }, + "1": { + "name": "keyword.source.proto" + } + }, "patterns": [ { - "include": "#strings" - }, + "include": "$self" + }, { - "name": "storage.type.proto", - "match": "default|packed|optimize\\_for|java\\_package|java\\_outer\\_classname|go\\_package|deprecated|lazy|\\w+\\_api\\_version" - }, + "include": "#enum" + }, { - "name": "constant.language.proto", - "match": "(CODE\\_SIZE|SPEED)" + "include": "#option" + }, + { + "include": "#comments" + }, + { + "include": "#oneof" + }, + { + "beginCaptures": { + "1": { + "name": "keyword.source.proto" + } + }, + "patterns": [ + { + "include": "#storagetypes" + }, + { + "captures": { + "1": { + "name": "entity.name.class.proto" + } + }, + "match": "([A-Za-z][A-Za-z0-9_]*)(\\s+)([A-Za-z][A-Za-z0-9_]*)" + }, + { + "captures": { + "4": { + "name": "constant.numeric.proto" + } + }, + "match": "(\\s*)(=)(\\s*)([0-9]*)" + }, + { + "patterns": [ + { + "name": "keyword.source.proto", + "match": "default|packed|deprecated|lazy" + }, + { + "include": "#constants" + } + ], + "begin": "\\[", + "end": "\\]" + } + ], + "begin": "(optional|repeated|required|to|extensions)(\\s+)", + "end": ";" } - ], + ], + "begin": "(message|extend)(\\s+)([A-Za-z][A-Za-z0-9_.]*)(\\s*)(\\{)?", + "end": "\\}" + }, + "oneof": { "beginCaptures": { - "2": { + "1": { "name": "keyword.source.proto" } - }, - "begin": "(\\b)(option)(\\b)", - "end": ";" - }, - "constants": { - "name": "constant.language.proto", - "match": "\\b(true|false|max)\\b" - }, - "enum": { + }, "patterns": [ { "include": "#option" - }, + }, { "include": "#comments" - }, + }, { - "name": "keyword.source.proto", + "name": "keyword.source.proto", "match": "\\b(to|extensions)\\b" - }, + }, { "captures": { - "1": { - "name": "constant.other.proto" - }, - "5": { + "7": { "name": "constant.numeric.proto" + }, + "1": { + "name": "entity.name.class.proto" } - }, - "match": "([A-Za-z][A-Za-z0-9_]*)(\\s*)(=)(\\s*)([0-9]*)" + }, + "match": "([A-Za-z][A-Za-z0-9_]*)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(=)(\\s*)([0-9]*)" } - ], + ], + "begin": "(oneof)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(\\{)?", + "end": "\\}" + }, + "service": { "beginCaptures": { + "3": { + "name": "entity.name.class.message.proto" + }, "1": { "name": "keyword.source.proto" - }, - "3": { - "name": "entity.name.class.proto" } - }, - "begin": "(enum)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(\\{)?", - "end": "\\}" - }, - "service": { + }, "patterns": [ { "beginCaptures": { - "1": { + "7": { "name": "keyword.source.proto" - }, + }, "3": { "name": "entity.name.function" - }, - "7": { + }, + "1": { "name": "keyword.source.proto" } - }, - "begin": "(rpc)(\\s+)([A-Za-z][A-Z-a-z0-9_]+)(\\s*)(\\([A-Za-z0-9_]+\\))(\\s+)(returns)(\\s+)(\\([A-Za-z0-9_]+\\))", + }, + "begin": "(rpc)(\\s+)([A-Za-z][A-Z-a-z0-9_]+)(\\s*)(\\([A-Za-z0-9_]+\\))(\\s+)(returns)(\\s+)(\\([A-Za-z0-9_]+\\))", "end": ";" } - ], - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - }, - "3": { - "name": "entity.name.class.message.proto" - } - }, - "begin": "(service)(\\s+)([A-Za-z][A-Za-z0-9_.]*)(\\s*)(\\{)?", + ], + "begin": "(service)(\\s+)([A-Za-z][A-Za-z0-9_.]*)(\\s*)(\\{)?", "end": "\\}" - }, - "strings": { - "begin": "\"", - "name": "string.quoted.double.proto", - "end": "\"" - }, + }, "comments": { "patterns": [ { - "begin": "/\\*", - "name": "comment.block.proto", + "name": "comment.block.proto", + "begin": "/\\*", "end": "\\*/" - }, + }, { - "begin": "//", - "name": "comment.line.double-slash.proto", + "name": "comment.line.double-slash.proto", + "begin": "//", "end": "$\\n?" } ] - }, - "oneof": { + }, + "constants": { + "name": "constant.language.proto", + "match": "\\b(true|false|max)\\b" + }, + "enum": { + "beginCaptures": { + "3": { + "name": "entity.name.class.proto" + }, + "1": { + "name": "keyword.source.proto" + } + }, "patterns": [ { "include": "#option" - }, + }, { "include": "#comments" - }, + }, { - "name": "keyword.source.proto", + "name": "keyword.source.proto", "match": "\\b(to|extensions)\\b" - }, + }, { "captures": { - "1": { - "name": "entity.name.class.proto" - }, - "7": { + "5": { "name": "constant.numeric.proto" + }, + "1": { + "name": "constant.other.proto" } - }, - "match": "([A-Za-z][A-Za-z0-9_]*)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(=)(\\s*)([0-9]*)" + }, + "match": "([A-Za-z][A-Za-z0-9_]*)(\\s*)(=)(\\s*)([0-9]*)" } - ], + ], + "begin": "(enum)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(\\{)?", + "end": "\\}" + }, + "strings": { + "name": "string.quoted.double.proto", + "begin": "\"", + "end": "\"" + }, + "option": { "beginCaptures": { - "1": { + "2": { "name": "keyword.source.proto" } - }, - "begin": "(oneof)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(\\{)?", - "end": "\\}" - }, + }, + "patterns": [ + { + "include": "#strings" + }, + { + "name": "storage.type.proto", + "match": "default|packed|optimize\\_for|java\\_package|java\\_outer\\_classname|go\\_package|deprecated|lazy|\\w+\\_api\\_version" + }, + { + "name": "constant.language.proto", + "match": "(CODE\\_SIZE|SPEED)" + } + ], + "begin": "(\\b)(option)(\\b)", + "end": ";" + }, "storagetypes": { - "name": "storage.type.proto", + "name": "storage.type.proto", "match": "\\b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\\b" - }, + }, "packaging": { "captures": { - "1": { - "name": "keyword.source.proto" - }, "2": { "name": "entity.name.tag" - } - }, - "match": "(package|import)(?=(\\s+)([\"]?[A-Za-z][A-Za-z0-9_./]*[\"]?)(;))" - }, - "message": { - "patterns": [ - { - "include": "$self" - }, - { - "include": "#enum" - }, - { - "include": "#option" - }, - { - "include": "#comments" - }, - { - "include": "#oneof" - }, - { - "patterns": [ - { - "include": "#storagetypes" - }, - { - "captures": { - "1": { - "name": "entity.name.class.proto" - } - }, - "match": "([A-Za-z][A-Za-z0-9_]*)(\\s+)([A-Za-z][A-Za-z0-9_]*)" - }, - { - "captures": { - "4": { - "name": "constant.numeric.proto" - } - }, - "match": "(\\s*)(=)(\\s*)([0-9]*)" - }, - { - "patterns": [ - { - "name": "keyword.source.proto", - "match": "default|packed|deprecated|lazy" - }, - { - "include": "#constants" - } - ], - "begin": "\\[", - "end": "\\]" - } - ], - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - } - }, - "begin": "(optional|repeated|required|to|extensions)(\\s+)", - "end": ";" - } - ], - "beginCaptures": { + }, "1": { "name": "keyword.source.proto" - }, - "3": { - "name": "entity.name.class.message.proto" } - }, - "begin": "(message|extend)(\\s+)([A-Za-z][A-Za-z0-9_.]*)(\\s*)(\\{)?", - "end": "\\}" + }, + "match": "(package|import)(?=(\\s+)([\"]?[A-Za-z][A-Za-z0-9_./]*[\"]?)(;))" } - }, - "uuid": "750ac1f3-b172-48de-b1a4-a3c310c4a293", - "name": "Protocol Buffer", - "fileTypes": [ - "proto" - ] + } } \ No newline at end of file diff --git a/Protobuf.YAML-tmLanguage b/Protobuf.YAML-tmLanguage index d2658c7..8293d97 100644 --- a/Protobuf.YAML-tmLanguage +++ b/Protobuf.YAML-tmLanguage @@ -122,15 +122,6 @@ repository: '1': {name: keyword.source.proto} '2': {name: entity.name.tag} - storagetypes: - name: storage.type.proto - match: \b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b - - strings: - name: string.quoted.double.proto - begin: '"' - end: '"' - service: begin: (service)(\s+)([A-Za-z][A-Za-z0-9_.]*)(\s*)(\{)? beginCaptures: @@ -145,4 +136,11 @@ repository: '7': {name: keyword.source.proto} end: ; + storagetypes: + name: storage.type.proto + match: \b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b + strings: + name: string.quoted.double.proto + begin: '"' + end: '"' diff --git a/Protobuf.tmLanguage b/Protobuf.tmLanguage index ab8c736..ec1172a 100644 --- a/Protobuf.tmLanguage +++ b/Protobuf.tmLanguage @@ -1,274 +1,422 @@ -{ - "patterns": [ - { - "include": "#comments" - }, - { - "include": "#storagetypes" - }, - { - "include": "#enum" - }, - { - "include": "#message" - }, - { - "include": "#option" - }, - { - "include": "#constants" - }, - { - "include": "#strings" - }, - { - "include": "#oneof" - }, - { - "include": "#packaging" - }, - { - "include": "#service" - }, - { - "name": "constant.numeric.proto", - "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b" - } - ], - "scopeName": "source.proto", - "repository": { - "option": { - "patterns": [ - { - "include": "#strings" - }, - { - "name": "storage.type.proto", - "match": "default|packed|optimize\\_for|java\\_package|java\\_outer\\_classname|go\\_package|deprecated|lazy|\\w+\\_api\\_version" - }, - { - "name": "constant.language.proto", - "match": "(CODE\\_SIZE|SPEED)" - } - ], - "beginCaptures": { - "2": { - "name": "keyword.source.proto" - } - }, - "begin": "(\\b)(option)(\\b)", - "end": ";" - }, - "constants": { - "name": "constant.language.proto", - "match": "\\b(true|false|max)\\b" - }, - "enum": { - "patterns": [ - { - "include": "#option" - }, - { - "include": "#comments" - }, - { - "name": "keyword.source.proto", - "match": "\\b(to|extensions)\\b" - }, - { - "captures": { - "1": { - "name": "constant.other.proto" - }, - "5": { - "name": "constant.numeric.proto" - } - }, - "match": "([A-Za-z][A-Za-z0-9_]*)(\\s*)(=)(\\s*)([0-9]*)" - } - ], - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - }, - "3": { - "name": "entity.name.class.proto" - } - }, - "begin": "(enum)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(\\{)?", - "end": "\\}" - }, - "service": { - "patterns": [ - { - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - }, - "3": { - "name": "entity.name.function" - }, - "7": { - "name": "keyword.source.proto" - } - }, - "begin": "(rpc)(\\s+)([A-Za-z][A-Z-a-z0-9_]+)(\\s*)(\\([A-Za-z0-9_]+\\))(\\s+)(returns)(\\s+)(\\([A-Za-z0-9_]+\\))", - "end": ";" - } - ], - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - }, - "3": { - "name": "entity.name.class.message.proto" - } - }, - "begin": "(service)(\\s+)([A-Za-z][A-Za-z0-9_.]*)(\\s*)(\\{)?", - "end": "\\}" - }, - "strings": { - "begin": "\"", - "name": "string.quoted.double.proto", - "end": "\"" - }, - "comments": { - "patterns": [ - { - "begin": "/\\*", - "name": "comment.block.proto", - "end": "\\*/" - }, - { - "begin": "//", - "name": "comment.line.double-slash.proto", - "end": "$\\n?" - } - ] - }, - "oneof": { - "patterns": [ - { - "include": "#option" - }, - { - "include": "#comments" - }, - { - "name": "keyword.source.proto", - "match": "\\b(to|extensions)\\b" - }, - { - "captures": { - "1": { - "name": "entity.name.class.proto" - }, - "7": { - "name": "constant.numeric.proto" - } - }, - "match": "([A-Za-z][A-Za-z0-9_]*)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(=)(\\s*)([0-9]*)" - } - ], - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - } - }, - "begin": "(oneof)(\\s+)([A-Za-z][A-Za-z0-9_]*)(\\s*)(\\{)?", - "end": "\\}" - }, - "storagetypes": { - "name": "storage.type.proto", - "match": "\\b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\\b" - }, - "packaging": { - "captures": { - "1": { - "name": "keyword.source.proto" - }, - "2": { - "name": "entity.name.tag" - } - }, - "match": "(package|import)(?=(\\s+)([\"]?[A-Za-z][A-Za-z0-9_./]*[\"]?)(;))" - }, - "message": { - "patterns": [ - { - "include": "$self" - }, - { - "include": "#enum" - }, - { - "include": "#option" - }, - { - "include": "#comments" - }, - { - "include": "#oneof" - }, - { - "patterns": [ - { - "include": "#storagetypes" - }, - { - "captures": { - "1": { - "name": "entity.name.class.proto" - } - }, - "match": "([A-Za-z][A-Za-z0-9_]*)(\\s+)([A-Za-z][A-Za-z0-9_]*)" - }, - { - "captures": { - "4": { - "name": "constant.numeric.proto" - } - }, - "match": "(\\s*)(=)(\\s*)([0-9]*)" - }, - { - "patterns": [ - { - "name": "keyword.source.proto", - "match": "default|packed|deprecated|lazy" - }, - { - "include": "#constants" - } - ], - "begin": "\\[", - "end": "\\]" - } - ], - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - } - }, - "begin": "(optional|repeated|required|to|extensions)(\\s+)", - "end": ";" - } - ], - "beginCaptures": { - "1": { - "name": "keyword.source.proto" - }, - "3": { - "name": "entity.name.class.message.proto" - } - }, - "begin": "(message|extend)(\\s+)([A-Za-z][A-Za-z0-9_.]*)(\\s*)(\\{)?", - "end": "\\}" - } - }, - "uuid": "750ac1f3-b172-48de-b1a4-a3c310c4a293", - "name": "Protocol Buffer", - "fileTypes": [ - "proto" - ] -} \ No newline at end of file + + + + + fileTypes + + proto + + name + Protocol Buffer + patterns + + + include + #comments + + + include + #storagetypes + + + include + #enum + + + include + #message + + + include + #option + + + include + #constants + + + include + #strings + + + include + #oneof + + + include + #packaging + + + include + #service + + + match + \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b + name + constant.numeric.proto + + + repository + + comments + + patterns + + + begin + /\* + end + \*/ + name + comment.block.proto + + + begin + // + end + $\n? + name + comment.line.double-slash.proto + + + + constants + + match + \b(true|false|max)\b + name + constant.language.proto + + enum + + begin + (enum)(\s+)([A-Za-z][A-Za-z0-9_]*)(\s*)(\{)? + beginCaptures + + 1 + + name + keyword.source.proto + + 3 + + name + entity.name.class.proto + + + end + \} + patterns + + + include + #option + + + include + #comments + + + match + \b(to|extensions)\b + name + keyword.source.proto + + + captures + + 1 + + name + constant.other.proto + + 5 + + name + constant.numeric.proto + + + match + ([A-Za-z][A-Za-z0-9_]*)(\s*)(=)(\s*)([0-9]*) + + + + message + + begin + (message|extend)(\s+)([A-Za-z][A-Za-z0-9_.]*)(\s*)(\{)? + beginCaptures + + 1 + + name + keyword.source.proto + + 3 + + name + entity.name.class.message.proto + + + end + \} + patterns + + + include + $self + + + include + #enum + + + include + #option + + + include + #comments + + + include + #oneof + + + begin + (optional|repeated|required|to|extensions)(\s+) + beginCaptures + + 1 + + name + keyword.source.proto + + + end + ; + patterns + + + include + #storagetypes + + + captures + + 1 + + name + entity.name.class.proto + + + match + ([A-Za-z][A-Za-z0-9_]*)(\s+)([A-Za-z][A-Za-z0-9_]*) + + + captures + + 4 + + name + constant.numeric.proto + + + match + (\s*)(=)(\s*)([0-9]*) + + + begin + \[ + end + \] + patterns + + + match + default|packed|deprecated|lazy + name + keyword.source.proto + + + include + #constants + + + + + + + + oneof + + begin + (oneof)(\s+)([A-Za-z][A-Za-z0-9_]*)(\s*)(\{)? + beginCaptures + + 1 + + name + keyword.source.proto + + + end + \} + patterns + + + include + #option + + + include + #comments + + + match + \b(to|extensions)\b + name + keyword.source.proto + + + captures + + 1 + + name + entity.name.class.proto + + 7 + + name + constant.numeric.proto + + + match + ([A-Za-z][A-Za-z0-9_]*)(\s+)([A-Za-z][A-Za-z0-9_]*)(\s*)(=)(\s*)([0-9]*) + + + + option + + begin + (\b)(option)(\b) + beginCaptures + + 2 + + name + keyword.source.proto + + + end + ; + patterns + + + include + #strings + + + match + default|packed|optimize\_for|java\_package|java\_outer\_classname|go\_package|deprecated|lazy|\w+\_api\_version + name + storage.type.proto + + + match + (CODE\_SIZE|SPEED) + name + constant.language.proto + + + + packaging + + captures + + 1 + + name + keyword.source.proto + + 2 + + name + entity.name.tag + + + match + (package|import)(?=(\s+)(["]?[A-Za-z][A-Za-z0-9_./]*["]?)(;)) + + service + + begin + (service)(\s+)([A-Za-z][A-Za-z0-9_.]*)(\s*)(\{)? + beginCaptures + + 1 + + name + keyword.source.proto + + 3 + + name + entity.name.class.message.proto + + + end + \} + patterns + + + begin + (rpc)(\s+)([A-Za-z][A-Z-a-z0-9_]+)(\s*)(\([A-Za-z0-9_]+\))(\s+)(returns)(\s+)(\([A-Za-z0-9_]+\)) + beginCaptures + + 1 + + name + keyword.source.proto + + 3 + + name + entity.name.function + + 7 + + name + keyword.source.proto + + + end + ; + + + + storagetypes + + match + \b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b + name + storage.type.proto + + strings + + begin + " + end + " + name + string.quoted.double.proto + + + scopeName + source.proto + uuid + 750ac1f3-b172-48de-b1a4-a3c310c4a293 + +