Better error handling
authorunc0rr
Tue, 16 Oct 2012 22:35:01 +0400
changeset 7762 d2fd8040534f
parent 7761 6dc1be8ff73e
child 7763 6ab7307fcec3
Better error handling
tools/PascalParser.hs
tools/PascalPreprocessor.hs
--- a/tools/PascalParser.hs	Tue Oct 16 13:41:23 2012 -0400
+++ b/tools/PascalParser.hs	Tue Oct 16 22:35:01 2012 +0400
@@ -369,7 +369,7 @@
         , char '$' >> many hexDigit >>=  \h -> comments >> return (HexNumber h)
         --, char '-' >> expression >>= return . PrefixOp "-"
         , char '-' >> reference >>= return . PrefixOp "-" . Reference
-        , try $ string "not" >> error "unexpected not in term"
+        , (try $ string "not" >> notFollowedBy comments) >> unexpected "'not'"
         , try $ string "nil" >> return Null
         , reference >>= return . Reference
         ] <?> "simple expression"
--- a/tools/PascalPreprocessor.hs	Tue Oct 16 13:41:23 2012 -0400
+++ b/tools/PascalPreprocessor.hs	Tue Oct 16 22:35:01 2012 +0400
@@ -121,7 +121,7 @@
         try $ string "DEFINE"
         spaces
         i <- identifier
-        d <- ((string ":=" >> return ())<|> spaces) >> many (noneOf "}")
+        d <- ((string ":=" >> return ()) <|> spaces) >> many (noneOf "}")
         char '}'
         updateState $ \(m, b) -> (if (and b) && (head i /= '_') then Map.insert i d m else m, b)
         return ""