diff --git a/l4d2web/l4d2web/static/js/srccfg-grammar.js b/l4d2web/l4d2web/static/js/srccfg-grammar.js new file mode 100644 index 0000000..7f8326e --- /dev/null +++ b/l4d2web/l4d2web/static/js/srccfg-grammar.js @@ -0,0 +1,17 @@ +// Prism grammar for Source-engine config files (server.cfg-style). +// Tokens: comment, string, number, keyword, identifier. Purely visual — +// no semantic validation of cvars or values. +(function (Prism) { + if (!Prism) return; + Prism.languages.srccfg = { + comment: /\/\/.*/, + string: { + pattern: /"(?:\\.|[^"\\])*"/, + greedy: true, + }, + keyword: /\b(?:exec|alias|bind|unbind|toggle)\b/, + number: /\b-?\d+(?:\.\d+)?\b/, + identifier: /\b[a-zA-Z_][a-zA-Z0-9_]*\b/, + operator: /[+\-;]/, + }; +})(typeof window !== "undefined" ? window.Prism : undefined);