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: ($) => connection: ($) =>
seq( seq(
$.identifier, $.identifier,
choice( repeat1(seq($.arrow, $.identifier)),
seq(seq($.arrow, $.identifier, $._colon, $.label)), optional(seq($._colon, $.label)),
seq(repeat1(seq($.arrow, $.identifier)))
),
$._end $._end
), ),

View file

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

Binary file not shown.