# HG changeset patch # User unc0rr # Date 1320863780 -10800 # Node ID ac23ba018ed295cc19e19c38d4d03490f32d7b7f # Parent 1f7a7a330c598eef0e9634e5eea22de0363782b1 Fix inifinite loops diff -r 1f7a7a330c59 -r ac23ba018ed2 tools/PascalParser.hs --- a/tools/PascalParser.hs Wed Nov 09 21:28:52 2011 +0300 +++ b/tools/PascalParser.hs Wed Nov 09 21:36:20 2011 +0300 @@ -66,7 +66,7 @@ | Null deriving Show data Reference = ArrayElement Identifier Expression - | FunCall Reference [Expression] + | FunCall [Expression] Reference | SimpleReference Identifier | Dereference Reference | RecordField Reference Reference @@ -148,15 +148,16 @@ term = comments >> choice [ parens pas reference , try $ iD >>= \i -> (brackets pas) expression >>= return . ArrayElement i - , try $ funCall - , try $ reference >>= \r -> char '^' >> return (Dereference r) , char '@' >> reference >>= return . Address , iD >>= return . SimpleReference ] "simple reference" table = [ - [Infix (try (char '.' >> notFollowedBy (char '.')) >> return RecordField) AssocLeft] + [Postfix $ (parens pas) (option [] parameters) >>= return . FunCall] + , [Postfix (char '^' >> return Dereference)] + , [Infix (try (char '.' >> notFollowedBy (char '.')) >> return RecordField) AssocLeft] ] + varsDecl1 = varsParser sepEndBy1 varsDecl = varsParser sepEndBy @@ -525,11 +526,6 @@ p <- option [] $ (parens pas) parameters return $ ProcCall i p -funCall = do - r <- reference - p <- (parens pas) $ option [] parameters - return $ FunCall r p - parameters = (commaSep pas) expression "parameters" functionBody = do