From 69cd5b7bef01f27f1df5f1f8aad893e7807de583 Mon Sep 17 00:00:00 2001 From: Oriol Linan Date: Thu, 9 Jan 2025 23:58:21 +0100 Subject: [PATCH] fix: build error --- lib/Ast/Parser/Expr.hs | 2 +- lib/Ast/Parser/Utils.hs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Ast/Parser/Expr.hs b/lib/Ast/Parser/Expr.hs index b58eb62..9b29fb0 100644 --- a/lib/Ast/Parser/Expr.hs +++ b/lib/Ast/Parser/Expr.hs @@ -50,7 +50,7 @@ operationTable = PU.binary "||" (`AT.Op` AT.Or), PU.binary "or" (`AT.Op` AT.Or) ], - [ PU.postfix ".*" (`AT.UnaryOp` AT.Deref), + [ PU.postfix "." (`AT.UnaryOp` AT.Deref), PU.postfix "++" (`AT.UnaryOp` AT.PostInc), PU.postfix "--" (`AT.UnaryOp` AT.PostDec), parseCall diff --git a/lib/Ast/Parser/Utils.hs b/lib/Ast/Parser/Utils.hs index ba6faa6..c13a7b1 100644 --- a/lib/Ast/Parser/Utils.hs +++ b/lib/Ast/Parser/Utils.hs @@ -2,6 +2,7 @@ module Ast.Parser.Utils where import qualified Ast.Parser.State as PS import qualified Ast.Types as AT +import qualified Control.Monad.Combinators.Expr as CE import qualified Control.Monad.State as S import qualified Text.Megaparsec as M import qualified Text.Megaparsec.Char as MC @@ -56,12 +57,12 @@ parseSrcLoc = do (MP.SourcePos {MP.sourceName = _sourceName, MP.sourceLine = _sourceLine, MP.sourceColumn = _sourceColumn}) <- M.getSourcePos return $ AT.SrcLoc {AT.srcFile = _sourceName, AT.srcLine = MP.unPos _sourceLine, AT.srcCol = MP.unPos _sourceColumn} -prefix :: String -> (AT.SrcLoc -> AT.Expr -> AT.Expr) -> CE.Operator PU.Parser AT.Expr -prefix name f = CE.Prefix (f <$> (PU.parseSrcLoc <* PU.symbol name)) +prefix :: String -> (AT.SrcLoc -> AT.Expr -> AT.Expr) -> CE.Operator Parser AT.Expr +prefix name f = CE.Prefix (f <$> (parseSrcLoc <* symbol name)) -postfix :: String -> (AT.SrcLoc -> AT.Expr -> AT.Expr) -> CE.Operator PU.Parser AT.Expr -postfix name f = CE.Postfix (f <$> (PU.parseSrcLoc <* PU.symbol name)) +postfix :: String -> (AT.SrcLoc -> AT.Expr -> AT.Expr) -> CE.Operator Parser AT.Expr +postfix name f = CE.Postfix (f <$> (parseSrcLoc <* symbol name)) -- | Helper functions to define operators -binary :: String -> (AT.SrcLoc -> AT.Expr -> AT.Expr -> AT.Expr) -> CE.Operator PU.Parser AT.Expr -binary name f = CE.InfixL (f <$> (PU.parseSrcLoc <* PU.symbol name)) +binary :: String -> (AT.SrcLoc -> AT.Expr -> AT.Expr -> AT.Expr) -> CE.Operator Parser AT.Expr +binary name f = CE.InfixL (f <$> (parseSrcLoc <* symbol name))