fix bugs related to parsing and loading file (did not implement new BNF grammar properly)

This commit is contained in:
2025-08-09 12:39:41 +01:00
parent d6f7583273
commit 143d02163b
6 changed files with 51 additions and 30 deletions

View File

@@ -460,7 +460,7 @@ struct
fun toSaveStringFolder ({x, ex, y, ey, data = {r, g, b, a}}, acc) =
let
val item = String.concat
[ "["
[ " { "
, Int.toString x
, " "
, Int.toString y
@@ -476,7 +476,7 @@ struct
, Int.toString b
, " "
, Int.toString a
, " ] "
, " } "
]
in
item :: acc
@@ -486,9 +486,11 @@ struct
let
val qtree = buildTree (0, 0, size, grid)
val bintree = merge (qtree, grid)
val str = BinTree.foldr (toSaveStringFolder, bintree, [])
val coords = BinTree.foldr (toSaveStringFolder, bintree, [])
val coords = String.concat coords
val str = " [ " ^ coords ^ " ] "
in
String.concat str :: acc
str :: acc
end
fun toSaveString (layerTree, canvasWidth, canvasHeight) =
@@ -496,7 +498,7 @@ struct
val size = Int.max (canvasWidth, canvasHeight)
val f = toSaveStringTreeFolder size
val initial = ["}"]
val initial = ["}\n"]
val acc = LayerTree.foldr (f, layerTree, initial)
val acc =
String.concat