add highlight tests for connections
This commit is contained in:
parent
8921cc8bbc
commit
7d4799f08a
5 changed files with 42 additions and 9 deletions
|
@ -73,6 +73,8 @@ module.exports = grammar({
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
_dash: ($) => token.immediate("-"),
|
||||||
|
|
||||||
label: ($) => choice($.string, $._unquoted_string),
|
label: ($) => choice($.string, $._unquoted_string),
|
||||||
|
|
||||||
attr_value: ($) => seq(spaces, choice($.string, $._unquoted_string)),
|
attr_value: ($) => seq(spaces, choice($.string, $._unquoted_string)),
|
||||||
|
@ -175,8 +177,6 @@ module.exports = grammar({
|
||||||
|
|
||||||
arrow: ($) => choice(/-+>/, /--+/, /<-+/, /<-+>/),
|
arrow: ($) => choice(/-+>/, /--+/, /<-+/, /<-+>/),
|
||||||
|
|
||||||
_dash: ($) => token.immediate("-"),
|
|
||||||
|
|
||||||
dot: ($) => token.immediate("."),
|
dot: ($) => token.immediate("."),
|
||||||
|
|
||||||
_unquoted_string: ($) => token.immediate(/[^'"`\n;{}]+/),
|
_unquoted_string: ($) => token.immediate(/[^'"`\n;{}]+/),
|
||||||
|
|
|
@ -366,6 +366,13 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"_dash": {
|
||||||
|
"type": "IMMEDIATE_TOKEN",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "-"
|
||||||
|
}
|
||||||
|
},
|
||||||
"label": {
|
"label": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -1024,13 +1031,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"_dash": {
|
|
||||||
"type": "IMMEDIATE_TOKEN",
|
|
||||||
"content": {
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "-"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dot": {
|
"dot": {
|
||||||
"type": "IMMEDIATE_TOKEN",
|
"type": "IMMEDIATE_TOKEN",
|
||||||
"content": {
|
"content": {
|
||||||
|
|
BIN
src/parser.c
BIN
src/parser.c
Binary file not shown.
33
test/highlight/connection.d2
Normal file
33
test/highlight/connection.d2
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
a <- b <-> c -- d -> e
|
||||||
|
# <- variable
|
||||||
|
# ^ operator
|
||||||
|
# ^ variable
|
||||||
|
# ^ operator
|
||||||
|
# ^ variable
|
||||||
|
# ^ operator
|
||||||
|
# ^ variable
|
||||||
|
# ^ operator
|
||||||
|
# ^ variable
|
||||||
|
|
||||||
|
a ----- b
|
||||||
|
# ^ operator
|
||||||
|
|
||||||
|
a ----> b
|
||||||
|
# ^ operator
|
||||||
|
|
||||||
|
a <---- b
|
||||||
|
# ^ operator
|
||||||
|
|
||||||
|
a <---> b
|
||||||
|
# ^ operator
|
||||||
|
|
||||||
|
a.b.c --> d.e
|
||||||
|
# <- constant
|
||||||
|
# ^ constant
|
||||||
|
# ^ variable
|
||||||
|
# ^ operator
|
||||||
|
# ^ constant
|
||||||
|
# ^ variable
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue