add connection attributes

This commit is contained in:
Dmitriy Pleshevskiy 2022-12-05 10:37:04 +03:00
parent fcc6316ba1
commit acf249ef24
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
4 changed files with 68 additions and 20 deletions

View file

@ -13,7 +13,9 @@ module.exports = grammar({
seq(
$.identifier,
repeat1(seq($.arrow, $.identifier)),
optional(seq($._colon, $.label)),
optional(
choice(seq($.dot, $._connection_attribute), seq($._colon, $.label))
),
$._end
),
@ -21,9 +23,8 @@ module.exports = grammar({
seq(
$.identifier,
repeat(seq($.dot, $.identifier)),
choice(
optional(seq($.dot, $._shape_attribute)),
optional(seq($._colon, $.label))
optional(
choice(seq($.dot, $._shape_attribute), seq($._colon, $.label))
),
$._end
),
@ -54,6 +55,9 @@ module.exports = grammar({
$._style_attribute
),
_connection_attribute: ($) =>
seq(alias($._connection_attr_key, $.attr_key), $._colon, $.attr_value),
_shape_attr_key: ($) =>
choice(
"shape",

View file

@ -52,6 +52,22 @@
{
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "dot"
},
{
"type": "SYMBOL",
"name": "_connection_attribute"
}
]
},
{
"type": "SEQ",
"members": [
@ -64,6 +80,8 @@
"name": "label"
}
]
}
]
},
{
"type": "BLANK"
@ -118,14 +136,6 @@
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
@ -138,13 +148,13 @@
"name": "label"
}
]
}
]
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SYMBOL",
@ -278,6 +288,28 @@
}
]
},
"_connection_attribute": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_connection_attr_key"
},
"named": true,
"value": "attr_key"
},
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "attr_value"
}
]
},
"_shape_attr_key": {
"type": "CHOICE",
"members": [

View file

@ -36,6 +36,18 @@
"type": "arrow",
"named": true
},
{
"type": "attr_key",
"named": true
},
{
"type": "attr_value",
"named": true
},
{
"type": "dot",
"named": true
},
{
"type": "identifier",
"named": true

Binary file not shown.