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

@ -53,15 +53,33 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_colon"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "dot"
},
{
"type": "SYMBOL",
"name": "_connection_attribute"
}
]
},
{
"type": "SYMBOL",
"name": "label"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "label"
}
]
}
]
},
@ -118,14 +136,6 @@
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
@ -138,11 +148,11 @@
"name": "label"
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "BLANK"
}
]
},
@ -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.