From b7cc2048d6aa411a6e0be209a0bc2dfb1911edb5 Mon Sep 17 00:00:00 2001 From: Midgard Date: Mon, 27 Jan 2020 00:26:51 +0100 Subject: [PATCH] Forbid tags and price on choice blocks --- app/hlds/hlds.tatsu | 10 +++++++--- data/fritoloog.hlds | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/hlds/hlds.tatsu b/app/hlds/hlds.tatsu index 62538b2..cb4d38c 100644 --- a/app/hlds/hlds.tatsu +++ b/app/hlds/hlds.tatsu @@ -28,9 +28,13 @@ location_attribute = location = >location_header items:{ block } ; -attributes = +name_and_description = name:/[^\n]*?(?= +-- | +:: | +€ |\n)/ [ s '--' ~ s description:/[^\n]*?(?= +:: | +€ |\n)/ ] + ; + +attributes = + >name_and_description [ s '::' {s ('{' tags+:identifier '}')} ] [ [ s '::' ~ ] s price:price ] ; @@ -56,7 +60,7 @@ indent_choice_entry = n '\t\t' >choice_entry ; # Toplevel choice definitions choice_block = - id:identifier ':' s >attributes entries:{ noindent_choice_entry } + id:identifier ':' s >name_and_description entries:{ noindent_choice_entry } n ; @@ -66,7 +70,7 @@ choice_block = indent_choice_block = '\t' type:choice_type s ( - | kind:`declaration` id:identifier ':' ~ s >attributes entries:{ indent_choice_entry } + | kind:`declaration` id:identifier ':' ~ s >name_and_description entries:{ indent_choice_entry } | kind:`reference` id:identifier [ s price:price ] ) n diff --git a/data/fritoloog.hlds b/data/fritoloog.hlds index 1884526..393639b 100644 --- a/data/fritoloog.hlds +++ b/data/fritoloog.hlds @@ -24,8 +24,10 @@ sauce: Saus stew: Stoofvleessaus :: {has_meat} € 0.5 other: Andere (in commentaar) -extra_cheese: Extra kaas € 0.2 +extra_cheese: Extra kaas # FIXME extra kaas waarop? + no_extra_cheese: Nee + yes_extra_cheese: Ja € 0.2 dish chicken_fingers: Kippenvingers :: {has_meat} € 3 dish nuggiz: Nuggiz :: {has_meat} € 3