merge new changes from master into semantic errors #10

Merged
al4423 merged 19 commits from master into semantic-error-messages 2025-02-06 23:39:05 +00:00
7 changed files with 114 additions and 291 deletions
Showing only changes of commit e9ed197782 - Show all commits

View File

@@ -183,13 +183,6 @@ object ast {
// Parser bridges // Parser bridges
case class Position(line: Int, column: Int, offset: Int) case class Position(line: Int, column: Int, offset: Int)
private def applyCon[A, B](
con: ((Int, Int), Int, Int) => A => B
)(ops: => Parsley[A]): Parsley[B] =
(pos, offset, withWidth(ops)).zipped.map { (pos, off, res) =>
con(pos, off, res._2)(res._1)
}
trait ParserSingletonBridgePos[+A] extends ErrorBridge { trait ParserSingletonBridgePos[+A] extends ErrorBridge {
protected def con(pos: (Int, Int), offset: Int): A protected def con(pos: (Int, Int), offset: Int): A
infix def from(op: Parsley[?]): Parsley[A] = error((pos, offset).zipped(con) <~ op) infix def from(op: Parsley[?]): Parsley[A] = error((pos, offset).zipped(con) <~ op)