-
Notifications
You must be signed in to change notification settings - Fork 31
Update puppet grammar #25
base: master
Are you sure you want to change the base?
Changes from 23 commits
4c14244
41f07fd
35ec1f9
1c74618
1d7da0a
a9f7440
946d88d
28f8161
9df8e8b
b16aa7d
740c99b
41f12dd
9961831
0a0b64b
8ea2501
1479153
3b9b4da
bea13b8
3f10a45
d11a95f
29f56a8
8cfa4c5
ebbbc22
29c534a
96d96f3
4a06bad
9eb735f
b2bab8d
fb01c5f
3bf1972
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,99 +12,85 @@ | |
{ | ||
'include': '#constants' | ||
} | ||
{ | ||
'include': '#numbers' | ||
} | ||
{ | ||
'include': '#hash' | ||
} | ||
{ | ||
'begin': '^\\s*/\\*' | ||
'end': '\\*/' | ||
'name': 'comment.block.puppet' | ||
} | ||
{ | ||
'begin': '^\\s*(node|class)\\s+((?:[-_A-Za-z0-9"\'.]+::)*[-_A-Za-z0-9"\'.]+)\\s*' | ||
'captures': | ||
'begin': '^\\s*(node|define|class|application)\\s+((?:[-_A-Za-z0-9"\'.]+::)*[-_A-Za-z0-9"\'.]+)\\s*' | ||
'beginCaptures': | ||
'1': | ||
'name': 'storage.type.puppet' | ||
'2': | ||
'name': 'entity.name.type.class.puppet' | ||
'end': '(?={)' | ||
'endCaptures': | ||
'0': | ||
'name': 'punctuation.definition.class.begin.puppet' | ||
'end': '{' | ||
'name': 'meta.definition.class.puppet' | ||
'patterns': [ | ||
{ | ||
'begin': '\\b(inherits)\\b\\s+' | ||
'captures': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be |
||
'1': | ||
'name': 'storage.modifier.puppet' | ||
'end': '(?={)' | ||
'end': '{' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we give a capture to this? |
||
'name': 'meta.definition.class.inherits.puppet' | ||
'patterns': [ | ||
{ | ||
'match': '\\b((?:[-_A-Za-z0-9".]+::)*[-_A-Za-z0-9".]+)\\b' | ||
'name': 'support.type.puppet' | ||
'name': 'entity.name.type.class.puppet' | ||
} | ||
] | ||
} | ||
{ | ||
'captures': | ||
'1': | ||
'name': 'variable.other.puppet' | ||
'2': | ||
'name': 'punctuation.definition.variable.puppet' | ||
'match': '((\\$+)[a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=,|\\))' | ||
'name': 'meta.function.argument.no-default.puppet' | ||
} | ||
{ | ||
'begin': '((\\$+)[a-zA-Z_][a-zA-Z0-9_]*)(?:\\s*(=)\\s*)\\s*' | ||
'captures': | ||
'1': | ||
'name': 'variable.other.puppet' | ||
'2': | ||
'name': 'punctuation.definition.variable.puppet' | ||
'3': | ||
'name': 'keyword.operator.assignment.puppet' | ||
'end': '(?=,|\\))' | ||
'name': 'meta.function.argument.default.puppet' | ||
'patterns': [ | ||
{ | ||
'include': '#parameter-default-types' | ||
} | ||
] | ||
'include': '#defineparameters' | ||
} | ||
] | ||
} | ||
{ | ||
'begin': '^\\s*(define)\\s+([a-zA-Z0-9_:]+)\\s*(\\()' | ||
'beginCaptures': | ||
'1': | ||
'name': 'storage.type.function.puppet' | ||
'2': | ||
'name': 'entity.name.function.puppet' | ||
'3': | ||
'name': 'punctuation.definition.parameters.begin.puppet' | ||
'contentName': 'meta.function.arguments.puppet' | ||
'end': '\\)' | ||
'endCaptures': | ||
'1': | ||
'name': 'punctuation.definition.parameters.end.puppet' | ||
'name': 'meta.function.puppet' | ||
'name': 'storage.type.puppet' | ||
'begin': '((?:[-_A-Za-z0-9".]+::)*[-_A-Za-z0-9".]+)\\s*{' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
'name': 'meta.definition.resource.puppet' | ||
'end': '}' | ||
'patterns': [ | ||
{ | ||
'captures': | ||
'1': | ||
'name': 'variable.other.puppet' | ||
'2': | ||
'name': 'punctuation.definition.variable.puppet' | ||
'match': '((\\$+)[a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=,|\\))' | ||
'name': 'meta.function.argument.no-default.puppet' | ||
'name': 'punctuation.classtitle.puppet' | ||
'match': '(:)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. match should go before captures |
||
'name': 'meta.title.puppet' | ||
} | ||
{ | ||
'begin': '((\\$+)[a-zA-Z_][a-zA-Z0-9_]*)(?:\\s*(=)\\s*)\\s*' | ||
'captures': | ||
'include': '#line_comment' | ||
} | ||
{ | ||
'include': '#strings' | ||
} | ||
{ | ||
'include': '#variables' | ||
} | ||
{ | ||
'include': '#metaparameters' | ||
} | ||
{ | ||
'beginCaptures': | ||
'1': | ||
'name': 'variable.other.puppet' | ||
'name': 'name.parameter.resource.puppet' | ||
'2': | ||
'name': 'punctuation.definition.variable.puppet' | ||
'3': | ||
'name': 'keyword.operator.assignment.puppet' | ||
'end': '(?=,|\\))' | ||
'name': 'meta.function.argument.default.puppet' | ||
'name': 'punctuation.separator.key-value.puppet' | ||
'begin': '(\\w+)\\s*(=>)' | ||
'name': 'meta.parameter.resource.puppet' | ||
'end': ',|\\n|;' | ||
'patterns': [ | ||
{ | ||
'include': '#parameter-default-types' | ||
|
@@ -114,17 +100,7 @@ | |
] | ||
} | ||
{ | ||
'captures': | ||
'1': | ||
'name': 'storage.type.puppet' | ||
'2': | ||
'name': 'entity.name.section.puppet' | ||
'match': '^\\s*(\\w+)\\s*{\\s*([\'"].+[\'"]):' | ||
'name': 'meta.definition.resource.puppet' | ||
} | ||
{ | ||
'match': '\\b(case|if|else|elsif)(?!::)\\b' | ||
'name': 'keyword.control.puppet' | ||
'include': '#conditionals' | ||
} | ||
{ | ||
'include': '#strings' | ||
|
@@ -134,7 +110,7 @@ | |
'name': 'entity.name.section.puppet' | ||
} | ||
{ | ||
'include': '#variable' | ||
'include': '#variables' | ||
} | ||
{ | ||
'begin': '(?i)\\b(import|include)\\b\\s*' | ||
|
@@ -144,29 +120,31 @@ | |
'end': '(?=\\s|$)' | ||
'name': 'meta.include.puppet' | ||
} | ||
{ | ||
'match': '\\b\\w+\\s*(?==>)\\s*' | ||
'name': 'constant.other.key.puppet' | ||
} | ||
{ | ||
'match': '(?<={)\\s*\\w+\\s*(?=})' | ||
'name': 'constant.other.bareword.puppet' | ||
} | ||
{ | ||
'match': '(?i)\\b(alert|contain|crit|debug|defined|emerg|err|escape|fail|failed|file|generate|gsub|include|info|notice|package|realize|search|tag|tagged|template|warning)\\b' | ||
'name': 'support.function.puppet' | ||
'include': '#assignments' | ||
} | ||
{ | ||
'match': '=>' | ||
'name': 'punctuation.separator.key-value.puppet' | ||
'include': '#functions' | ||
} | ||
] | ||
'repository': | ||
'constants': | ||
'functions': | ||
'beginCaptures': | ||
'0': | ||
'name': 'support.function.puppet' | ||
'endCaptures': | ||
'0': | ||
'name': 'support.function.puppet' | ||
'begin': '(?:^|\\s|\\W)(\\w+)\\s*\\(' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you scope the parentheses here? |
||
'end': '\\)' | ||
'name': 'meta.function.puppet' | ||
'patterns': [ | ||
{ | ||
'match': '(?i)\\b(absent|directory|false|file|present|running|stopped|true)\\b' | ||
'name': 'constant.language.puppet' | ||
'include': '#parameter-default-types' | ||
} | ||
] | ||
'double-quoted-string': | ||
|
@@ -184,7 +162,7 @@ | |
'include': '#escaped_char' | ||
} | ||
{ | ||
'include': '#variable' | ||
'include': '#variables' | ||
} | ||
] | ||
'escaped_char': | ||
|
@@ -234,7 +212,7 @@ | |
'include': '#escaped_char' | ||
} | ||
{ | ||
'include': '#variable' | ||
'include': '#variables' | ||
} | ||
{ | ||
'include': '#nested_braces_interpolated' | ||
|
@@ -265,7 +243,7 @@ | |
'include': '#escaped_char' | ||
} | ||
{ | ||
'include': '#variable' | ||
'include': '#variables' | ||
} | ||
{ | ||
'include': '#nested_brackets_interpolated' | ||
|
@@ -296,7 +274,7 @@ | |
'include': '#escaped_char' | ||
} | ||
{ | ||
'include': '#variable' | ||
'include': '#variables' | ||
} | ||
{ | ||
'include': '#nested_parens_interpolated' | ||
|
@@ -320,14 +298,7 @@ | |
'include': '#array' | ||
} | ||
{ | ||
'begin': '([a-zA-Z_][a-zA-Z0-9_]*)(\\()' | ||
'end': '(\\))' | ||
'name': 'meta.function.puppet' | ||
'patterns': [ | ||
{ | ||
'include': '#parameter-default-types' | ||
} | ||
] | ||
'include': "#functions" | ||
} | ||
{ | ||
'include': '#constants' | ||
|
@@ -352,19 +323,22 @@ | |
} | ||
'hash': | ||
{ | ||
'begin': '\\{' | ||
'begin': '{' | ||
'beginCaptures': | ||
'0': | ||
'name': 'punctuation.definition.hash.begin.puppet' | ||
'end': '\\}' | ||
'end': '}' | ||
'endCaptures': | ||
'0': | ||
'name': 'punctuation.definition.hash.end.puppet' | ||
'name': 'meta.hash.puppet' | ||
'patterns': [ | ||
{ | ||
'match': '\\b\\w+\\s*(?==>)\\s*' | ||
'name': 'constant.other.key.puppet' | ||
'captures': | ||
'0': | ||
'name': 'punctuation.separator.key-value.puppet' | ||
'match': '=>' | ||
'name': 'meta.punctuation.hash.puppet' | ||
} | ||
{ | ||
'include': '#parameter-default-types' | ||
|
@@ -395,7 +369,7 @@ | |
'include': '#single-quoted-string' | ||
} | ||
] | ||
'variable': | ||
'variables': | ||
'patterns': [ | ||
{ | ||
'captures': | ||
|
@@ -414,3 +388,77 @@ | |
'name': 'variable.other.readwrite.global.puppet' | ||
} | ||
] | ||
'constants': | ||
'beginCaptures': | ||
'0': | ||
'name': 'constant.support.puppet' | ||
'begin': '((?:[-_A-Za-z0-9"\'.]+::)*[-_A-Za-z0-9"\'.]+)\\[' | ||
'endCaptures': | ||
'0': | ||
'name': 'constant.support.puppet' | ||
'end': '\\]' | ||
'patterns': [ | ||
{ | ||
'include': '#strings' | ||
} | ||
{ | ||
'include': '#variables' | ||
} | ||
] | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra newline here |
||
'conditionals': | ||
'patterns': [ | ||
{ | ||
'include': '#comparisons' | ||
} | ||
{ | ||
'include': '#cases' | ||
} | ||
] | ||
'comparisons': | ||
'beginCaptures': | ||
'2': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be |
||
'name': 'keyword.control.puppet' | ||
'begin': '(^|\\s)\\s*(if|else|unless|elsif)\\s+' | ||
'end': '{' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should have a scope |
||
'patterns': [ | ||
{ | ||
'include': '#parameter-default-types' | ||
} | ||
{ | ||
'include': '#comparisonoperators' | ||
} | ||
{ | ||
'include': '#negationoperators' | ||
} | ||
] | ||
'comparisonoperators': | ||
'match': '(?:\\s|^)(={2}|!=|>|<|>=|<=|=~|!~|in)(?:\\s|^)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
'name': 'keyword.control.puppet' | ||
'negationoperators': | ||
'captures': | ||
'1': | ||
'name': 'negation.keyword.control.puppet' | ||
'match': '(?:\\s|^)(not|!)(?:\\s|^)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
'name': 'meta.keyword.control.puppet' | ||
'numbers': | ||
'captures': | ||
'1': | ||
'name': 'number.constant.puppet' | ||
'match': '(?:(?:\\D&\\W)|\\s|^|\\[|\\{|,|;|\\()(\\d+([.]\\d+)?)(?!\\w)' | ||
'name': 'meta.control.puppet' | ||
'defineparameters': | ||
'beginCaptures': | ||
'0': | ||
'name': 'punctuation.definition.classparameter.begin.puppet' | ||
'begin': '\\(' | ||
'endCaptures': | ||
'0': | ||
'name': 'punctuation.definition.classparameter.end.puppet' | ||
'end': '\\)' | ||
'name': 'meta.classparameter.language.puppet' | ||
'patterns': [ | ||
{ | ||
'include': '#parameter-default-types' | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this
end
above theendCaptures
?