Created
November 9, 2011 10:22
-
-
Save larstobi/1351046 to your computer and use it in GitHub Desktop.
TextMate Language syntax for Puppet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { scopeName = 'source.puppet'; | |
| fileTypes = ( 'pp' ); | |
| foldingStartMarker = '(^\s*/\*|(\{|\[|\()\s*$)'; | |
| foldingStopMarker = '(\*/|^\s*(\}|\]|\)))'; | |
| patterns = ( | |
| { include = '#line_comment'; }, | |
| { name = 'comment.block.puppet'; | |
| begin = '^\s*/\*'; | |
| end = '\*/'; | |
| }, | |
| { name = 'meta.definition.class.puppet'; | |
| begin = '(?x)^\s* | |
| (node|class)\s+ | |
| ((?:[-_A-Za-z0-9".]+::)*[-_A-Za-z0-9".]+)\s* # identifier'; | |
| end = '(?={)'; | |
| captures = { | |
| 1 = { name = 'storage.type.puppet'; }; | |
| 2 = { name = 'entity.name.type.class.puppet'; }; | |
| }; | |
| patterns = ( | |
| { name = 'meta.definition.class.inherits.puppet'; | |
| begin = '\b(inherits)\b\s+'; | |
| end = '(?={)'; | |
| captures = { 1 = { name = 'storage.modifier.puppet'; }; }; | |
| patterns = ( | |
| { name = 'support.type.puppet'; | |
| match = '\b((?:[-_A-Za-z0-9".]+::)*[-_A-Za-z0-9".]+)\b'; | |
| }, | |
| ); | |
| }, | |
| ); | |
| }, | |
| { name = 'meta.function.puppet'; | |
| contentName = 'meta.function.arguments.puppet'; | |
| begin = '^\s*(define)\s+([a-zA-Z0-9_:]+)\s*(\()'; | |
| end = '\)'; | |
| beginCaptures = { | |
| 1 = { name = 'storage.type.function.puppet'; }; | |
| 2 = { name = 'entity.name.function.puppet'; }; | |
| 3 = { name = 'punctuation.definition.parameters.begin.puppet'; }; | |
| }; | |
| endCaptures = { 1 = { name = 'punctuation.definition.parameters.end.puppet'; }; }; | |
| patterns = ( | |
| { name = 'meta.function.argument.no-default.puppet'; | |
| match = '((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*(?=,|\))'; | |
| captures = { | |
| 1 = { name = 'variable.other.puppet'; }; | |
| 2 = { name = 'punctuation.definition.variable.puppet'; }; | |
| }; | |
| }, | |
| { name = 'meta.function.argument.default.puppet'; | |
| begin = '((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(?:\s*(=)\s*)\s*'; | |
| end = '(?=,|\))'; | |
| captures = { | |
| 1 = { name = 'variable.other.puppet'; }; | |
| 2 = { name = 'punctuation.definition.variable.puppet'; }; | |
| 3 = { name = 'keyword.operator.assignment.puppet'; }; | |
| }; | |
| patterns = ( { include = '#parameter-default-types'; } ); | |
| }, | |
| ); | |
| }, | |
| { name = 'meta.definition.resource.puppet'; | |
| match = '^\s*(\w+)\s*{\s*([''"].+[''"]):'; | |
| captures = { | |
| 1 = { name = 'storage.type.puppet'; }; | |
| 2 = { name = 'entity.name.section.puppet'; }; | |
| }; | |
| }, | |
| { name = 'keyword.control.puppet'; | |
| match = '\b(case|if|else)(?!::)'; | |
| }, | |
| { name = 'entity.name.section.puppet'; | |
| match = '((\$?)"?[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*"?):(?=\s+|$)'; | |
| }, | |
| { include = '#strings'; }, | |
| { include = '#variable'; }, | |
| { name = 'meta.include.puppet'; | |
| begin = '(?i)\b(import|include)\b\s*'; | |
| end = '(?=\s|$)'; | |
| beginCaptures = { 1 = { name = 'keyword.control.import.include.puppet'; }; }; | |
| }, | |
| { name = 'constant.other.key.puppet'; | |
| match = '\b\w+\s*(?==>)\s*'; | |
| }, | |
| { name = 'constant.other.bareword.puppet'; | |
| match = '(?<={)\s*\w+\s*(?=})'; | |
| }, | |
| { name = 'support.function.puppet'; | |
| match = '\b(escape|gsub|alert|crit|debug|notice|defined|emerg|err|failed|file|generate|include|info|realize|search|tag|tagged|template|warning)\b'; | |
| }, | |
| ); | |
| repository = { | |
| constants = { | |
| patterns = ( | |
| { name = 'constant.language.php'; | |
| match = '(?i)\b(false|true|running|present|absent|file|directory)\b'; | |
| }, | |
| ); | |
| }; | |
| double-quoted-string = { | |
| name = 'string.quoted.double.puppet'; | |
| begin = '"'; | |
| end = '"'; | |
| beginCaptures = { 0 = { name = 'punctuation.definition.string.begin.puppet'; }; }; | |
| endCaptures = { 0 = { name = 'punctuation.definition.string.end.puppet'; }; }; | |
| patterns = ( | |
| { include = '#escaped_char'; }, | |
| { include = '#variable'; }, | |
| ); | |
| }; | |
| escaped_char = { | |
| name = 'constant.character.escape.puppet'; | |
| match = '\\.'; | |
| }; | |
| line_comment = { | |
| patterns = ( | |
| { name = 'meta.comment.full-line.puppet'; | |
| match = '^((#).*$\n?)'; | |
| captures = { | |
| 1 = { name = 'comment.line.number-sign.puppet'; }; | |
| 2 = { name = 'punctuation.definition.comment.puppet'; }; | |
| }; | |
| }, | |
| { name = 'comment.line.number-sign.puppet'; | |
| match = '(#).*$\n?'; | |
| captures = { 1 = { name = 'punctuation.definition.comment.puppet'; }; }; | |
| }, | |
| ); | |
| }; | |
| nested_braces = { | |
| begin = '\{'; | |
| end = '\}'; | |
| captures = { 1 = { name = 'punctuation.section.scope.puppet'; }; }; | |
| patterns = ( | |
| { include = '#escaped_char'; }, | |
| { include = '#nested_braces'; }, | |
| ); | |
| }; | |
| nested_braces_interpolated = { | |
| begin = '\{'; | |
| end = '\}'; | |
| captures = { 1 = { name = 'punctuation.section.scope.puppet'; }; }; | |
| patterns = ( | |
| { include = '#escaped_char'; }, | |
| { include = '#variable'; }, | |
| { include = '#nested_braces_interpolated'; }, | |
| ); | |
| }; | |
| nested_brackets = { | |
| begin = '\['; | |
| end = '\]'; | |
| captures = { 1 = { name = 'punctuation.section.scope.puppet'; }; }; | |
| patterns = ( | |
| { include = '#escaped_char'; }, | |
| { include = '#nested_brackets'; }, | |
| ); | |
| }; | |
| nested_brackets_interpolated = { | |
| begin = '\['; | |
| end = '\]'; | |
| captures = { 1 = { name = 'punctuation.section.scope.puppet'; }; }; | |
| patterns = ( | |
| { include = '#escaped_char'; }, | |
| { include = '#variable'; }, | |
| { include = '#nested_brackets_interpolated'; }, | |
| ); | |
| }; | |
| nested_parens = { | |
| begin = '\('; | |
| end = '\)'; | |
| captures = { 1 = { name = 'punctuation.section.scope.puppet'; }; }; | |
| patterns = ( | |
| { include = '#escaped_char'; }, | |
| { include = '#nested_parens'; }, | |
| ); | |
| }; | |
| nested_parens_interpolated = { | |
| begin = '\('; | |
| end = '\)'; | |
| captures = { 1 = { name = 'punctuation.section.scope.puppet'; }; }; | |
| patterns = ( | |
| { include = '#escaped_char'; }, | |
| { include = '#variable'; }, | |
| { include = '#nested_parens_interpolated'; }, | |
| ); | |
| }; | |
| parameter-default-types = { | |
| patterns = ( | |
| { include = '#strings'; }, | |
| { include = '#numbers'; }, | |
| { include = '#variables'; }, | |
| { name = 'keyword.operator.assignment.php'; | |
| match = '='; | |
| }, | |
| { name = 'meta.array.php'; | |
| begin = '(\[)'; | |
| end = '\]'; | |
| beginCaptures = { 1 = { name = 'punctuation.definition.array.begin.puppet'; }; }; | |
| endCaptures = { 0 = { name = 'punctuation.definition.array.end.puppet'; }; }; | |
| patterns = ( { include = '#parameter-default-types'; } ); | |
| }, | |
| { include = '#constants'; }, | |
| ); | |
| }; | |
| single-quoted-string = { | |
| name = 'string.quoted.single.puppet'; | |
| begin = "'"; | |
| end = "'"; | |
| beginCaptures = { 0 = { name = 'punctuation.definition.string.begin.puppet'; }; }; | |
| endCaptures = { 0 = { name = 'punctuation.definition.string.end.puppet'; }; }; | |
| patterns = ( { include = '#escaped_char'; } ); | |
| }; | |
| strings = { | |
| patterns = ( | |
| { include = '#double-quoted-string'; }, | |
| { include = '#single-quoted-string'; }, | |
| ); | |
| }; | |
| variable = { | |
| patterns = ( | |
| { name = 'variable.other.readwrite.global.puppet'; | |
| match = '(\$)([a-zA-Zx7f-xff\$]|::)([a-zA-Z0-9_x7f-xff\$]|::)*\b'; | |
| captures = { 1 = { name = 'punctuation.definition.variable.puppet'; }; }; | |
| }, | |
| { name = 'variable.other.readwrite.global.puppet'; | |
| match = '(\$\{)(?:[a-zA-Zx7f-xff\$]|::)(?:[a-zA-Z0-9_x7f-xff\$]|::)*(\})'; | |
| captures = { | |
| 1 = { name = 'punctuation.definition.variable.puppet'; }; | |
| 2 = { name = 'punctuation.definition.variable.puppet'; }; | |
| }; | |
| }, | |
| ); | |
| }; | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment