summaryrefslogtreecommitdiff
path: root/src/lib/Codec
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-08-28 13:43:15 +0200
committerLars-Dominik Braun <lars@6xq.net>2022-08-28 13:44:32 +0200
commitbf3e3d9ceec8a60ee7be22a7d4dcc6f6180ba34e (patch)
tree21d784831624f5b03d2a36d89e8b5a821a3ae159 /src/lib/Codec
parente3f0d5881ce160739765cad0914e3acb0ad2c1c3 (diff)
downloadpesto-bf3e3d9ceec8a60ee7be22a7d4dcc6f6180ba34e.tar.gz
pesto-bf3e3d9ceec8a60ee7be22a7d4dcc6f6180ba34e.tar.bz2
pesto-bf3e3d9ceec8a60ee7be22a7d4dcc6f6180ba34e.zip
lint: Resolve and remove some todo’s
Diffstat (limited to 'src/lib/Codec')
-rw-r--r--src/lib/Codec/Pesto/Lint.lhs51
1 files changed, 9 insertions, 42 deletions
diff --git a/src/lib/Codec/Pesto/Lint.lhs b/src/lib/Codec/Pesto/Lint.lhs
index 919eeef..900a700 100644
--- a/src/lib/Codec/Pesto/Lint.lhs
+++ b/src/lib/Codec/Pesto/Lint.lhs
@@ -34,8 +34,7 @@ provided by the Pesto language properly.
Graph properties
++++++++++++++++
-- weakly connected, no dangling nodes/subgraphs
-- acyclic
+.. _resultsused:
The graph must have exactly one root node (i.e. a node with incoming edges
only). This also requires all results and alternatives to be referenced
@@ -67,12 +66,6 @@ Directives and unknown instructions are dangling and thus root nodes.
Metadata
++++++++
-.. _resultsused:
-
-.. class:: todo
-
-root node can be alternative too?
-
The graph’s root node must be a result. It contains yield (amount and unit) and
title (object) of the recipe.
@@ -119,19 +112,19 @@ The following metadata keys are permitted:
> knownKeys = [
-Both, title and description, are implicit.
+The title, description and yield are implicit.
> "title"
> , "description"
+> , "yield"
The recipe’s language, as 2 character code (`ISO 639-1
<http://www.loc.gov/standards/iso639-2/php/English_list.php>`_).
> , "language"
-Yield and time both must be a quantity.
+Time both must be a time-unit quantity.
-> , "yield"
> , "time"
An image can be a relative file reference or URI
@@ -140,10 +133,6 @@ An image can be a relative file reference or URI
> , "author"
> ]
-.. class:: todo
-
-Check the metadata’s value format. I.e. yield/time must be quantity
-
For instance a german language recipe for one person would look like this:
> testMetadata = [
@@ -251,16 +240,11 @@ accepted.
> , "cm", "dm", "m"
> ] ++ timeUnits
-Usage of imperial units (inch, pound, …) as well as non-XXX units like
-“teaspoon”, “cup”, … is discouraged because the former is used by just three
-countries in the world right now and the latter is language- and
-country-dependent. The implementation may provide the user with a conversion
-utility.
-
-.. class:: todo
-
-- example: 1 oz ~= 28.349523125 g, can only be approximated by rational number, for instance 29767/1050 g
-- 15 oz would are :math:`\frac{29767}{70} \mathrm{g} = 425+\frac{17}{70} \mathrm{g}`, since nobody sells 17/70 g the implementation would round down to ~425 g (although <1g is not really enough to justify adding approx)
+Usage of imperial units (inch, pound, …) as well as non-standard
+units like “teaspoon”, “cup” or similar is discouraged because
+the former is used by just three countries in the world right now and
+the latter is language- and country-dependent. The implementation may
+provide the user with a conversion utility.
> testLintWellKnownUnit = [
> cmpLint "+1 in foobar >bar" [LintResult UnitNotWellKnown [0]]
@@ -275,11 +259,6 @@ utility.
The unit is case-sensitive, thus
-.. class:: todo
-
-Should we allow case-insensitive units? References are case-insensitive as
-well…
-
> , cmpLint "+1 Mg foobar >bar" [LintResult UnitNotWellKnown [0]]
> , cmpLint "+1 kG foobar >bar" [LintResult UnitNotWellKnown [0]]
> , cmpLint "&1 MIN [foo] >bar" [LintResult UnitNotWellKnown [0]]
@@ -329,21 +308,9 @@ make the alternative pointless.
> testLintTwoAlternatives = [
> cmpLint "+A |foo *foo >bar" [LintResult TooFewChildren [1]]
> , cmpLint "+A +B |foo *foo >bar" []
-
-.. class:: todo
-
-should we allow this? it does not make sense imo
-
> , cmpLint "+A &B |foo *foo >bar" []
> ]
-.. _reject-loops:
-
-.. class:: todo
-
-- reject loops
-- reject multiple results/alternatives with the same name
-
Ranges
++++++