// This is a TextMate grammar distributed by `starry-night`. // This grammar is developed at // // and licensed `isc`. // See for more info. /** * @import {Grammar} from '@wooorm/starry-night' */ /** @type {Grammar} */ const grammar = { dependencies: ['etc'], extensions: [], names: ['hosts-file', 'hosts'], patterns: [{include: '#main'}], repository: { host: { captures: {0: {patterns: [{include: 'etc#dot'}]}}, match: '(?<=\\s|^|,)[^:\\s#,][^\\s#,]*', name: 'entity.name.host.domain.hosts' }, legacy: { patterns: [ {include: 'etc#commentSemi'}, {include: '#legacy-dod'}, {include: '#legacy-nic'} ] }, 'legacy-dod': { captures: { 1: {name: 'storage.type.class.hosts'}, 10: {patterns: [{include: 'etc#colon'}]}, 11: { name: 'meta.list.protocols.hosts', patterns: [ { captures: {0: {patterns: [{include: '#legacy-sym'}]}}, match: '[^\\s,:]+', name: 'constant.other.protocol.hosts' }, {include: 'etc#comma'} ] }, 12: {patterns: [{include: 'etc#colon'}]}, 2: {patterns: [{include: 'etc#colon'}]}, 3: { name: 'meta.list.addresses.hosts', patterns: [ {include: 'etc#ipv4'}, {include: 'etc#comma'}, {include: '#legacy-host'} ] }, 4: {patterns: [{include: 'etc#colon'}]}, 5: {patterns: [{include: 'etc#comma'}, {include: '#host'}]}, 6: {patterns: [{include: 'etc#colon'}]}, 7: { name: 'meta.list.cpus.hosts', patterns: [ {match: '[^\\s,:]+', name: 'constant.language.cpu-type.hosts'}, {include: 'etc#comma'} ] }, 8: {patterns: [{include: 'etc#colon'}]}, 9: { name: 'meta.list.systems.hosts', patterns: [ { match: '[^\\s,:]+', name: 'constant.language.operating-system.hosts' }, {include: 'etc#comma'} ] } }, match: '(?x) ^ \\s*\n(NET|GATEWAY|HOST|DOMAIN) \\s* # Record type\n(:) \\s* ([^\\s:][^:\\r\\n]*) \\s* # IP address list\n(?:(:) \\s* ([^\\s:][^:\\r\\n]*) \\s*)? # Name\n(?:(:) \\s* ([^\\s:][^:\\r\\n]*|(?=:)) \\s*)? # CPU type\n(?:(:) \\s* ([^\\s:][^:\\r\\n]*|(?=:)) \\s*)? # Operating systems\n(?:(:) \\s* ([^\\s:][^:\\r\\n]*|(?=:)) \\s*)? # Protocols\n(:)(?=\\s*(?:$|;))', name: 'meta.definition.${1:/downcase}.hosts.legacy' }, 'legacy-host': { patterns: [ { begin: '\\s*(?=\\d)', end: '(?!\\G)', name: 'meta.host-number.unprefixed.arpa.hosts.legacy', patterns: [{include: '#legacy-host-innards'}] }, { begin: '\\b(ARPA|RCC|CHAOS|LCS|SU)(?=$|\\s|;)', beginCaptures: {1: {name: 'entity.name.tag.network.hosts.legacy'}}, end: '(?!\\G)', name: 'meta.host-number.prefixed.${1:/downcase}.hosts.legacy', patterns: [{include: '#legacy-host-innards'}] }, {include: '#legacy-host-innards'} ] }, 'legacy-host-innards': { patterns: [ { captures: { 1: {name: 'constant.numeric.integer.int.octal.oct.hosts.legacy'} }, match: '(?<=CHAOS)\\G\\s+([0-7]+)\\b' }, { applyEndPatternLast: true, begin: '(?x) \\G (?=\n\t(?: (?<=LCS) \\s+ [0-7]+ (?:/[0-7]+)? # LCS /\n\t| (?<=SU) \\s+ [0-7]+ (?:\\#[0-7]+)? # SU #\n\t) \\b(?!/|\\#)\n) \\s*', end: '(?!\\G)', patterns: [ { match: '\\G\\d+', name: 'constant.numeric.integer.int.octal.oct.subnet-number.hosts.legacy' }, { match: '(?!\\G)\\d+', name: 'constant.numeric.integer.int.octal.oct.host-number.hosts.legacy' }, {include: '#legacy-sym'} ] }, { captures: { 1: { name: 'constant.numeric.integer.int.decimal.dec.host-number.hosts.legacy' }, 2: {patterns: [{include: '#legacy-sym'}]}, 3: { name: 'constant.numeric.integer.int.decimal.dec.imp-number.hosts.legacy' } }, match: '(?:^|\\G|(?