refactor: implemented labelAndExplain(), combining label and explain, and... #9

Merged
gc1523 merged 18 commits from error-messages into master 2025-02-06 20:30:26 +00:00
2 changed files with 113 additions and 25 deletions
Showing only changes of commit 8b64f2e352 - Show all commits

View File

@@ -119,13 +119,9 @@ object ast {
case class Print(expr: Expr, newline: Boolean) extends Stmt
object Print extends ParserBridge2[Expr, Boolean, Print]
case class If(cond: Expr, thenStmt: NonEmptyList[Stmt], elseStmt: NonEmptyList[Stmt]) extends Stmt
object If extends ParserBridge3[Expr, NonEmptyList[Stmt], NonEmptyList[Stmt], If] {
override def labels = List("if statement")
}
object If extends ParserBridge3[Expr, NonEmptyList[Stmt], NonEmptyList[Stmt], If]
case class While(cond: Expr, body: NonEmptyList[Stmt]) extends Stmt
object While extends ParserBridge2[Expr, NonEmptyList[Stmt], While] {
override def labels = List("while statement")
}
object While extends ParserBridge2[Expr, NonEmptyList[Stmt], While]
case class Block(stmt: NonEmptyList[Stmt]) extends Stmt
object Block extends ParserBridge1[NonEmptyList[Stmt], Block]