packages feed

madlang 2.4.2.25 → 3.0.0.0

raw patch · 5 files changed

+23/−14 lines, 5 files

Files

README.md view
@@ -104,8 +104,8 @@     1.0 "dimpled"  :category adjective-    color-    texture+    | color+    | texture  :return     1.0 adjective
madlang.cabal view
@@ -1,5 +1,5 @@ name:                madlang-version:             2.4.2.25+version:             3.0.0.0 synopsis:            Randomized templating language DSL description:         Madlang is a text templating language written in Haskell,                      meant to explore computational creativity and generative
man/madlang.1 view
@@ -41,7 +41,11 @@ madlang install .SH EDITOR INTEGRATION .PP-A vim plugin is available from+You can install a vim plugin for Madlang using+.PP+madlang vim+.PP+Alternately, it is available from .PP https://github.com/vmchale/madlang\-vim .SH MODIFIERS
src/Text/Madlibs/Ana/Parse.hs view
@@ -30,6 +30,9 @@ lexeme :: Parser a -> Parser a lexeme = L.lexeme spaceConsumer +spaceOnly :: Parser ()+spaceOnly = L.space (void . some $ oneOf ("\t " :: String)) (L.skipLineComment "#") (L.skipBlockComment "{#" "#}")+ -- | space consumer with awareness for comments spaceConsumer :: Parser () spaceConsumer = L.space (void . some $ spaceChar) (L.skipLineComment "#") (L.skipBlockComment "{#" "#}")@@ -104,26 +107,26 @@ preStr ins = do {         n <- name ;         mod' <- many modifier ;-        spaceConsumer ;+        spaceOnly ;         pure $ Name n (foldr (.) id mod')     } <|>     do {         v <- var ;         mod' <- many modifier ;-        spaceConsumer ;-        pure . PreTok . foldr (.) id mod' $ ins `access` (v-1) -- ins !! (v - 1)+        spaceOnly ;+        pure . PreTok . foldr (.) id mod' $ ins `access` (v-1)     } <|>     do {         s <- quote (many $ noneOf ("\n\"" :: String)) ;         mod' <- many modifier ;-        spaceConsumer ;+        spaceOnly ;         pure . PreTok . foldr (.) id mod' . T.pack $ s     }     <?> "string or function name"  -- | Parse a probability/corresponding template pair :: [T.Text] -> Parser (Prob, [PreTok])-pair ins = do+pair ins = lexeme $ do     indentGuard     p <- float     str <- some (preStr ins)@@ -131,10 +134,12 @@  -- | Parse a function name for a `:category` block. function :: Parser (Prob, [PreTok])-function = do+function = lexeme $ do     indentGuard-    str <- preStr mempty-    pure (1.0, [str]) <?> "Function name"+    char '|'+    spaceOnly+    str <- some (preStr mempty)+    pure (1.0, str) <?> "Function name"  -- | Parse an `include` inclusions :: Parser [T.Text]
test/templates/cat.mad view
@@ -1,6 +1,6 @@ :category places-    country-    state+    | "Country: " country+    | "State: " state  :define country     1.0 "UK"