@sap/cds-lsp
Version:
Language server for CDS
1,735 lines (1,727 loc) • 43.4 kB
JSON
{
"comment": "CDS Syntax: version 2.0",
"fileTypes": [
"cds",
"cdl",
"hdbdd"
],
"name": "CDS",
"patterns": [
{
"include": "#serviceDef"
},
{
"include": "#actionOrFunctionDef"
},
{
"include": "#aspectDefOrEntityDefOrTypeDefOrEventDefOrAnnotate"
},
{
"include": "#extendArtifactWithDef"
},
{
"include": "#extendAspectOrEntityOrTypeOrArtifact"
},
{
"include": "#extendProjection"
},
{
"match": "(?<!\\.)\\b(annotate)\\b\\s*([\\w.]+)\\b\\s*\\b(with)?\\b",
"captures": {
"1": {
"name": "keyword.strong.control.import.cds"
},
"2": {
"name": "entity.name.type.cds"
},
"3": {
"name": "keyword.strong.control.import.cds"
}
}
},
{
"begin": "(?<!\\.)\\b(using)(?!\\s*:)\\b",
"beginCaptures": {
"1": {
"name": "keyword.strong.control.import.cds"
}
},
"end": "(;)|\\n",
"endCaptures": {
"1": {
"name": "punctuation.terminator.statement.cds"
}
},
"patterns": [
{
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.modules.begin.cds"
}
},
"comment": "{ member1 , member2 as alias2 , [...] }",
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.definition.modules.end.cds"
}
},
"patterns": [
{
"captures": {
"1": {
"name": "variable.language.default.cds"
},
"2": {
"name": "entity.name.type.cds"
},
"3": {
"name": "keyword.strong.cds"
},
"4": {
"name": "entity.name.type.cds"
}
},
"comment": "(default|name) as alias",
"match": "(?:\\b(default)\\b|\\b([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)\\b)\\s*(\\bas\\b)\\s*(?:\\b([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)\\b)"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
},
{
"include": "#comment"
},
{
"match": "\\b([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)\\b",
"name": "entity.name.type.cds"
}
]
},
{
"captures": {
"1": {
"name": "keyword.operator.asterisk"
},
"2": {
"name": "entity.name.type.cds"
},
"3": {
"name": "keyword.strong.control.cds"
},
"4": {
"name": "entity.name.type.cds"
}
},
"comment": "(default|*|name) as alias",
"match": "(?:(\\*)|(?=\\D)(\\b[\\$\\.\\w]+\\b))\\s*(\\bas\\b)\\s*(?=\\D)(\\b[\\$\\.\\w]+\\b)"
},
{
"match": "\\*",
"name": "keyword.operator.asterisk"
},
{
"match": "\\b(default)\\b",
"name": "variable.language.default.cds"
},
{
"include": "#string"
},
{
"include": "#comment"
},
{
"match": "(?i)\\b(from)\\b",
"name": "keyword.strong.control.cds"
},
{
"match": "\\b([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)\\b(?=.*\\bfrom\\b)",
"name": "entity.name.type.cds"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
}
]
},
{
"captures": {
"1": {
"name": "keyword.control.cds"
},
"2": {
"name": "variable.language.default.cds"
},
"3": {
"name": "variable.other.module.cds"
}
},
"comment": "ES6 export: `export default (variable|class, etc.)`",
"match": "(?i)\\b(export)\\b\\s*\\b(default)\\b(?:\\s*)\\b((?!\\bclass\\b|\\blet\\b|\\bvar\\b|\\bconst\\b)[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)?\\b",
"name": "meta.export.cds"
},
{
"captures": {
"1": {
"name": "storage.type.class.cds"
},
"2": {
"name": "entity.name.type.class.cds"
},
"3": {
"name": "storage.modifier.cds"
},
"4": {
"name": "entity.other.inherited-class.cds"
}
},
"match": "\\b(class)(?:\\s+([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*))?(?:\\s+(extends)\\s+([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*))?\\s*($|(?={))",
"name": "meta.class.cds"
},
{
"match": "=>",
"name": "storage.type.arrow.cds"
},
{
"match": "(?<!\\.|\\$)\\b(let|var)\\b(?!\\$)",
"name": "storage.type.var.cds"
},
{
"match": "(?<!\\.|\\$)\\b(get|set|const)\\b(?!\\$)",
"name": "storage.modifier.cds"
},
{
"captures": {
"1": {
"name": "keyword.control.cds"
},
"2": {
"name": "storage.modifier.cds"
}
},
"match": "(?<!\\.)\\b(yield)(?!\\s*:)\\b(?:\\s*(\\*))?",
"name": "meta.control.yield.cds"
},
{
"match": "\\b(false|Infinity|NaN|null|true|undefined)\\b",
"name": "constant.language.cds"
},
{
"match": "(?<!\\.)\\b(super|this)(?!\\s*:)\\b",
"name": "variable.language.cds"
},
{
"match": ";",
"name": "punctuation.terminator.statement.cds"
},
{
"captures": {
"1": {
"name": "punctuation.section.scope.begin.cds"
},
"2": {
"name": "punctuation.section.scope.end.cds"
}
},
"comment": "Allows the special return snippet to fire.",
"match": "(\\[)(\\])"
},
{
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "$self"
}
]
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "$self"
}
]
},
{
"comment": "Match classes based on the usage of the \"new\" operator.",
"match": "(?<=new )([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?!\\w)",
"name": "support.class.cds"
},
{
"comment": "Match classes based on the usage of the \"instanceof\" operator.",
"match": "(?<= instanceof )([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?!\\w)",
"name": "support.class.cds"
},
{
"comment": "Match classes based on the usage of the \"prototype\" property.",
"match": "(?<!\\w)([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?=\\.prototype\\b)",
"name": "support.class.cds"
},
{
"comment": "Matches the \"prototype\" keyword. Even though it is not a valid keyword, it is a special constant of sorts.",
"match": "(?i)(?<=\\.)(prototype)\\b",
"name": "keyword.other.cds"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"include": "#number"
},
{
"include": "#string"
},
{
"include": "#comment"
},
{
"include": "#operator"
},
{
"include": "#identifier"
}
],
"repository": {
"keyword": {
"name": "keyword",
"patterns": [
{
"comment": "Association, Composition",
"match": "(?<!\\.|\\$)\\b(Association\\b\\s*(?:\\[[0-9.eE+, *-]*\\]\\s*)?to\\b\\s*(?:many\\s*|one\\s*)?|Composition\\b\\s*(?:\\[[0-9.eE+, *-]*\\]\\s*)?of\\b\\s*(?:many\\s*|one\\s*)?)(?:(?=\\s*{)|(\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*))",
"captures": {
"1": {
"name": "support.class.cds"
},
"2": {
"name": "entity.name.type.cds"
}
}
},
{
"comment": "Types (exact casing)",
"match": "(?<!\\.|\\$)\\b(Binary|Boolean|DateTime|Date|DecimalFloat|Decimal|Double|Int(16|32|64)|Integer64|Integer|LargeBinary|LargeString|Number|String|Timestamp|Time|UInt8|UUID|Vector)\\b\\s*(\\([^()]*\\))?(?!\\$|\\s*:)",
"name": "support.class.cds"
},
{
"comment": "CQL keywords (arbitrary casing)",
"match": "(?i)(?<!\\.|\\$)\\b(all|and|any|asc|between|by|case|cast|cross|desc|distinct|element|elements|escape|except|excluding|exists|first|from|full|group|group by|having|in|inner|intersect|into|is|join|last|left|like|limit|many|minus|mixin|not null|not|null|nulls|offset|one|or|order by|outer|redirected to|select|some|stored|top|type of|union|where|with)\\b(?!\\$|\\s*:)",
"name": "keyword.cds"
},
{
"comment": "CQL keywords, strong (arbitrary casing)",
"match": "(?i)(?<!\\.|\\$)\\b(as|key|on)\\b(?!\\$|\\s*:)",
"name": "keyword.strong.cds"
},
{
"comment": "CDL keywords (lowercase)",
"match": "(?<!\\.|\\$)\\b(array of|column|columns|current|day|default|depends|else|enabled|end|generated|hana|hour|identity|language|leading|masked|minute|month|new|parameters|partition|projection|projection on|queue|reset|returns|right|row|second|start|storage|store|technical|then|trailing|trim|unique|unload|value|virtual|when|with parameters)\\b(?!\\$|\\s*:)",
"name": "keyword.cds"
},
{
"comment": "CDL keywords, strong (lowercase)",
"match": "(?<!\\.|\\$)\\b(action|actions|annotation|context|define|enum|extend|function|namespace|service|view)\\b(?!\\$|\\s*:)",
"name": "keyword.strong.cds"
}
]
},
"identifier": {
"name": "identifier",
"patterns": [
{
"match": "(?i)(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
"name": "entity.name.type.cds"
}
]
},
"comment": {
"name": "comment",
"patterns": [
{
"begin": "/\\*\\*(?!/)",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.begin.cds"
}
},
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.end.cds"
}
},
"name": "comment.block.documentation.cds"
},
{
"begin": "/\\*",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.begin.cds"
}
},
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.end.cds"
}
},
"name": "comment.block.cds"
},
{
"match": "//.*",
"name": "comment.line.double-slash.cds"
}
]
},
"number": {
"name": "number",
"patterns": [
{
"match": "(?<!\\w|\\$)0[xX]\\h+\\b",
"name": "constant.numeric.hex.cds"
},
{
"match": "(?<!\\w|\\$)0[bB][01]+\\b",
"name": "constant.numeric.binary.cds"
},
{
"match": "(?<!\\w|\\$)0[oO][0-7]+\\b",
"name": "constant.numeric.octal.cds"
},
{
"match": "(?<!\\w|\\$)[+-]?[0-9]+('.'[0-9]+)?([eE][+-]?[0-9]+)?(?!\\w)",
"name": "constant.numeric.cds"
}
]
},
"operator": {
"name": "operator",
"patterns": [
{
"match": "!=|<=|>=|<>|<|>",
"name": "keyword.operator.comparison.cds"
},
{
"match": "\\|\\|",
"name": "keyword.operator.concatenator.cds"
},
{
"match": "&|\\||\\^|~",
"name": "keyword.operator.bitwise.cds"
},
{
"match": "\\:\\s*(localized)\\s+",
"captures": {
"1": {
"name": "keyword.cds"
}
}
},
{
"match": "[?:]",
"name": "keyword.operator.cds"
},
{
"match": "!",
"name": "keyword.operator.logical.cds"
},
{
"match": "=|\\:",
"name": "keyword.operator.assignment.cds"
},
{
"match": "%|\\*|/|\\-|\\+",
"name": "keyword.operator.arithmetic.cds"
}
]
},
"string": {
"name": "string",
"patterns": [
{
"begin": "'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.cds"
}
},
"end": "'(?!')",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.cds"
}
},
"patterns": [
{
"match": "''",
"name": "meta.single-quote.doubled.cds"
}
],
"name": "string.quoted.single.cds"
},
{
"begin": "`",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.cds"
}
},
"end": "`(?!`)",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.cds"
}
},
"name": "string.quoted.other.template.cds",
"patterns": [
{
"match": "``",
"name": "string.quoted.other.template.block.cds"
},
{
"include": "#interpolation"
},
{
"include": "#escape"
}
]
}
]
},
"escape": {
"match": "\\\\([xu$]\\{?[0-9a-fA-F]+}?|.|$)",
"name": "constant.character.escape.cds"
},
"selectItemDef": {
"name": "selectItemDef",
"begin": "(?!\\s*@)",
"end": "(?=})|(,)",
"endCaptures": {
"1": {
"name": "punctuation.separator.object.cds"
}
},
"patterns": [
{
"include": "#bracedSelectItemDef"
},
{
"include": "#string"
},
{
"include": "#comment"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"include": "#bracketedExpression"
},
{
"comment": "Element name or type",
"match": "(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
"name": "entity.other.attribute-name.cds"
},
{
"include": "#operator"
},
{
"include": "#squareBrackets"
},
{
"include": "#number"
}
]
},
"elementDef": {
"name": "elementDef",
"begin": "(?:^|\\G)\\s*(?!extend)(virtual(?:\\s+))?(key(?:\\s+))?(masked(?:\\s+))?(element(?:\\s+))?(?=\\S)",
"beginCaptures": {
"1": {
"name": "keyword.cds"
},
"2": {
"name": "keyword.strong.cds"
},
"3": {
"name": "keyword.cds"
},
"4": {
"name": "keyword.cds"
}
},
"end": "(?=})|(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator.statement.cds"
}
},
"patterns": [
{
"include": "#bracedElementDef"
},
{
"include": "#string"
},
{
"include": "#comment"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"include": "#bracketedExpression"
},
{
"comment": "Element name or type",
"match": "(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?=\\s*[:{,@])",
"name": "entity.other.attribute-name.cds"
},
{
"comment": "Whole-line element name",
"match": "^\\s*(\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|(?!(when|then|else|end)\\s*$)[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)\\s*$",
"captures": {
"1": {
"name": "entity.other.attribute-name.cds"
}
}
},
{
"include": "#identifier"
},
{
"include": "#operator"
},
{
"include": "#number"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
},
{
"comment": "TODO include expressions"
}
]
},
"bracedElementDef": {
"name": "bracedElementDef",
"comment": "Braces enclosing all elementDefs and extendElements; also typeStructs",
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#comment"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#extendElement"
},
{
"include": "#elementDef"
}
]
},
"bracedArtifactDefOrExtend": {
"name": "bracedArtifactDefOrExtend",
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#comment"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#serviceDef"
},
{
"include": "#actionOrFunctionDef"
},
{
"include": "#aspectDefOrEntityDefOrTypeDefOrEventDefOrAnnotate"
},
{
"include": "#keyword"
}
]
},
"bracedSelectItemDef": {
"name": "bracedSelectItemDef",
"comment": "Braces enclosing all selectItemDefs",
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#comment"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#selectItemDef"
}
]
},
"parameterListDef": {
"name": "parameterListDef",
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.parameters.begin.cds"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.parameters.end.cds"
}
},
"patterns": [
{
"include": "#comment"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"comment": "parameter name",
"match": "(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?=\\s*[:{@])",
"name": "variable.parameter.function.cds"
},
{
"include": "#bracedElementDef"
},
{
"include": "#identifier"
},
{
"include": "#operator"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
}
]
},
"extendElement": {
"name": "extendElement",
"begin": "(?:^|\\G)\\s*(?=extend)",
"end": "(?<=[};])(;)?|(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator.statement.cds"
},
"2": {
"name": "punctuation.terminator.statement.cds"
}
},
"patterns": [
{
"begin": "\\bextend\\b(?=.*(?:[@{]|\\bwith\\b))",
"beginCaptures": {
"0": {
"name": "keyword.strong.cds"
}
},
"end": "(?:(?=[@{])|\\b(with)\\b)",
"endCaptures": {
"1": {
"name": "keyword.cds"
}
},
"patterns": [
{
"match": "element(?!(?:\\s*/[*].*[*]/\\s*|\\s+)?with\\b)",
"name": "keyword.cds"
},
{
"match": "(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
"name": "entity.other.attribute-name.cds"
},
{
"include": "#comment"
}
]
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#extendElement"
},
{
"include": "#elementDef"
}
]
},
{
"include": "#comment"
},
{
"include": "#keyword"
},
{
"include": "#identifier"
},
{
"include": "#operator"
},
{
"match": "\\(",
"name": "punctuation.section.scope.begin.cds"
},
{
"match": "\\)",
"name": "punctuation.section.scope.end.cds"
},
{
"include": "#number"
}
]
},
"atAnnoParen": {
"name": "atAnnoParen",
"begin": "(@)\\s*(\\()",
"beginCaptures": {
"1": {
"name": "entity.name.tag.at.cds"
},
"2": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#bracketedExpression"
},
{
"include": "#annotationName"
},
{
"include": "#optColonAndStructure"
},
{
"include": "#optColonAndArray"
},
{
"include": "#colonAndBracketedExpression"
},
{
"include": "#colonAndNumber"
},
{
"include": "#colonAndString"
},
{
"include": "#colonAndTemplateString"
},
{
"include": "#colonAndConstant"
},
{
"include": "#colonAndOptHashIdent"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
},
{
"include": "#comment"
}
]
},
"atAnnoNoParen": {
"name": "atAnnoNoParen",
"begin": "(@)(?!\\s*\\()",
"comment": "'end' uses lookahead, since end of annotation value itself cannot currently be safely determined",
"end": "(?<=[}\\]'`])(?=\\s*($|[@;]))|(?<![@:])(?!\\s*:)(?=$|[\\s@,;(){}\\[\\]'`/\"!]|\\b\\p{ID_Start})",
"captures": {
"1": {
"name": "entity.name.tag.at.cds"
}
},
"patterns": [
{
"include": "#annotationName"
},
{
"include": "#optColonAndStructure"
},
{
"include": "#optColonAndArray"
},
{
"include": "#colonAndNumber"
},
{
"include": "#colonAndString"
},
{
"include": "#colonAndTemplateString"
},
{
"include": "#colonAndConstant"
},
{
"include": "#colonAndOptHashIdent"
},
{
"include": "#comment"
}
]
},
"atAnnoName": {
"name": "atAnnoName",
"begin": "(@)",
"beginCaptures": {
"1": {
"name": "entity.name.tag.at.cds"
}
},
"end": "(?:(?<=[$\"\\]])(?=\\s*[@:;])|(?<=\\p{ID_Continue})\\b)(?![#.])",
"comment": "!TODO alternative end: (?=\\s*(?:$|[@,;:)]))",
"patterns": [
{
"include": "#annotationName"
}
]
},
"annotationName": {
"name": "annotationName",
"comment": "annotationPath ( '#' annotationPathVariant ) ?",
"begin": "(?=[\"\\p{ID_Start}]|!\\[)",
"end": "(?:(?<=[$\"\\]])(?=\\s*[@:;])|(?<=\\p{ID_Continue})\\b)(?!\\s*[#.])",
"patterns": [
{
"match": "\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*",
"name": "entity.name.tag.cds"
},
{
"match": "\\s*(\\.)\\s*(@)?",
"captures": {
"1": {
"name": "entity.name.tag.dot.cds"
},
"2": {
"name": "entity.name.tag.at.cds"
}
}
},
{
"match": "\\s*(#)\\s*",
"captures": {
"1": {
"name": "entity.name.tag.hash.cds"
}
}
}
]
},
"optColonAndStructure": {
"name": "optColonAndStructure",
"begin": "(:)?\\s*({)",
"beginCaptures": {
"1": {
"name": "keyword.operator.cds"
},
"2": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#atAnnoNoParen"
},
{
"comment": "annotationPath ( '#' annotationPathVariant )?",
"include": "#annotationName"
},
{
"include": "#optColonAndStructure"
},
{
"include": "#optColonAndArray"
},
{
"include": "#colonAndNumber"
},
{
"include": "#colonAndString"
},
{
"include": "#colonAndTemplateString"
},
{
"include": "#colonAndConstant"
},
{
"include": "#colonAndOptHashIdent"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
},
{
"include": "#comment"
}
]
},
"optColonAndArray": {
"name": "optColonAndArray",
"begin": "(:)?\\s*(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.cds"
},
"2": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#atAnnoNoParen"
},
{
"comment": "annotationPath ( '#' annotationPathVariant )?",
"include": "#annotationName"
},
{
"match": "\\.{3}",
"name": "keyword.operator.ellipsis"
},
{
"match": "(?i)(up)\\s+(to)\\b",
"captures": {
"1": {
"name": "keyword.cds"
},
"2": {
"name": "keyword.cds"
}
}
},
{
"include": "#optColonAndStructure"
},
{
"include": "#optColonAndArray"
},
{
"include": "#literalValue"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
},
{
"include": "#comment"
}
]
},
"colonAndBracketedExpression": {
"name": "colonAndBracketedExpression",
"begin": "(:)\\s*(?=\\()",
"end": "(?<=\\))",
"beginCaptures": {
"1": {
"name": "keyword.operator.cds"
}
},
"patterns": [
{
"include": "#bracketedExpression"
},
{
"include": "#comment"
}
]
},
"colonAndNumber": {
"name": "colonAndNumber",
"begin": "(:)\\s*(?=[0-9+-])",
"end": "(?<=[\\h0-9])\\b",
"beginCaptures": {
"1": {
"name": "keyword.operator.cds"
}
},
"patterns": [
{
"include": "#number"
},
{
"include": "#comment"
}
]
},
"colonAndString": {
"name": "colonAndString",
"begin": "(:)\\s*(x|date|time(?:stamp)?)?\\s*(')",
"beginCaptures": {
"1": {
"name": "keyword.operator.cds"
},
"2": {
"name": "support.class.cds"
},
"3": {
"name": "string.quoted.single.cds punctuation.definition.string.begin.cds"
}
},
"end": "'(?!')",
"endCaptures": {
"0": {
"name": "string.quoted.single.cds punctuation.definition.string.end.cds"
}
},
"patterns": [
{
"match": "''",
"name": "string.quoted.single.cds meta.single-quote.doubled.cds"
},
{
"match": ".",
"name": "string.quoted.single.cds"
},
{
"include": "#comment"
}
]
},
"colonAndTemplateString": {
"name": "colonAndTemplateString",
"begin": "(:)\\s*(?=`)",
"end": "(?<=`)",
"beginCaptures": {
"1": {
"name": "keyword.operator.cds"
}
},
"patterns": [
{
"include": "#string"
},
{
"include": "#comment"
}
]
},
"colonAndOptHashIdent": {
"name": "colonAndOptHashIdent",
"match": "(:)\\s*(#)?\\s*(\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
"captures": {
"1": {
"name": "keyword.operator.cds"
},
"2": {
"name": "entity.name.tag.hash.cds"
},
"3": {
"name": "entity.name.tag.cds"
}
},
"patterns": [
{
"include": "#comment"
}
]
},
"colonAndConstant": {
"name": "colonAndConstant",
"match": "(?i)(:)\\s*(null|true|false)\\b",
"captures": {
"1": {
"name": "keyword.operator.cds"
},
"2": {
"name": "constant.language.cds"
}
},
"patterns": [
{
"include": "#comment"
}
]
},
"literalValue": {
"name": "literalValue",
"comment": "the rules grouped here, when preceded by ':', are found in their own separate rules",
"patterns": [
{
"comment": "'#' ident",
"match": "(#)\\s*(\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
"captures": {
"1": {
"name": "entity.name.tag.hash.cds"
},
"2": {
"name": "entity.name.tag.cds"
}
}
},
{
"match": "(?i)\\b(?:null|true|false)\\b",
"name": "constant.language.cds"
},
{
"include": "#number"
},
{
"include": "#string"
},
{
"comment": "quotedLiteral",
"match": "(?i)\\b(x|date|time(?:stamp)?)\\s*((')[^']*('))",
"captures": {
"1": {
"name": "support.class.cds"
},
"2": {
"name": "string.quoted.single.cds"
},
"3": {
"name": "punctuation.definition.string.begin.cds"
},
"4": {
"name": "punctuation.definition.string.end.cds"
}
}
},
{
"comment": "TODO include '(' condition ')'"
}
]
},
"bracketedExpression": {
"name": "bracketedExpression",
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#bracedSelectItemDef"
},
{
"include": "#comment"
},
{
"include": "#keyword"
},
{
"match": "(?i)(?<!@|select from )(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
"name": "entity.other.attribute-name.cds"
},
{
"include": "#identifier"
},
{
"include": "#operator"
},
{
"include": "#string"
}
]
},
"squareBrackets": {
"match": "\\[|\\]",
"name": "meta.brace.square.cds"
},
"bracedDefinitionsOrAnnotateOrExtend": {
"name": "bracedDefinitionsOrAnnotateOrExtend",
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.scope.begin.cds"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.scope.end.cds"
}
},
"patterns": [
{
"include": "#aspectDefOrEntityDefOrTypeDefOrEventDefOrAnnotate"
},
{
"include": "#extendAspectOrEntityOrTypeOrArtifact"
}
]
},
"extendArtifactWithDef": {
"name": "extendArtifactWithDef",
"begin": "(?i)\\b(extend)\\s+((?!@)\\S+)\\s+(with)\\s+(definitions)(?=\\s*{)",
"beginCaptures": {
"1": {
"name": "keyword.strong.cds"
},
"2": {
"name": "entity.name.type.cds"
},
"3": {
"name": "keyword.cds"
},
"4": {
"name": "keyword.cds"
}
},
"end": "(?<=[};])(;)?|(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator.statement.cds"
},
"2": {
"name": "punctuation.terminator.statement.cds"
}
},
"patterns": [
{
"include": "#bracedDefinitionsOrAnnotateOrExtend"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
}
]
},
"extendAspectOrEntityOrTypeOrArtifact": {
"name": "extendAspectOrEntityOrTypeOrArtifact",
"comment": "TODO simplify begin pattern - would currently produce false positives; allow annotationAssignment_ll1",
"begin": "(?i)\\b(extend)\\s+((aspect|entity|type)\\s+)?((?!@)\\S+)(\\s+(with)(\\s+(actions|columns|elements|enum))?|(?=\\s*{))",
"beginCaptures": {
"1": {
"name": "keyword.strong.cds"
},
"3": {
"name": "keyword.strong.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": "#keyword"
},
{
"include": "#identifier"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
}
]
},
"extendProjection": {
"name": "extendProjection",
"comment": "TODO simplify begin pattern - would currently produce false positives; allow annotationAssignment_ll1",
"begin": "(?i)\\b(extend)\\s+((projection)\\s+)?((?!@)\\S+)(\\s+(with)(\\s+(actions))?|(?=\\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": "#bracedSelectItemDef"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"include": "#identifier"
}
]
},
"aspectDefOrEntityDefOrTypeDefOrEventDefOrAnnotate": {
"name": "aspectDefOrEntityDefOrTypeDefOrEventDefOrAnnotate",
"begin": "\\b((annotate)|(?:(aspect)|(abstract)\\s+(entity))(?=\\s+.*\\S+.*[{;])|(entity)(?=\\s+.*\\S+.*(?:\\s+as|\\{))|(type|event)(?=\\s+.*\\S+.*[:{]))\\b",
"beginCaptures": {
"2": {
"name": "keyword.strong.control.import.cds"
},
"3": {
"name": "keyword.strong.cds"
},
"4": {
"name": "keyword.strong.cds"
},
"5": {
"name": "keyword.strong.cds"
},
"6": {
"name": "keyword.strong.cds"
},
"7": {
"name": "keyword.strong.cds"
}
},
"end": "(?<=[};])(;)?|(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator.statement.cds"
},
"2": {
"name": "punctuation.terminator.statement.cds"
}
},
"patterns": [
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"comment": "Aspects",
"begin": ":",
"end": "(?=[{;@])",
"beginCaptures": {
"0": {
"name": "keyword.operator.cds"
}
},
"patterns": [
{
"include": "#keyword"
},
{
"include": "#number"
},
{
"include": "#string"
},
{
"include": "#comment"
},
{
"include": "#identifier"
},
{
"match": ",",
"name": "punctuation.separator.object.cds"
}
]
},
{
"include": "#asSelectOrProjection"
},
{
"include": "#bracedElementDef"
},
{
"include": "#keyword"
},
{
"include": "#identifier"
}
]
},
"actionOrFunctionDef": {
"name": "actionOrFunctionDef",
"begin": "(?i)\\b(action|function)\\s+(\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
"beginCaptures": {
"1": {
"name": "keyword.strong.cds"
},
"2": {
"name": "entity.name.function.cds"
}
},
"end": ";",
"endCaptures": {
"0": {
"name": "punctuation.terminator.statement.cds"
}
},
"patterns": [
{
"include": "#parameterListDef"
},
{
"include": "#comment"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"include": "#bracedElementDef"
},
{
"include": "#identifier"
}
]
},
"serviceDef": {
"name": "serviceDef",
"begin": "\\b(service)(?=\\s+.*\\S+.*[{;])\\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"
},
{
"include": "#bracedArtifactDefOrExtend"
},
{
"include": "#identifier"
}
]
},
"asSelectOrProjection": {
"name": "asSelectOrProjection",
"begin": "\\b(as)\\b",
"beginCaptures": {
"1": {
"name": "keyword.strong.cds"
}
},
"end": "(?<=[};])(;)?|(;)",
"endCaptures": {
"1": {
"name": "punctuation.terminator.statement.cds"
},
"2": {
"name": "punctuation.terminator.statement.cds"
}
},
"patterns": [
{
"include": "#bracedSelectItemDef"
},
{
"include": "#atAnnoParen"
},
{
"include": "#atAnnoNoParen"
},
{
"include": "#keyword"
},
{
"include": "#identifier"
},
{
"include": "#operator"
}
]
}
},
"scopeName": "source.cds"
}