pinchot 0.8.0.0 → 0.10.0.0
raw patch · 3 files changed
+25/−18 lines, 3 files
Files
- lib/Pinchot/Examples/Postal.hs +4/−4
- lib/Pinchot/Internal.hs +19/−12
- pinchot.cabal +2/−2
lib/Pinchot/Examples/Postal.hs view
@@ -13,7 +13,7 @@ postal :: Pinchot Char (Rule Char) postal = mdo digit <- terminal "Digit" (include '0' '9') <?> "digit from 0 to 9"- digits <- list1 "Digits" digit+ digits <- list1 digit letter <- terminal "Letter" (include 'a' 'z' <> include 'A' 'Z') <?> "letter from A to Z" north <- terminal "North" (solo 'N')@@ -39,7 +39,7 @@ -- Named "PostalWord" to avoid clash with Prelude.Word word <- record "PostalWord" [letter, letters] preSpacedWord <- record "PreSpacedWord" [space, word]- preSpacedWords <- list "PreSpacedWords" preSpacedWord+ preSpacedWords <- list preSpacedWord words <- record "Words" [word, preSpacedWords] number <- wrap "Number" digits@@ -49,8 +49,8 @@ zipCode <- wrap "ZipCode" digits directionSpace <- record "DirectionSpace" [direction, space] spaceSuffix <- record "SpaceSuffix" [space, suffix]- optDirection <- option "MaybeDirection" directionSpace- optSuffix <- option "MaybeSuffix" spaceSuffix+ optDirection <- option directionSpace+ optSuffix <- option spaceSuffix address <- record "Address" [ number, space, optDirection, streetName, optSuffix, comma, space, city, comma, space, state, space, zipCode
lib/Pinchot/Internal.hs view
@@ -309,34 +309,41 @@ -- | Creates a rule for the production of a sequence of other rules.+-- The name for the created 'Rule' is the name of the 'Rule' to which+-- this function is applied, with @'Seq@ appended. list- :: RuleName-- -> Rule t+ :: Rule t -- ^ The resulting 'Rule' is a sequence of productions of this -- 'Rule'; that is, this 'Rule' may appear zero or more times. -> Pinchot t (Rule t)-list name r = newRule name (RList r)+list r@(Rule inner _ _) = newRule name (RList r)+ where+ name = inner ++ "'Seq" --- | Creates a rule for a production that appears at least once.+-- | Creates a rule for a production that appears at least once. The+-- name for the created 'Rule' is the name of the 'Rule' to which this+-- function is applied, with @'Seq1@ appended. list1- :: RuleName- -> Rule t+ :: Rule t -- ^ The resulting 'Rule' produces this 'Rule' at least once. -> Pinchot t (Rule t)-list1 name r = newRule name (RList1 r)+list1 r@(Rule inner _ _) = newRule name (RList1 r)+ where+ name = inner ++ "'Seq1" -- | Creates a rule for a production that optionally produces another--- rule.+-- rule. The name for the created 'Rule' is the name of the 'Rule' to+-- which this function is applied, with @'Maybe@ appended to the end. option- :: RuleName- -> Rule t+ :: Rule t -- ^ The resulting 'Rule' optionally produces this 'Rule'; that is, -- this 'Rule' may appear once or not at all. -> Pinchot t (Rule t)-option name r = newRule name (ROptional r)+option r@(Rule inner _ _) = newRule name (ROptional r)+ where+ name = inner ++ "'Maybe" -- | Creates a newtype wrapper.
pinchot.cabal view
@@ -3,11 +3,11 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2016-01-26 10:23:38.93759 EST+-- Generated on: 2016-01-27 06:31:22.93227 EST -- Cartel library version: 0.14.2.8 name: pinchot-version: 0.8.0.0+version: 0.10.0.0 cabal-version: >= 1.14 license: BSD3 license-file: LICENSE