Fix parsing and rendering issues, all but 3 of aoc2024 work.
This commit is contained in:
@@ -84,7 +84,7 @@ getOps = P $ \ toks com ops col => OK ops toks com ops
|
||||
|
||||
addOp : String -> Int -> Fixity -> Parser Unit
|
||||
addOp nm prec fix = P $ \ toks com ops col =>
|
||||
let parts = split "_" nm in
|
||||
let parts = split nm "_" in
|
||||
case parts of
|
||||
"" :: key :: rule => OK MkUnit toks com (updateMap key (MkOp nm prec fix False rule) ops)
|
||||
key :: rule => OK MkUnit toks com (updateMap key (MkOp nm prec fix True rule) ops)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user