grammar: refactor global patterns into modular repository structure (comments, directives, parameters and values)

This commit is contained in:
cn 2017-11-24 23:14:19 +01:00
parent 0de289b882
commit 0b972b731f
1 changed files with 78 additions and 37 deletions

View File

@ -5,42 +5,83 @@ fileTypes: [
] ]
foldingStartMarker: '<[^>]+>\\s*$' foldingStartMarker: '<[^>]+>\\s*$'
foldingStopMarker: '^\\s*</[^>]+>' foldingStopMarker: '^\\s*</[^>]+>'
patterns: [
{include: '#comments'}
{include: '#directives'}
]
repository:
comments:
patterns: [ patterns: [
{ {
match: "#.*" match: '#.*'
name: "comment.line.number-sign.fluentd" name: 'comment.line.number-sign.fluentd'
} }
{ ]
match: "(<)(\\w+)(\\s([^>]+?))?(>)" directives:
name: "entity.tag.start.fluentd" patterns: [
captures: {
"1": match: '((@)include)\\s+([^\\s]+)'
name: "punctuation.definition.tag.fluentd" captures:
"2": '1':
name: "entity.tag.fluentd" name: 'entity.directive.begin.fluentd'
"4": '2':
name: "entity.other.attribute-name.fluentd" name: 'punctuation.definition.directive.begin.fluentd'
"5": '3':
name: "punctuation.definition.tag.fluentd" name: 'entity.other.directive.attribute-name.fluentd'
} }
{ {
match: "(</)(\\w+)(>)" begin: '((<)[^\\s]+(\\s+[^>]+)?(>))'
name: "entity.tag.end.fluentd" beginCaptures:
captures: '1':
"1": name: 'entity.directive.begin.fluentd'
name: "punctuation.definition.tag.fluentd" '2':
"2": name: 'punctuation.definition.directive.begin.fluentd'
name: "entity.tag.fluentd" '3':
"3": name: 'entity.other.directive.attribute-name.fluentd'
name: "punctuation.definition.tag.fluentd" '4':
} name: 'punctuation.definition.directive.end.fluentd'
{ end: '((</)\\w+(>))'
match: "([^\\s]+)(\\s+([^\\n]+))?" endCaptures:
name: "keyword.directive.generic.fluentd" '1':
captures: name: 'entity.directive.end.fluentd'
"1": '2':
name: "keyword.directive.fluentd" name: 'punctuation.definition.directive.begin.fluentd'
"3": '3':
name: "string.unquoted.fluentd" name: 'punctuation.definition.directive.end.fluentd'
name: 'meta.directive.fluentd'
patterns: [
{include: '#comments'}
{include: '#directives'}
{include: '#parameters'}
]
}
]
parameters:
patterns: [
{
begin: '(@[^\\s]+)|([^\\s]+)'
beginCaptures:
'1':
name: 'keyword.parameter.system.fluentd'
'2':
name: 'keyword.parameter.fluentd'
end: '\\n'
name: 'meta.parameter.fluentd'
patterns: [
{include: '#comments'}
{include: '#values'}
]
}
]
values:
patterns: [
{
match: '([^\\s]+?)'
name: 'meta.string.unquoted.fluentd'
captures:
'1':
name: 'string.unquoted.fluentd'
} }
] ]