fix compile errors left in previous commit

This commit is contained in:
2025-08-09 12:48:56 +01:00
parent 143d02163b
commit 6f91c6fc52
2 changed files with 20 additions and 9 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -35,7 +35,7 @@ struct
SOME (tokens, grid) => loopParseItems (tokens, grid)
| NONE => NONE
fun parseLayers (tokens, canvasWidth, canvasHeight, tree, counter) =
fun parseLayer (tokens, canvasWidth, canvasHeight, tree, counter) =
case tokens of
T.L_BRACKET :: tl =>
let
@@ -44,12 +44,23 @@ struct
case startParseItems (tl, grid) of
SOME (T.R_BRACKET :: tl, grid) =>
let val tree = LayerTree.insert (counter, grid, tree)
in parseLayers (tl, canvasWidth, canvasHeight, tree, counter + 1)
in SOME (tl, tree)
end
| SOME _ => NONE
| NONE => (tokens, tree)
| NONE => NONE
end
| _ => (tokens, tree)
| _ => NONE
fun parseLayerLoop (tokens, canvasWidth, canvasHeight, tree, counter) =
case parseLayer (tokens, canvasWidth, canvasHeight, tree, counter) of
SOME (tl, tree) =>
parseLayerLoop (tl, canvasWidth, canvasHeight, tree, counter + 1)
| NONE => SOME (tokens, tree)
fun startParseLayer (tokens, canvasWidth, canvasHeight, tree) =
case parseLayer (tokens, canvasWidth, canvasHeight, tree, 1) of
SOME (tl, tree) => parseLayerLoop (tl, canvasWidth, canvasHeight, tree, 2)
| NONE => NONE
fun parse string =
case Lexer.scan string of
@@ -59,12 +70,12 @@ struct
let
val maxSide = Int.max (canvasWidth, canvasHeight)
val tree = LayerTree.init maxSide
val (tokens, tree) = parseLayers
(tl, canvasWidth, canvasHeight, tree, 1)
in
case tokens of
[T.R_BRACE] => SOME (canvasWidth, canvasHeight, tree)
| _ => NONE
case startParseLayer (tl, canvasWidth, canvasHeight, tree) of
SOME ([T.R_BRACE], tree) =>
SOME (canvasWidth, canvasHeight, tree)
| SOME _ => NONE
| NONE => NONE
end
| _ => NONE)
| NONE => NONE