simplify the connection rule

This commit is contained in:
Dmitriy Pleshevskiy 2022-12-05 10:33:49 +03:00
parent c3be4d43cc
commit fcc6316ba1
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
3 changed files with 25 additions and 42 deletions

View file

@ -12,10 +12,8 @@ module.exports = grammar({
connection: ($) =>
seq(
$.identifier,
choice(
seq(seq($.arrow, $.identifier, $._colon, $.label)),
seq(repeat1(seq($.arrow, $.identifier)))
),
repeat1(seq($.arrow, $.identifier)),
optional(seq($._colon, $.label)),
$._end
),

View file

@ -33,6 +33,22 @@
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "arrow"
},
{
"type": "SYMBOL",
"name": "identifier"
}
]
}
},
{
"type": "CHOICE",
"members": [
@ -40,48 +56,17 @@
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "arrow"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "label"
}
]
"type": "SYMBOL",
"name": "_colon"
},
{
"type": "SYMBOL",
"name": "label"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "arrow"
},
{
"type": "SYMBOL",
"name": "identifier"
}
]
}
}
]
"type": "BLANK"
}
]
},

Binary file not shown.