From d08042be1e0ae158f124bb6848f5843a804a6544 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Tue, 6 Sep 2022 22:22:32 +0100 Subject: Assignation --- src/Parser.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Parser.hs') diff --git a/src/Parser.hs b/src/Parser.hs index 5ee6de9..12f04d9 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -7,10 +7,18 @@ import Text.Parsec import qualified Text.Parsec.Expr as E import Text.Parsec.String (Parser) -binary s f assoc = E.Infix (reservedOp s >> return (BinOp f)) assoc +binary s f assoc = + E.Infix + ( reservedOp s + >> do + pos <- getPosition + return $ BinOp f pos + ) + assoc opTable = - [ [ binary "*" Mul E.AssocLeft, + [ [binary "=" Assign E.AssocLeft], + [ binary "*" Mul E.AssocLeft, binary "/" Div E.AssocLeft ], [ binary "+" Plus E.AssocLeft, -- cgit v1.2.3