diff --git a/grammar.js b/grammar.js index 1dbf62b..da69a22 100644 --- a/grammar.js +++ b/grammar.js @@ -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 ), diff --git a/src/grammar.json b/src/grammar.json index da84d96..2c275d2 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -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" } ] }, diff --git a/src/parser.c b/src/parser.c index 1ab4615..e221615 100644 Binary files a/src/parser.c and b/src/parser.c differ