Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

More strict about parse failure

  • Loading branch information...
commit 414dbd4cbe8ccade0d69ecf6e1186b2f8f48eb91 1 parent 0c05f43
Stephen Paul Weber authored

Showing 1 changed file with 7 additions and 4 deletions. Show diff stats Hide diff stats

  1. +7 4 mustache2hs.hs
11 mustache2hs.hs
@@ -320,10 +320,13 @@ codeGenFile recs (input, rname) = do
320 320 | otherwise -> fail ("Type mismatch, template " ++ input ++ " expects both " ++ r ++ " and " ++ "rname")
321 321 Nothing -> do
322 322 modify ((input',rname):)
323   - Right tree <- lift $ parse parser input <$> T.readFile input
324   - let fname = camelCasePath (dropExtension input)
325   - let (builder, partials) = evalState (codeGenTree input fname rname recs tree 0) (0::Int)
326   - return (Just builder, partials)
  323 + parsed <- lift $ parse (parser <* eof) input <$> T.readFile input
  324 + case parsed of
  325 + Right tree -> do
  326 + let fname = camelCasePath (dropExtension input)
  327 + let (builder, partials) = evalState (codeGenTree input fname rname recs tree 0) (0::Int)
  328 + return (Just builder, partials)
  329 + Left msg -> error (show msg)
327 330 where
328 331 input' = normalise input
329 332

0 comments on commit 414dbd4

Please sign in to comment.
Something went wrong with that request. Please try again.