// This is a TextMate grammar distributed by `starry-night`. // This grammar is developed at // // and licensed `apache-2.0`. // See for more info. /** * @import {Grammar} from '@wooorm/starry-night' */ /** @type {Grammar} */ const grammar = { extensions: ['.sd'], names: ['vespa-schema-definition', 'vespa'], patterns: [ {include: '#comment'}, {include: '#string-double'}, {include: '#string-single'}, {include: '#tensor-type'}, {include: '#indexing-block'}, {include: '#indexing-inline'}, {include: '#expression-block'}, {include: '#expression-inline'}, {include: '#feature-list-block'}, {include: '#feature-list-inline'}, {include: '#rank-properties-block'}, {include: '#match-block'}, {include: '#summary-block'}, {include: '#enum-value-inline'}, {include: '#container-type'}, {include: '#primitive-type'}, {include: '#numeric-literal'}, {include: '#boolean-constants'}, {include: '#declarations'}, {include: '#file-path'}, {include: '#schema-keywords'}, {include: '#user-type'}, {include: '#assignment-operator'}, {include: '#schema-functions'}, {include: '#schema-enum-members'}, {include: '#variable-reference'}, {include: '#punctuation'} ], repository: { 'assignment-operator': { match: '[+\\-*/]?=', name: 'keyword.operator.assignment.vespa' }, 'boolean-constants': { match: '\\b(on(?!-)|off|true|false)\\b', name: 'support.type.vespa' }, comment: { captures: {1: {name: 'punctuation.definition.comment.vespa'}}, match: '(#).*$', name: 'comment.line.number-sign.vespa' }, 'container-type': { begin: '\\b(array|weightedset|map|reference|annotationreference)\\s*(<)', beginCaptures: { 1: {name: 'storage.type.vespa'}, 2: {name: 'punctuation.definition.typeparameters.begin.vespa'} }, end: '(>)', endCaptures: { 1: {name: 'punctuation.definition.typeparameters.end.vespa'} }, patterns: [ {include: '#container-type'}, {include: '#primitive-type'}, {include: '#tensor-type'}, {match: ',', name: 'punctuation.separator.vespa'}, {match: '\\b[a-zA-Z_]\\w*\\b', name: 'entity.name.type.vespa'} ] }, declarations: { patterns: [ { captures: { 1: {name: 'keyword.declaration.vespa'}, 2: {name: 'entity.name.type.vespa'}, 3: {name: 'keyword.control.vespa'}, 4: {name: 'entity.other.inherited-class.vespa'} }, match: '\\b(schema)\\s+([a-zA-Z_]\\w*)(?:\\s+(inherits)\\s+([a-zA-Z_]\\w*))?' }, { captures: { 1: {name: 'keyword.declaration.vespa'}, 2: {name: 'entity.name.type.vespa'}, 3: {name: 'keyword.control.vespa'}, 4: {name: 'entity.other.inherited-class.vespa'} }, match: '\\b(document)\\s+([a-zA-Z_]\\w*)(?:\\s+(inherits)\\s+([a-zA-Z_]\\w*))?' }, { captures: { 1: {name: 'keyword.declaration.vespa'}, 3: {name: 'keyword.control.vespa'} }, match: '\\b(field)\\s+([a-zA-Z_]\\w*)\\s+(type)\\b' }, { captures: {1: {name: 'keyword.declaration.vespa'}}, match: '\\b(struct)\\s+([a-zA-Z_]\\w*)' }, { captures: { 1: {name: 'keyword.declaration.vespa'}, 2: {name: 'entity.name.function.vespa'}, 3: {name: 'keyword.control.vespa'}, 4: {name: 'entity.other.inherited-class.vespa'} }, match: '(?=|<=|!=|==|~=|&&|\\|\\||[<>!]', name: 'keyword.operator.ranking.vespa' }, { begin: '\\(', beginCaptures: {0: {name: 'punctuation.section.parens.begin.vespa'}}, end: '\\)', endCaptures: {0: {name: 'punctuation.section.parens.end.vespa'}}, patterns: [{include: '#ranking-expression'}] }, { begin: '\\{', beginCaptures: {0: {name: 'punctuation.section.block.begin.vespa'}}, end: '\\}', endCaptures: {0: {name: 'punctuation.section.block.end.vespa'}}, patterns: [{include: '#ranking-expression'}] }, {match: '\\b[a-zA-Z_]\\w*\\b', name: 'support.variable.vespa'}, {include: '#punctuation'} ] }, 'schema-enum-members': { patterns: [ { match: '\\b(sequential|parallel)\\b', name: 'variable.other.enummember.vespa' } ] }, 'schema-functions': { patterns: [{match: '\\b(query)\\b', name: 'entity.name.function.vespa'}] }, 'schema-keywords': { patterns: [ { match: '(?', name: 'punctuation.definition.typeparameters.vespa'}, {match: '\\(', name: 'punctuation.definition.typeparameters.vespa'}, { captures: {1: {name: 'constant.numeric.vespa'}}, match: '\\[(\\d+)\\]' }, {match: '\\{\\}', name: 'punctuation.definition.dimension.vespa'}, { match: '\\b([a-zA-Z_][a-zA-Z_0-9]*)\\b', name: 'support.variable.vespa' }, {match: ',', name: 'punctuation.separator.vespa'} ] }, 'user-type': { captures: {1: {name: 'entity.name.type.vespa'}}, match: '(?<=\\btype\\s)(\\s*[a-zA-Z_]\\w*)' }, 'variable-reference': { captures: { 1: {name: 'punctuation.definition.variable.vespa'}, 2: {name: 'variable.language.vespa'} }, match: '(\\$)([a-zA-Z_][a-zA-Z0-9_]*)', name: 'variable.language.vespa' } }, scopeName: 'source.vespaSchema' } export default grammar