From 72737335dec1e3df940c09845c4ff207fd258c9d Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Mon, 12 Aug 2024 10:50:10 +0200 Subject: [PATCH] fix: amount as parser rule --- takentaal.g4 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/takentaal.g4 b/takentaal.g4 index df9bb5a..e51b153 100644 --- a/takentaal.g4 +++ b/takentaal.g4 @@ -13,12 +13,12 @@ line plan : PLAN_TOKEN TEXT - | PLAN_TOKEN TEXT AMOUNT + | PLAN_TOKEN TEXT amount ; task : TASK_TOKEN TEXT - | TASK_TOKEN TEXT AMOUNT + | TASK_TOKEN TEXT amount ; subtask @@ -29,25 +29,29 @@ subtask ; subtask_new - : SUBTASK_NEW_TOKEN TEXT AMOUNT? + : SUBTASK_NEW_TOKEN TEXT amount? ; subtask_partial - : SUBTASK_PARTIAL_TOKEN TEXT AMOUNT? + : SUBTASK_PARTIAL_TOKEN TEXT amount? ; subtask_complete - : SUBTASK_COMPLETE_TOKEN TEXT AMOUNT? + : SUBTASK_COMPLETE_TOKEN TEXT amount? ; subtask_obsolete - : SUBTASK_OBSOLETE_TOKEN TEXT AMOUNT? + : SUBTASK_OBSOLETE_TOKEN TEXT amount? ; comment : TEXT ; +amount + : '{' INT '}' + ; + PLAN_TOKEN : '# ' ; @@ -76,11 +80,11 @@ WS : [ \r\n\t]+ -> skip ; -AMOUNT - : '{' INT+ '}' +INT + : DIGIT+ ; -fragment INT +fragment DIGIT : [0-9] ;