Commits

pchiusano committed c3960b1

TreeMsg printer now works for Multiple top-levels

  • Participants
  • Parent commits 6c63aa8
  • Branches error-reporting

Comments (0)

Files changed (1)

File src/main/scala/nomo/Errors.scala

        case _ => this
      }
      // collapses msgs at the same location and un-nests into a list of
-     // markers followed by the 
-     def trifectaStyle: TreeMsg =
-       unnest.collapse match {
+     // markers followed by most specific error message 
+     def trifectaStyle: TreeMsg = { 
+       def go(msg: TreeMsg) = msg.unnest.collapse match { 
          case Multiple(es) if es.size > 1 => Multiple(IndexedSeq( 
            Nest(Single("markers:", None), Multiple(es.init)),
            Nest(Single("error:", None), es.last)
          ))
          case c => c
        }
- 
+       this match {
+         case Multiple(es) => Multiple(es.map(go))
+         case msg => go(msg)
+       }
+     }
   }
   case class Multiple(errors: IndexedSeq[TreeMsg]) extends TreeMsg 
   case class Single(msg: String, position: Option[Position]) extends TreeMsg