use regex for arrow to fix long arrow bug

This commit is contained in:
Dmitriy Pleshevskiy 2022-12-08 01:30:23 +03:00
parent 6835da6d3c
commit 8921cc8bbc
Signed by: pleshevskiy
GPG Key ID: 1B59187B161C0215
5 changed files with 42 additions and 87 deletions

View File

@ -9,7 +9,6 @@ module.exports = grammar({
conflicts: ($) => [
[$.shape_key],
[$.arrow],
[$._shape_path],
[$._shape_block],
[$._shape_block_definition],
@ -174,13 +173,7 @@ module.exports = grammar({
_arrow: ($) => seq(spaces, $.arrow),
arrow: ($) =>
choice(
seq("--", repeat($._dash)),
seq("<-", repeat($._dash)),
seq("<-", repeat($._dash), ">"),
seq(repeat($._dash), "->")
),
arrow: ($) => choice(/-+>/, /--+/, /<-+/, /<-+>/),
_dash: ($) => token.immediate("-"),

View File

@ -1007,72 +1007,20 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "--"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_dash"
}
}
]
"type": "PATTERN",
"value": "-+>"
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "<-"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_dash"
}
}
]
"type": "PATTERN",
"value": "--+"
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "<-"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_dash"
}
},
{
"type": "STRING",
"value": ">"
}
]
"type": "PATTERN",
"value": "<-+"
},
{
"type": "SEQ",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_dash"
}
},
{
"type": "STRING",
"value": "->"
}
]
"type": "PATTERN",
"value": "<-+>"
}
]
},
@ -1274,9 +1222,6 @@
[
"shape_key"
],
[
"arrow"
],
[
"_shape_path"
],

View File

@ -254,14 +254,6 @@
"type": "'",
"named": false
},
{
"type": "--",
"named": false
},
{
"type": "->",
"named": false
},
{
"type": "3d",
"named": false
@ -274,14 +266,6 @@
"type": ";",
"named": false
},
{
"type": "<-",
"named": false
},
{
"type": ">",
"named": false
},
{
"type": "`",
"named": false

Binary file not shown.

View File

@ -64,6 +64,39 @@ biz <- baz
)
)
================================================================================
Connection with looooong arrow
================================================================================
foo ----------- bar
biz ----------> baz
biz <---------> baz
biz <---------- baz
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
)
================================================================================
Complex identifier connection