/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.36.1(6c56744c3419458f0dd48864520b759d1a3a1ca8) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt *-----------------------------------------------------------------------------*/ // src/basic-languages/protobuf/protobuf.ts var namedLiterals = ["true", "false"]; var conf = { comments: { lineComment: "//", blockComment: ["/*", "*/"] }, brackets: [ ["{", "}"], ["[", "]"], ["(", ")"], ["<", ">"] ], surroundingPairs: [ { open: "{", close: "}" }, { open: "[", close: "]" }, { open: "(", close: ")" }, { open: "<", close: ">" }, { open: '"', close: '"' }, { open: "'", close: "'" } ], autoClosingPairs: [ { open: "{", close: "}" }, { open: "[", close: "]" }, { open: "(", close: ")" }, { open: "<", close: ">" }, { open: '"', close: '"', notIn: ["string"] }, { open: "'", close: "'", notIn: ["string"] } ], autoCloseBefore: ".,=}])>' \n ", indentationRules: { increaseIndentPattern: new RegExp("^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$"), decreaseIndentPattern: new RegExp("^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$") } }; var language = { defaultToken: "", tokenPostfix: ".proto", brackets: [ { open: "{", close: "}", token: "delimiter.curly" }, { open: "[", close: "]", token: "delimiter.square" }, { open: "(", close: ")", token: "delimiter.parenthesis" }, { open: "<", close: ">", token: "delimiter.angle" } ], symbols: /[=>/, { token: "@brackets", bracket: "@close", switchTo: "identifier" }] ], field: [ { include: "@whitespace" }, [ "group", { cases: { "$S2==proto2": { token: "keyword", switchTo: "@groupDecl.$S2" } } } ], [/(@identifier)(\s*)(=)/, ["identifier", "white", { token: "delimiter", next: "@pop" }]], [ /@fullIdentifier|\./, { cases: { "@builtinTypes": "keyword", "@default": "type.identifier" } } ] ], groupDecl: [ { include: "@whitespace" }, [/@identifier/, "identifier"], ["=", "operator"], [/{/, { token: "@brackets", bracket: "@open", switchTo: "@messageBody.$S2" }], { include: "@constant" } ], type: [ { include: "@whitespace" }, [/@identifier/, "type.identifier", "@pop"], [/./, "delimiter"] ], identifier: [{ include: "@whitespace" }, [/@identifier/, "identifier", "@pop"]], serviceDecl: [ { include: "@whitespace" }, [/@identifier/, "identifier"], [/{/, { token: "@brackets", bracket: "@open", switchTo: "@serviceBody.$S2" }] ], serviceBody: [ { include: "@whitespace" }, { include: "@constant" }, [/;/, "delimiter"], [/option\b/, "keyword", "@option.$S2"], [/rpc\b/, "keyword", "@rpc.$S2"], [/\[/, { token: "@brackets", bracket: "@open", next: "@options.$S2" }], [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }] ], rpc: [ { include: "@whitespace" }, [/@identifier/, "identifier"], [/\(/, { token: "@brackets", bracket: "@open", switchTo: "@request.$S2" }], [/{/, { token: "@brackets", bracket: "@open", next: "@methodOptions.$S2" }], [/;/, "delimiter", "@pop"] ], request: [ { include: "@whitespace" }, [ /@messageType/, { cases: { stream: { token: "keyword", next: "@type.$S2" }, "@default": "type.identifier" } } ], [/\)/, { token: "@brackets", bracket: "@close", switchTo: "@returns.$S2" }] ], returns: [ { include: "@whitespace" }, [/returns\b/, "keyword"], [/\(/, { token: "@brackets", bracket: "@open", switchTo: "@response.$S2" }] ], response: [ { include: "@whitespace" }, [ /@messageType/, { cases: { stream: { token: "keyword", next: "@type.$S2" }, "@default": "type.identifier" } } ], [/\)/, { token: "@brackets", bracket: "@close", switchTo: "@rpc.$S2" }] ], methodOptions: [ { include: "@whitespace" }, { include: "@constant" }, [/;/, "delimiter"], ["option", "keyword"], [/@optionName/, "annotation"], [/[()]/, "annotation.brackets"], [/=/, "operator"], [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }] ], comment: [ [/[^\/*]+/, "comment"], [/\/\*/, "comment", "@push"], ["\\*/", "comment", "@pop"], [/[\/*]/, "comment"] ], string: [ [/[^\\"]+/, "string"], [/@escapes/, "string.escape"], [/\\./, "string.escape.invalid"], [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }] ], stringSingle: [ [/[^\\']+/, "string"], [/@escapes/, "string.escape"], [/\\./, "string.escape.invalid"], [/'/, { token: "string.quote", bracket: "@close", next: "@pop" }] ], constant: [ ["@boolLit", "keyword.constant"], ["@hexLit", "number.hex"], ["@octalLit", "number.octal"], ["@decimalLit", "number"], ["@floatLit", "number.float"], [/("([^"\\]|\\.)*|'([^'\\]|\\.)*)$/, "string.invalid"], [/"/, { token: "string.quote", bracket: "@open", next: "@string" }], [/'/, { token: "string.quote", bracket: "@open", next: "@stringSingle" }], [/{/, { token: "@brackets", bracket: "@open", next: "@prototext" }], [/identifier/, "identifier"] ], whitespace: [ [/[ \t\r\n]+/, "white"], [/\/\*/, "comment", "@comment"], [/\/\/.*$/, "comment"] ], prototext: [ { include: "@whitespace" }, { include: "@constant" }, [/@identifier/, "identifier"], [/[:;]/, "delimiter"], [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }] ] } }; export { conf, language };