site/node_modules/shiki/dist/langs/stata.mjs

12 lines
62 KiB
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
import sql from './sql.mjs';
const lang = Object.freeze({ "displayName": "Stata", "fileTypes": ["do", "ado", "mata"], "foldingStartMarker": "\\{\\s*$", "foldingStopMarker": "^\\s*\\}", "name": "stata", "patterns": [{ "include": "#ascii-regex-functions" }, { "include": "#unicode-regex-functions" }, { "include": "#constants" }, { "include": "#functions" }, { "include": "#comments" }, { "include": "#subscripts" }, { "include": "#operators" }, { "include": "#macro-local" }, { "include": "#macro-global" }, { "include": "#string-compound" }, { "include": "#string-regular" }, { "include": "#builtin_variables" }, { "include": "#macro-commands" }, { "comment": "keywords that delimit flow conditionals", "match": "\\b(if|else if|else)\\b", "name": "keyword.control.conditional.stata" }, { "captures": { "1": { "name": "storage.type.scalar.stata" } }, "match": "^\\s*(sca(lar|la|l)?(\\s+de(fine|fin|fi|f)?)?)\\s+(?!(drop|dir?|l(ist|is|i)?)\\s+)" }, { "begin": "\\b(mer(ge|g)?)\\s+(1|m|n)(:)(1|m|n)", "beginCaptures": { "1": { "name": "keyword.control.flow.stata" }, "3": { "patterns": [{ "include": "#constants" }, { "match": "m|n", "name": "" }] }, "4": { "name": "punctuation.separator.key-value" }, "5": { "patterns": [{ "include": "#constants" }, { "match": "m|n", "name": "" }] } }, "end": "using", "patterns": [{ "include": "#builtin_variables" }, { "include": "#macro-local" }, { "include": "#macro-global" }, { "include": "#comments" }] }, { "captures": { "1": { "name": "keyword.control.flow.stata" }, "2": { "patterns": [{ "include": "#macro-local-identifiers" }, { "include": "#macro-local" }, { "include": "#macro-global" }] }, "3": { "name": "keyword.control.flow.stata" } }, "match": "\\b(foreach)\\s+((?!in|of).+)\\s+(in|of var(list|lis|li|l)?|of new(list|lis|li|l)?|of num(list|lis|li|l)?)\\b" }, { "begin": "\\b(foreach)\\s+((?!in|of).+)\\s+(of loc(al|a)?|of glo(bal|ba|b)?)\\b\\s*", "beginCaptures": { "1": { "name": "keyword.control.flow.stata" }, "2": { "patterns": [{ "include": "#macro-local-identifiers" }, { "include": "#macro-local" }, { "include": "#macro-global" }] }, "3": { "name": "keyword.control.flow.stata" } }, "end": "(?=\\s*\\{)", "patterns": [{ "include": "#macro-local-identifiers" }, { "include": "#macro-local" }, { "include": "#macro-global" }] }, { "begin": "\\b(forvalues|forvalue|forvalu|forval|forva|forv)\\s*", "beginCaptures": { "1": { "name": "keyword.control.flow.stata" } }, "end": "\\s*(=)\\s*([^\\{]+)\\s*|(?=\\n)", "endCaptures": { "1": { "name": "keyword.operator.assignment.stata" }, "2": { "patterns": [{ "include": "#constants" }, { "include": "#operators" }, { "include": "#macro-local" }, { "include": "#macro-global" }] } }, "patterns": [{ "include": "#macro-local-identifiers" }, { "include": "#macro-local" }, { "include": "#macro-global" }] }, { "comment": "keywords that delimit loops", "match": "\\b(while|continue)\\b", "name": "keyword.control.flow.stata" }, { "captures": { "1": { "name": "keyword.other.stata" } }, "comment": "keywords that haven't fit into other groups (yet).", "match": "\\b(as|ass|asse|asser|assert)\\b" }, { "comment": "prefixes that require a colon", "match": "\\b(by(sort|sor|so|s)?|statsby|rolling|bootstrap|jackknife|permute|simulate|svy|mi est(imate|imat|ima|im|i)?|nestreg|stepwise|xi|fp|mfp|vers(ion|io|i)?)\\b", "name": "storage.type.function.stata" }, { "comment": "prefixes that don't need a colon", "match": "\\b(qui(etly|etl|et|e)?|n(oisily|oisil|oisi|ois|oi|o)?|cap(ture|tur|tu|t)?)\\b:?", "name": "keyword.control.flow.stata" }, { "captures": { "1": { "name": "storage.type.function.stata" }, "3": { "name": "storage.type.function.stata" }, "7": { "name": "entity.name.function.stata" } }, "match": "\\s*(pr(ogram|ogra|ogr|og|o)?)\\s+((di(r)?|drop|l(ist|is|i)?)\\s+)([\\w&&[^0-9]]\\w{0,31})" }, { "begin": "^\\s*(pr(ogram|ogra|ogr|og|o)?)\\s+(de(fine|fin|fi|f)?\\s+)?", "beginCaptures": { "1": { "name": "storage.type.function.stata" }, "3": { "name": "storage.type.function.stata" } }, "end": "(?=,|\\n|/)", "patterns": [{ "include": "#macro-local" }, { "include": "#macro-global" }, { "match": "[\\w&&[^0-9]]\\w{0,31}",
)`, "endCaptures": { "0": { "name": "punctuation.definition.string.end.stata" } }, "name": "string.quoted.double.compound.stata", "patterns": [{ "comment": 'This must come before #string-regular and #string-compound to accurately color `"""\' in strings', "match": '"', "name": "string.quoted.double.compound.stata" }, { "comment": "see https://github.com/kylebarron/language-stata/issues/53", "match": "```(?=[^']*\")", "name": "meta.markdown.code.block.stata" }, { "include": "#string-regular" }, { "include": "#string-compound" }, { "include": "#macro-local-escaped" }, { "include": "#macro-global-escaped" }, { "include": "#macro-local" }, { "include": "#macro-global" }] }] }, "string-regular": { "patterns": [{ "begin": '(?<!`)"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.stata" } }, "end": `(")(')?|(?=
)`, "endCaptures": { "1": { "name": "punctuation.definition.string.end.stata" }, "2": { "name": "invalid.illegal.punctuation.stata" } }, "name": "string.quoted.double.stata", "patterns": [{ "comment": "see https://github.com/kylebarron/language-stata/issues/53", "match": "```(?=[^']*\")", "name": "meta.markdown.code.block.stata" }, { "include": "#macro-local-escaped" }, { "include": "#macro-global-escaped" }, { "include": "#macro-local" }, { "include": "#macro-global" }] }] }, "subscripts": { "patterns": [{ "begin": "(?<=[\\w'])(\\[)", "beginCaptures": { "1": { "name": "punctuation.definition.parameters.begin.stata" } }, "comment": "highlight expressions, like [_n], when using subscripts on a variable", "end": "(\\])", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.stata" } }, "name": "meta.subscripts.stata", "patterns": [{ "include": "#macro-local" }, { "include": "#macro-global" }, { "include": "#builtin_variables" }, { "include": "#operators" }, { "include": "#constants" }, { "include": "#functions" }] }] }, "unicode-regex-character-class": { "patterns": [{ "match": "\\\\[wWsSdD]|\\.", "name": "constant.character.character-class.stata" }, { "match": "\\\\.", "name": "constant.character.escape.backslash.stata" }, { "begin": "(\\[)(\\^)?", "beginCaptures": { "1": { "name": "punctuation.definition.character-class.stata" }, "2": { "name": "keyword.operator.negation.stata" } }, "end": "(\\])", "endCaptures": { "1": { "name": "punctuation.definition.character-class.stata" } }, "name": "constant.other.character-class.set.stata", "patterns": [{ "include": "#unicode-regex-character-class" }, { "captures": { "2": { "name": "constant.character.escape.backslash.stata" }, "4": { "name": "constant.character.escape.backslash.stata" } }, "match": "((\\\\.)|.)\\-((\\\\.)|[^\\]])", "name": "constant.other.character-class.range.stata" }] }] }, "unicode-regex-functions": { "patterns": [{ "captures": { "1": { "name": "support.function.builtin.stata" }, "2": { "name": "punctuation.definition.parameters.begin.stata" }, "3": { "patterns": [{ "include": "#string-compound" }, { "include": "#string-regular" }, { "include": "#macro-local" }, { "include": "#macro-global" }, { "include": "#functions" }, { "match": "[\\w&&[^0-9]]\\w{0,31}", "name": "variable.parameter.function.stata" }, { "include": "#comments-triple-slash" }] }, "4": { "name": "punctuation.definition.variable.begin.stata" }, "5": { "name": "punctuation.definition.string.begin.stata" }, "6": { "patterns": [{ "include": "#unicode-regex-internals" }] }, "7": { "name": "punctuation.definition.string.end.stata" }, "8": { "name": "invalid.illegal.punctuation.stata" }, "9": { "patterns": [{ "include": "#constants" }, { "match": ",", "name": "punctuation.definition.variable.begin.stata" }] }, "10": { "name": "punctuation.definition.parameters.end.stata" } }, "comment": 'color regexm with regular quotes i.e. " ', "match": `\\b(ustrregexm)(\\()([^,]+)(,)\\s*(")([^"]+)("(')?)([,0-9\\s]*)?\\s*(\\))` }, { "captures": { "1": { "name": "support.function.builtin.stata" }, "2": { "name": "punctuation.definition.parameters.begin.stata" }, "3": { "patterns": [{ "include": "#string-compound" }, { "include": "#string-regular" }, { "include": "#macro-local" }, { "include": "#macro-global" }, { "include": "#functions" }, { "match": "[\\w&&[^0-9]]\\w{0,31}", "name": "variable.parameter.function.stata" }, { "include": "#comments-triple-slash" }] }, "4": { "name": "punctuation.definition.variable.begin.stata" }, "5": { "name": "punctuation.definition.string.begin.stata" }, "6": { "patterns": [{ "include": "#unicode-regex-internals" }] }, "7": { "name": "punctuation.definition.string.end.stata" }, "8": { "patterns": [{ "include": "#constants" }, { "match": ",", "name": "punctuation.definition.variable.begin.stata" }] }, "9": { "name": "punctuation.definition.parameters.end.stata" } }, "comment": "color regexm with compound quotes", "match": '\\b(ustrregexm)(\\()([^,]+)(,)\\s*(`")([^"]+)("\')([,0-9\\s]*)?\\s*(\\))' }, { "captures": { "1": { "name": "support.function.builtin.stata" },
var stata = [
...sql,
lang
];
export { stata as default };