{ "name": "Puppet", "file_extensions": [ "pp" ], "scope": "source.puppet", "contexts": { "main": [ { "include": "line_comment" }, { "match": "^\\s*/\\*", "push": [ { "meta_scope": "comment.block.puppet" }, { "match": "\\*/", "pop": true } ] }, { "match": "(?x)^\\s*\n(node|class)\\s+\n((?:[-_A-Za-z0-9\".]+::)*[-_A-Za-z0-9\".]+)\\s* # identifier", "captures": { "1": "storage.type.puppet", "2": "entity.name.type.class.puppet" }, "push": [ { "meta_scope": "meta.definition.class.puppet" }, { "match": "(?={)", "captures": { "1": "storage.type.puppet", "2": "entity.name.type.class.puppet" }, "pop": true }, { "include": "constants" }, { "include": "strings" }, { "match": "\\b(inherits)\\b\\s+", "captures": { "1": "storage.modifier.puppet" }, "push": [ { "meta_scope": "meta.definition.class.inherits.puppet" }, { "match": "(?={)", "captures": { "1": "storage.modifier.puppet" }, "pop": true }, { "match": "\\b((?:[-_A-Za-z0-9\".]+::)*[-_A-Za-z0-9\".]+)\\b", "scope": "support.type.puppet" } ] } ] }, { "match": "^\\s*(define)\\s+([a-zA-Z0-9_:]+)\\s*(\\()", "captures": { "1": "storage.type.function.puppet", "2": "entity.name.function.puppet", "3": "punctuation.definition.parameters.begin.puppet" }, "push": [ { "meta_scope": "meta.function.puppet" }, { "meta_content_scope": "meta.function.arguments.puppet" }, { "match": "\\)", "captures": { "1": "punctuation.definition.parameters.end.puppet" }, "pop": true }, { "match": "((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\\s*(?=,|\\))", "scope": "meta.function.argument.no-default.puppet", "captures": { "1": "variable.other.puppet", "2": "punctuation.definition.variable.puppet" } }, { "match": "((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)(?:\\s*(=)\\s*)\\s*", "captures": { "1": "variable.other.puppet", "2": "punctuation.definition.variable.puppet", "3": "keyword.operator.assignment.puppet" }, "push": [ { "meta_scope": "meta.function.argument.default.puppet" }, { "match": "(?=,|\\))", "captures": { "1": "variable.other.puppet", "2": "punctuation.definition.variable.puppet", "3": "keyword.operator.assignment.puppet" }, "pop": true }, { "include": "parameter-default-types" } ] } ] }, { "match": "^\\s*(\\w+)\\s*{\\s*(\\$[a-zA-Z_]+)\\s*:", "scope": "meta.definition.resource.puppet", "captures": { "1": "storage.type.puppet", "2": "entity.name.section.puppet" } }, { "match": "^\\s*(\\w+)\\s*{\\s*(['\"].+['\"])\\s*:", "scope": "meta.definition.resource.puppet", "captures": { "1": "storage.type.puppet", "2": "entity.name.section.puppet" } }, { "match": "\\b(case|if|unless|else|elsif)\\s+(?!::)", "scope": "keyword.control.puppet" }, { "match": "((\\$?)\"?[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*\"?):(?=\\s+|$)", "scope": "entity.name.section.puppet" }, { "include": "strings" }, { "include": "variable" }, { "include": "constants" }, { "match": "(?i)\\b(import|include|require)\\s+([::[a-z]]*)\\b\\s*", "captures": { "1": "keyword.control.import.include.puppet" }, "push": [ { "meta_scope": "meta.include.puppet" }, { "match": "(?=\\s|$)", "pop": true } ] }, { "match": "\\b\\w+\\s*(?==>)\\s*", "scope": "constant.other.key.puppet" }, { "match": "(?<={)\\s*\\w+\\s*(?=})", "scope": "constant.other.bareword.puppet" }, { "match": "\\b(escape|gsub|alert|crit|debug|notice|defined|emerg|err|failed|file|generate|info|realize|search|tag|tagged|template|warning)\\b", "scope": "support.function.puppet" } ], "constants": [ { "match": "(?i)\\b(false|true|running|undef|present|absent|file|directory|installed|running|stopped)\\b", "scope": "constant.language.puppet" } ], "double-quoted-string": [ { "match": "\"", "captures": { "0": "punctuation.definition.string.begin.puppet" }, "push": [ { "meta_scope": "string.quoted.double.puppet" }, { "match": "\"", "captures": { "0": "punctuation.definition.string.end.puppet" }, "pop": true }, { "include": "escaped_char" }, { "include": "variable" } ] } ], "escaped_char": [ { "match": "\\\\.", "scope": "constant.character.escape.puppet" } ], "line_comment": [ { "match": "^((#).*$\\n?)", "scope": "meta.comment.full-line.puppet", "captures": { "1": "comment.line.number-sign.puppet", "2": "punctuation.definition.comment.puppet" } }, { "match": "(#).*$\\n?", "scope": "comment.line.number-sign.puppet", "captures": { "1": "punctuation.definition.comment.puppet" } } ], "nested_braces": [ { "match": "\\{", "captures": { "1": "punctuation.section.scope.puppet" }, "push": [ { "match": "\\}", "captures": { "1": "punctuation.section.scope.puppet" }, "pop": true }, { "include": "escaped_char" }, { "include": "nested_braces" } ] } ], "nested_braces_interpolated": [ { "match": "\\{", "captures": { "1": "punctuation.section.scope.puppet" }, "push": [ { "match": "\\}", "captures": { "1": "punctuation.section.scope.puppet" }, "pop": true }, { "include": "escaped_char" }, { "include": "variable" }, { "include": "nested_braces_interpolated" } ] } ], "nested_brackets": [ { "match": "\\[", "captures": { "1": "punctuation.section.scope.puppet" }, "push": [ { "match": "\\]", "captures": { "1": "punctuation.section.scope.puppet" }, "pop": true }, { "include": "escaped_char" }, { "include": "nested_brackets" } ] } ], "nested_brackets_interpolated": [ { "match": "\\[", "captures": { "1": "punctuation.section.scope.puppet" }, "push": [ { "match": "\\]", "captures": { "1": "punctuation.section.scope.puppet" }, "pop": true }, { "include": "escaped_char" }, { "include": "variable" }, { "include": "nested_brackets_interpolated" } ] } ], "nested_parens": [ { "match": "\\(", "captures": { "1": "punctuation.section.scope.puppet" }, "push": [ { "match": "\\)", "captures": { "1": "punctuation.section.scope.puppet" }, "pop": true }, { "include": "escaped_char" }, { "include": "nested_parens" } ] } ], "nested_parens_interpolated": [ { "match": "\\(", "captures": { "1": "punctuation.section.scope.puppet" }, "push": [ { "match": "\\)", "captures": { "1": "punctuation.section.scope.puppet" }, "pop": true }, { "include": "escaped_char" }, { "include": "variable" }, { "include": "nested_parens_interpolated" } ] } ], "parameter-default-types": [ { "include": "strings" }, { "match": "=", "scope": "keyword.operator.assignment.php" }, { "match": "(\\[)", "captures": { "1": "punctuation.definition.array.begin.puppet" }, "push": [ { "meta_scope": "meta.array.php" }, { "match": "\\]", "captures": { "0": "punctuation.definition.array.end.puppet" }, "pop": true }, { "include": "parameter-default-types" } ] }, { "include": "constants" } ], "single-quoted-string": [ { "match": "'", "captures": { "0": "punctuation.definition.string.begin.puppet" }, "push": [ { "meta_scope": "string.quoted.single.puppet" }, { "match": "'", "captures": { "0": "punctuation.definition.string.end.puppet" }, "pop": true }, { "include": "escaped_char" } ] } ], "strings": [ { "include": "double-quoted-string" }, { "include": "single-quoted-string" } ], "variable": [ { "match": "(\\$)([a-zA-Zx7f-xff\\$]|::)([a-zA-Z0-9_x7f-xff\\$]|::)*\\b", "scope": "variable.other.readwrite.global.puppet", "captures": { "1": "punctuation.definition.variable.puppet" } }, { "match": "(\\$\\{)(?:[a-zA-Zx7f-xff\\$]|::)(?:[a-zA-Z0-9_x7f-xff\\$]|::)*(\\})", "scope": "variable.other.readwrite.global.puppet", "captures": { "1": "punctuation.definition.variable.puppet", "2": "punctuation.definition.variable.puppet" } } ] } }