From b7f1f58d246d0fb61bfd954e0638c27da1460a03 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 1 Sep 2022 22:41:08 +0100 Subject: Use the position of the ident --- src/Parser.hs | 3 +-- test/Language.hs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Parser.hs b/src/Parser.hs index f341bc2..de8cce0 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -118,9 +118,8 @@ call = do var :: Parser Expr var = do - pos <- getPosition reserved "var" - (ident, typ, _) <- arg + (ident, typ, pos) <- arg reservedOp "=" "assignation" value <- expr reservedOp ";" diff --git a/test/Language.hs b/test/Language.hs index 9a3ca5d..fbb9c3b 100644 --- a/test/Language.hs +++ b/test/Language.hs @@ -191,7 +191,7 @@ testCase13 = "module main\n\ \var a: u8 = 10;" [ A.Module "main" $ newPos "test" 1 1, - A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 13) $ newPos "test" 2 1 + A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 13) $ newPos "test" 2 5 ] -- test errors -- cgit v1.2.3