From 1aae2e93d9e7bb61f36b91091fb1105e5a3bd4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Brachtha=CC=88user?= Date: Wed, 16 Aug 2023 19:33:43 +0200 Subject: [PATCH] Improve position and error recovery --- effekt/shared/src/main/scala/effekt/Parser.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/effekt/shared/src/main/scala/effekt/Parser.scala b/effekt/shared/src/main/scala/effekt/Parser.scala index 09a812d01..d0d4aa7d7 100644 --- a/effekt/shared/src/main/scala/effekt/Parser.scala +++ b/effekt/shared/src/main/scala/effekt/Parser.scala @@ -476,8 +476,8 @@ class EffektParsers(positions: Positions) extends EffektLexers(positions) { lazy val int = integerLiteral.flatMap { n => try { val number = n.toInt; - success(IntLit(number)) - } catch { case e => error("Not a 32bit integer literal.") } + success(IntLit(number).withPositionOf(n)) + } catch { case e => failure("Not a 32bit integer literal.") } } lazy val bool = `true` ^^^ BooleanLit(true) | `false` ^^^ BooleanLit(false) lazy val unit = literal("()") ^^^ UnitLit()