prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
39 lines (38 loc) • 1.38 kB
JavaScript
import { a as languages } from "../../core-8vQkh0Rd.js";
import { n as extend, r as insertBefore } from "../../language-D-vtM55V.js";
import { o as dotPunctuation } from "../../patterns-C0vJBvXO.js";
import "./clike.js";
//#region src/prism/languages/protobuf.js
var builtinTypes = /\b(?:bool|bytes|double|s?fixed(?:32|64)|float|[su]?int(?:32|64)|string)\b/;
insertBefore(languages.protobuf = extend("clike", {
"class-name": [{
pattern: /(\b(?:enum|extend|message|service)\s+)(?!\d)\w+(?=\s*\{)/,
lookbehind: true
}, {
pattern: /(\b(?:rpc\s+\w+|returns)\s*\(\s*(?:stream\s+)?)\.?(?!\d)\w+(?:\.(?!\d)\w+)*(?=\s*\))/,
lookbehind: true
}],
"keyword": /\b(?:enum|extend|extensions|import|message|oneof|option|optional|package|public|repeated|required|reserved|returns|rpc(?=\s+\w)|service|stream|syntax|to)\b(?!\s*=\s*\d)/,
"function": /\b[a-z_]\w*(?=\s*\()/i
}), "operator", {
"map": {
pattern: /\bmap<\s*[\w.]+\s*,\s*[\w.]+\s*>(?=\s+[a-z_]\w*\s*[=;])/i,
alias: "class-name",
inside: {
"punctuation": /[<>.,]/,
"builtin": builtinTypes
}
},
"builtin": builtinTypes,
"positional-class-name": {
pattern: /(?:\b|\B\.)[a-z_]\w*(?:\.[a-z_]\w*)*(?=\s+[a-z_]\w*\s*[=;])/i,
alias: "class-name",
inside: dotPunctuation
},
"annotation": {
pattern: /(\[\s*)[a-z_]\w*(?=\s*=)/i,
lookbehind: true
}
});
//#endregion
//# sourceMappingURL=protobuf.js.map