Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kdl 2.0 support #14

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions syntaxes/kdl.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"comment": "Some of these patterns are taken straight from rust-analyzer: https://github.com/rust-lang/vscode-rust/blob/master/rust-analyzer/editors/code/rust.tmGrammar.json. Some was also taken from https://github.com/arm32x/vscode-sdlang/blob/master/syntaxes/sdlang.tmLanguage.json",
"name": "KDL",
"patterns": [
{
"include": "#invalid_bool"
},
{
"include": "#invalid_null"
},
{
"include": "#null"
},
Expand Down Expand Up @@ -55,10 +61,13 @@
"include": "#line_comment"
},
{
"include": "#attribute"
"include": "#property"
},
{
"include": "#node_name"
},
{
"include": "#identifier-strings"
}
],
"repository": {
Expand Down Expand Up @@ -94,11 +103,11 @@
},
"node_name": {
"name": "entity.name.tag",
"match": "(?![\\\\{\\}<>;\\[\\]\\=,\\(\\)\\s])[\\u0021-\\uFFFF]+"
"match": "(?:;|^)\\s*(?:(?![/\\[\\]\\\\{\\};=﹦=🟰\\(\\)\\s#])[\\u0021-\\uFFFF])+"
},
"attribute": {
"property": {
"name": "entity.other.attribute-name.kdl",
"match": "(?![\\\\{\\}<>;\\[\\]\\=,\\(\\)\\s])[\\u0021-\\uFFFF]+(=)",
"match": "(?:(?![/\\[\\]\\\\{\\};=﹦=🟰\\(\\)\\s#])[\\u0021-\\uFFFF])+([=﹦=🟰])",
"captures": {
"1": {
"name": "punctuation.separator.key-value.kdl"
Expand All @@ -107,11 +116,15 @@
},
"null": {
"name": "constant.language.null.kdl",
"match": "\\bnull\\b"
"match": "#null"
},
"boolean": {
"name": "constant.language.boolean.kdl",
"match": "\\b(true|false)\\b"
"match": "#true|#false"
},
"identifier-strings": {
"name": "string.unquoted.plain.out.kdl",
"match": "(?:(?![/\\[\\]\\\\{\\};=﹦=🟰\\(\\)\\s#])[\\u0021-\\uFFFF])+\\s+"
},
"strings": {
"name": "string.quoted.double.kdl",
Expand All @@ -126,7 +139,7 @@
},
"raw-strings": {
"name": "string.quoted.double.raw.kdl",
"begin": "b?r(#*)\"",
"begin": "b?(#+)\"",
"end": "\"\\1"
},
"type-annotation": {
Expand All @@ -135,7 +148,7 @@
"end": "\\)",
"patterns": [
{
"include": "#attribute"
"include": "#property"
},
{
"include": "#strings"
Expand Down Expand Up @@ -196,6 +209,14 @@
"comment": "Slashdash block comment",
"begin": "/-{",
"end": "}"
},
"invalid_bool": {
"name": "invalid.illegal.boolean-needs-pound.kdl",
"match": "(?:(?!#)true|false)"
},
"invalid_null": {
"name": "invalid.illegal.null-needs-pound.kdl",
"match": "(?:(?!#)null)"
}
},
"scopeName": "source.kdl"
Expand Down