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

7 lines
12 KiB
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
const lang = Object.freeze({ "displayName": "HashiCorp HCL", "fileTypes": ["hcl"], "name": "hcl", "patterns": [{ "include": "#comments" }, { "include": "#attribute_definition" }, { "include": "#block" }, { "include": "#expressions" }], "repository": { "attribute_access": { "begin": "\\.(?!\\*)", "beginCaptures": { "0": { "name": "keyword.operator.accessor.hcl" } }, "comment": "Matches traversal attribute access such as .attr", "end": "[[:alpha:]][\\w-]*|\\d*", "endCaptures": { "0": { "patterns": [{ "comment": "Attribute name", "match": "(?!null|false|true)[[:alpha:]][\\w-]*", "name": "variable.other.member.hcl" }, { "comment": "Optional attribute index", "match": "\\d+", "name": "constant.numeric.integer.hcl" }] } } }, "attribute_definition": { "captures": { "1": { "name": "punctuation.section.parens.begin.hcl" }, "2": { "name": "variable.other.readwrite.hcl" }, "3": { "name": "punctuation.section.parens.end.hcl" }, "4": { "name": "keyword.operator.assignment.hcl" } }, "comment": 'Identifier "=" with optional parens', "match": "(\\()?(\\b(?!null\\b|false\\b|true\\b)[[:alpha:]][[:alnum:]_-]*)(\\))?\\s*(\\=(?!\\=|\\>))\\s*", "name": "variable.declaration.hcl" }, "attribute_splat": { "begin": "\\.", "beginCaptures": { "0": { "name": "keyword.operator.accessor.hcl" } }, "comment": "Legacy attribute-only splat", "end": "\\*", "endCaptures": { "0": { "name": "keyword.operator.splat.hcl" } } }, "block": { "begin": "([\\w][\\-\\w]*)([^?\\r\\n]*)(\\{)", "beginCaptures": { "1": { "patterns": [{ "comment": "Block type", "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b", "name": "entity.name.type.hcl" }] }, "2": { "patterns": [{ "comment": "Block label (String Literal)", "match": '\\"[^\\"\\r\\n]*\\"', "name": "variable.other.enummember.hcl" }, { "comment": "Block label (Indentifier)", "match": "[[:alpha:]][[:alnum:]_-]*", "name": "variable.other.enummember.hcl" }] }, "3": { "name": "punctuation.section.block.begin.hcl" } }, "comment": 'This will match HCL blocks like `thing1 "one" "two" {` or `thing2 {`', "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.hcl" } }, "name": "meta.block.hcl", "patterns": [{ "include": "#comments" }, { "include": "#attribute_definition" }, { "include": "#expressions" }, { "include": "#block" }] }, "block_inline_comments": { "begin": "/\\*", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Inline comments start with the /* sequence and end with the */ sequence, and may have any characters within except the ending sequence. An inline comment is considered equivalent to a whitespace sequence", "end": "\\*/", "name": "comment.block.hcl" }, "brackets": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.section.brackets.begin.hcl" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.section.brackets.end.hcl" } }, "patterns": [{ "comment": "Splat operator", "match": "\\*", "name": "keyword.operator.splat.hcl" }, { "include": "#comma" }, { "include": "#comments" }, { "include": "#inline_for_expression" }, { "include": "#inline_if_expression" }, { "include": "#expressions" }, { "include": "#local_identifiers" }] }, "char_escapes": { "comment": "Character Escapes", "match": '\\\\[nrt"\\\\]|\\\\u(\\h{8}|\\h{4})', "name": "constant.character.escape.hcl" }, "comma": { "comment": "Commas - used in certain expressions", "match": "\\,", "name": "punctuation.separator.hcl" }, "comments": { "patterns": [{ "include": "#hash_line_comments" }, { "include": "#double_slash_line_comments" }, { "include": "#block_inline_comments" }] }, "double_slash_line_comments": { "begin": "//", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Line comments start with // sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence", "end": "$\\n?", "name": "comment.line.double-slash.hcl" }, "expressions": { "patterns": [{ "include": "#literal_values" }, { "include": "#operators" }, { "include": "#tuple_for_expression" }, { "include": "#object_for_expression" },
var hcl = [
lang
];
export { hcl as default };