// 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: ['.cds'], names: ['cap-cds', 'cds'], patterns: [ { begin: '\\b(aspect|(abstract\\s+)?entity|type|event)\\b', beginCaptures: {1: {name: 'keyword.strong.cds'}}, end: '(?<=})(;)?|(;)', endCaptures: { 1: {name: 'punctuation.terminator.statement.cds'}, 2: {name: 'punctuation.terminator.statement.cds'} }, patterns: [ {include: '#atAnnoParen'}, {include: '#atAnnoNoParen'}, { begin: ':', beginCaptures: {0: {name: 'keyword.operator.cds'}}, end: '(?=[{;@])', patterns: [ {include: '#identifiers'}, {match: ',', name: 'punctuation.separator.object.cds'} ] }, {include: '#bracedElementDef'}, {include: '#keywords'}, {include: '#identifiers'} ] }, { begin: '(?i)\\b(extend)\\s+((context|service|aspect|entity|projection|type)\\s+)?((?!@)\\S+)(\\s+(with)(\\s+(actions|definitions|columns|elements|enum))?|(?=\\s*{))', beginCaptures: { 1: {name: 'keyword.strong.cds'}, 3: {name: 'keyword.cds'}, 4: {name: 'entity.name.type.cds'}, 6: {name: 'keyword.cds'}, 8: {name: 'keyword.cds'} }, end: '(?<=})(;)?|(;)', endCaptures: { 1: {name: 'punctuation.terminator.statement.cds'}, 2: {name: 'punctuation.terminator.statement.cds'} }, patterns: [ {include: '#bracedElementDef'}, {include: '#atAnnoParen'}, {include: '#atAnnoNoParen'}, {include: '#keywords'}, {include: '#identifiers'}, {match: ',', name: 'punctuation.separator.object.cds'} ] }, { captures: { 1: {name: 'keyword.strong.control.import.cds'}, 2: {name: 'entity.name.type.cds'}, 3: {name: 'keyword.strong.control.import.cds'} }, match: '(?', name: 'storage.type.arrow.cds'}, {match: '(?=|<>|<|>', name: 'keyword.operator.comparison.cds'}, {match: '\\|\\|', name: 'keyword.operator.concatenator.cds'}, {match: '&|\\||\\^|~', name: 'keyword.operator.bitwise.cds'}, {captures: {1: {name: 'keyword.cds'}}, match: '\\:\\s*(localized)\\s+'}, {match: '[?:]', name: 'keyword.operator.cds'}, {match: '!', name: 'keyword.operator.logical.cds'}, {match: '=|\\:', name: 'keyword.operator.assignment.cds'}, {match: '%|\\*|/|\\-|\\+', name: 'keyword.operator.arithmetic.cds'} ] }, optColonAndArray: { begin: '(:)?\\s*(\\[)', beginCaptures: { 1: {name: 'keyword.operator.colon'}, 2: {name: 'punctuation.section.scope.begin.cds'} }, end: '\\]', endCaptures: {0: {name: 'punctuation.section.scope.end.cds'}}, patterns: [ {include: '#atAnnoNoParen'}, {include: '#annotationName'}, {captures: {0: {name: 'keyword.operator.ellipsis'}}, match: '\\.{3}'}, { captures: {1: {name: 'keyword.cds'}, 2: {name: 'keyword.cds'}}, match: '(?i)(up)\\s+(to)\\b' }, {include: '#optColonAndStructure'}, {include: '#optColonAndArray'}, {include: '#literalValue'}, {match: ',', name: 'punctuation.separator.object.cds'}, {include: '#comments'} ] }, optColonAndStructure: { begin: '(:)?\\s*({)', beginCaptures: { 1: {name: 'keyword.operator.colon'}, 2: {name: 'punctuation.section.scope.begin.cds'} }, end: '}', endCaptures: {0: {name: 'punctuation.section.scope.end.cds'}}, patterns: [ {include: '#atAnnoNoParen'}, {include: '#annotationName'}, {include: '#optColonAndStructure'}, {include: '#optColonAndArray'}, {include: '#colonAndNumber'}, {include: '#colonAndString'}, {include: '#colonAndTemplateString'}, {include: '#colonAndHashIdent'}, {include: '#colonAndConstant'}, {match: ',', name: 'punctuation.separator.object.cds'}, {include: '#comments'} ] }, selectItemDef: { begin: '^\\s*(?=\\*|.+\\s+as\\s+)', end: '(?=})|(,)', patterns: [ {include: '#bracedElementDef'}, {include: '#strings'}, {include: '#comments'}, {include: '#atAnnoParen'}, {include: '#atAnnoNoParen'}, {include: '#keywords'}, {include: '#bracketedExpression'}, { match: '(?