--- a/tools/PascalParser.hs Wed Jun 27 22:53:26 2012 +0400
+++ b/tools/PascalParser.hs Thu Jun 28 00:30:50 2012 +0400
@@ -72,12 +72,15 @@
return vs
aVarDecl endsWithSemi = do
- unless endsWithSemi $
- optional $ choice [
- try $ string "var"
- , try $ string "const"
- , try $ string "out"
- ]
+ isVar <- liftM (== Just "var") $
+ if not endsWithSemi then
+ optionMaybe $ choice [
+ try $ string "var"
+ , try $ string "const"
+ , try $ string "out"
+ ]
+ else
+ return Nothing
comments
ids <- do
i <- (commaSep1 pas) $ (try iD <?> "variable declaration")
@@ -92,7 +95,7 @@
e <- initExpression
comments
return (Just e)
- return $ VarDeclaration False (ids, t) init
+ return $ VarDeclaration isVar False (ids, t) init
constsDecl = do
@@ -113,7 +116,7 @@
comments
e <- initExpression
comments
- return $ VarDeclaration (isNothing t) ([i], fromMaybe (DeriveType e) t) (Just e)
+ return $ VarDeclaration False (isNothing t) ([i], fromMaybe (DeriveType e) t) (Just e)
typeDecl = choice [
char '^' >> typeDecl >>= return . PointerTo