on master help sign in
Merge pull request #480 from Dandandan/dev
04df608Evan Czaplicki
compiler/Parse/Expression.hs+2−2
@@ -60,11 +60,11 @@ listTerm = markdown' <|> braces (try range <|> ExplicitList <$> commaSep expr)
60 span uid index =
60 span uid index =
61 "<span id=\"md-" ++ uid ++ "-" ++ show index ++ "\">{{ markdown interpolation is in the pipeline, but still needs more testing }}</span>"
61 "<span id=\"md-" ++ uid ++ "-" ++ show index ++ "\">{{ markdown interpolation is in the pipeline, but still needs more testing }}</span>"
62
62
63− interpolation uid md exprs = do
63+ interpolation uid exprs = do
64 try (string "{{")
64 try (string "{{")
65 e <- padded expr
65 e <- padded expr
66 string "}}"
66 string "}}"
67− return (md ++ span uid (length exprs), exprs ++ [e])
67+ return (span uid (length exprs), exprs ++ [e])
68
68
69parensTerm :: IParser LParseExpr
69parensTerm :: IParser LParseExpr
70parensTerm = try (parens opFn) <|> parens (tupleFn <|> parened)
70parensTerm = try (parens opFn) <|> parens (tupleFn <|> parened)
compiler/Parse/Helpers.hs+6−6
@@ -268,7 +268,7 @@ ignoreUntil end = go
268 ignore p = const () <$> p
268 ignore p = const () <$> p
269 filler = choice [ try (ignore chr) <|> ignore str
269 filler = choice [ try (ignore chr) <|> ignore str
270 , ignore multiComment
270 , ignore multiComment
271− , ignore (markdown (\_ _ -> mzero))
271+ , ignore (markdown (\_ -> mzero))
272 , ignore anyChar
272 , ignore anyChar
273 ]
273 ]
274 go = choice [ Just <$> end
274 go = choice [ Just <$> end
@@ -301,15 +301,15 @@ anyUntilPos pos = go
301 True -> return []
301 True -> return []
302 False -> (:) <$> anyChar <*> go
302 False -> (:) <$> anyChar <*> go
303
303
304−markdown :: (String -> [a] -> IParser (String, [a])) -> IParser (String, [a])
304+markdown :: ([a] -> IParser (String, [a])) -> IParser (String, [a])
305−markdown interpolation = try (string "[markdown|") >> closeMarkdown "" []
305+markdown interpolation = try (string "[markdown|") >> closeMarkdown (++ "") []
306 where
306 where
307 closeMarkdown md stuff =
307 closeMarkdown md stuff =
308 choice [ do try (string "|]")
308 choice [ do try (string "|]")
309− return (md, stuff)
309+ return (md "", stuff)
310− , uncurry closeMarkdown =<< interpolation md stuff
310+ , (\(m,s) -> closeMarkdown (md . (m ++)) s) =<< interpolation stuff
311 , do c <- anyChar
311 , do c <- anyChar
312− closeMarkdown (md ++ [c]) stuff
312+ closeMarkdown (md . ([c]++)) stuff
313 ]
313 ]
314
314
315--str :: IParser String
315--str :: IParser String