Phase 4: Recipe references + all 4 example file validation

- Fix pRecipeRef to include ./ prefix in stored path
- Add recipe reference test
- Add parse-validation tests for all 4 example .cook files
  (EasyPancakes, FriedRice, CoffeeSouffle, OlivierSalad)
- All 24 tests passing, all examples parse without error
This commit is contained in:
2026-05-18 22:59:44 -04:00
parent b5482d8785
commit c68d80e9c1
2 changed files with 44 additions and 1 deletions
+2 -1
View File
@@ -131,11 +131,12 @@ pLineBreak = do
pRecipeRef :: Parser StepItem
pRecipeRef = do
_ <- P.char '@'
-- Consume @ and store ./ as part of the path
_ <- P.char '.'
_ <- P.char '/'
path <- P.many (P.noneOf "{(\n\\")
mqty <- P.optionMaybe (P.between (P.char '{') (P.char '}') pQuantityBody)
return (StepRecipeRef (RecipeRef path (join mqty)))
return (StepRecipeRef (RecipeRef ("./" <> path) (join mqty)))
-- | Ingredient: @name{quantity%unit}(preparation)
pIngredient :: Parser StepItem