Fix parsing and rendering issues, all but 3 of aoc2024 work.

This commit is contained in:
2025-01-05 11:08:42 -08:00
parent 0dbc5d5ee7
commit 9262fa8b27
5 changed files with 64 additions and 4 deletions

View File

@@ -29,6 +29,14 @@ flatten Line = Text " "
flatten (Text str) = Text str
flatten (Alt x y) = flatten x
noAlt : Doc -> Doc
noAlt Empty = Empty
noAlt (Seq x y) = Seq (noAlt x) (noAlt y)
noAlt (Nest i x) = noAlt x
noAlt Line = Line
noAlt (Text str) = Text str
noAlt (Alt x y) = noAlt x
group : Doc -> Doc
group x = Alt (flatten x) x