diff --git a/grammar.js b/grammar.js index e7d43fe..d3aa871 100644 --- a/grammar.js +++ b/grammar.js @@ -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("-"), diff --git a/src/grammar.json b/src/grammar.json index d7e966c..1ae98d3 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -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" ], diff --git a/src/node-types.json b/src/node-types.json index 0171495..2efdd90 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -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 diff --git a/src/parser.c b/src/parser.c index 1056ace..3a03490 100644 Binary files a/src/parser.c and b/src/parser.c differ diff --git a/test/corpus/connection.txt b/test/corpus/connection.txt index ce6397c..f1d8b64 100644 --- a/test/corpus/connection.txt +++ b/test/corpus/connection.txt @@ -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