Skip to content

Commit 6f7b2e2

Browse files
authored
Update CDS grammar (#2353)
1 parent 9e8111d commit 6f7b2e2

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

.vitepress/languages/cds.tmLanguage.json

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@
206206
"name": "constant.language.cds"
207207
},
208208
{
209-
"match": "(?<!\\.)\\b(super|this)(?!\\s*:)\\b",
210-
"name": "variable.language.cds"
209+
"include": "#selfKeyword"
211210
},
212211
{
213212
"match": ";",
@@ -360,6 +359,10 @@
360359
}
361360
]
362361
},
362+
"selfKeyword": {
363+
"name": "variable.language.cds",
364+
"match": "(?<!\\.|\\w)\\$self\\b"
365+
},
363366
"comment": {
364367
"name": "comment",
365368
"patterns": [
@@ -612,7 +615,7 @@
612615
},
613616
{
614617
"comment": "Element name or type",
615-
"match": "(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?=\\s*[:{,@])",
618+
"match": "(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?=\\s*[:{,@=])",
616619
"name": "entity.other.attribute-name.cds"
617620
},
618621
{
@@ -946,7 +949,7 @@
946949
"name": "atAnnoNoParen",
947950
"begin": "(@)(?!\\s*\\()",
948951
"comment": "'end' uses lookahead, since end of annotation value itself cannot currently be safely determined",
949-
"end": "(?<=[}\\]'`])(?=\\s*($|[@;]))|(?<![@:])(?!\\s*:)(?=$|[\\s@,;(){}\\[\\]'`/\"!]|\\b\\p{ID_Start})",
952+
"end": "(?<=[}\\]'`])(?=\\s*($|[@;]))|(?<![@:])(?!\\s*:)(?=$|[\\s@,;(){}\\[\\]'`/\"!])",
950953
"captures": {
951954
"1": {
952955
"name": "entity.name.tag.at.cds"
@@ -1352,17 +1355,29 @@
13521355
"include": "#keyword"
13531356
},
13541357
{
1355-
"match": "(?i)(?<!@|select from )(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
1356-
"name": "entity.other.attribute-name.cds"
1358+
"include": "#selfKeyword"
13571359
},
13581360
{
1359-
"include": "#identifier"
1361+
"include": "#string"
1362+
},
1363+
{
1364+
"include": "#number"
13601365
},
13611366
{
13621367
"include": "#operator"
13631368
},
13641369
{
1365-
"include": "#string"
1370+
"include": "#bracketedExpression"
1371+
},
1372+
{
1373+
"include": "#squareBrackets"
1374+
},
1375+
{
1376+
"match": "(?i)(?<!@|select from )(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)",
1377+
"name": "entity.other.attribute-name.cds"
1378+
},
1379+
{
1380+
"include": "#identifier"
13661381
}
13671382
]
13681383
},
@@ -1738,4 +1753,4 @@
17381753
}
17391754
},
17401755
"scopeName": "source.cds"
1741-
}
1756+
}

0 commit comments

Comments
 (0)