language-zonefile/grammars/zonefile.cson

84 lines
1.9 KiB
Plaintext

scopeName: 'source.zonefile'
name: 'Bind Zone File'
fileTypes: [
'zone'
'db'
]
patterns: [
{include: '#comments'}
{include: '#entries'}
]
repository:
comments:
patterns: [
{
match: ';.*'
name: 'comment.line.semicolon.zonefile'
}
]
entries:
patterns: [
{
match: '(\\$(ORIGIN|origin|TTL|ttl|INCLUDE|include))\\s+([^;]+)'
captures:
'1':
name: 'keyword.entry.control.zonefile'
'3':
name: 'variable.other.entry.control.zonefile'
}
{
begin: '((@)|([A-Za-z0-9_.-]+))?(\\s+\\d+[A-Za-z]*)?(\\s+IN|in|CH|ch)?\\s+(\\w+)\\s+'
beginCaptures:
'2':
name: 'keyword.entry.resource.record.zonefile'
'3':
name: 'string.unquoted.domain.name.zonefile'
'4':
name: 'variable.other.ttl.zonefile'
'5':
name: 'keyword.class.zonefile'
'6':
name: 'keyword.resource.type.zonefile'
end: '\\n'
name: 'meta.entry.resource.record.zonefile'
patterns: [
{include: '#comments'}
{include: '#rdata'}
]
}
]
rdata:
patterns: [
{
match: '(\\\\([^\\d]|[\\d]{3,3}))'
name: 'string.unquoted.escape.zonefile'
captures:
'1':
name: 'constant.string.unquoted.escape.zonefile'
}
{
match: '"[^"]*"'
name: 'string.quoted.double.resource.data.zonefile'
}
{
begin: '(\\()'
beginCaptures:
'1':
name: 'string.unquoted.resource.data.zonefile'
end: '(\\))'
endCaptures:
'1':
name: 'string.unquoted.resource.data.zonefile'
patterns: [
{include: '#comments'}
{include: '#rdata'}
]
}
{
match: '[^\\s]+?'
name: 'string.unquoted.resource.data.zonefile'
}
]