fix compile errors left in previous commit
This commit is contained in:
@@ -35,7 +35,7 @@ struct
|
|||||||
SOME (tokens, grid) => loopParseItems (tokens, grid)
|
SOME (tokens, grid) => loopParseItems (tokens, grid)
|
||||||
| NONE => NONE
|
| NONE => NONE
|
||||||
|
|
||||||
fun parseLayers (tokens, canvasWidth, canvasHeight, tree, counter) =
|
fun parseLayer (tokens, canvasWidth, canvasHeight, tree, counter) =
|
||||||
case tokens of
|
case tokens of
|
||||||
T.L_BRACKET :: tl =>
|
T.L_BRACKET :: tl =>
|
||||||
let
|
let
|
||||||
@@ -44,12 +44,23 @@ struct
|
|||||||
case startParseItems (tl, grid) of
|
case startParseItems (tl, grid) of
|
||||||
SOME (T.R_BRACKET :: tl, grid) =>
|
SOME (T.R_BRACKET :: tl, grid) =>
|
||||||
let val tree = LayerTree.insert (counter, grid, tree)
|
let val tree = LayerTree.insert (counter, grid, tree)
|
||||||
in parseLayers (tl, canvasWidth, canvasHeight, tree, counter + 1)
|
in SOME (tl, tree)
|
||||||
end
|
end
|
||||||
| SOME _ => NONE
|
| SOME _ => NONE
|
||||||
| NONE => (tokens, tree)
|
| NONE => NONE
|
||||||
end
|
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 =
|
fun parse string =
|
||||||
case Lexer.scan string of
|
case Lexer.scan string of
|
||||||
@@ -59,12 +70,12 @@ struct
|
|||||||
let
|
let
|
||||||
val maxSide = Int.max (canvasWidth, canvasHeight)
|
val maxSide = Int.max (canvasWidth, canvasHeight)
|
||||||
val tree = LayerTree.init maxSide
|
val tree = LayerTree.init maxSide
|
||||||
val (tokens, tree) = parseLayers
|
|
||||||
(tl, canvasWidth, canvasHeight, tree, 1)
|
|
||||||
in
|
in
|
||||||
case tokens of
|
case startParseLayer (tl, canvasWidth, canvasHeight, tree) of
|
||||||
[T.R_BRACE] => SOME (canvasWidth, canvasHeight, tree)
|
SOME ([T.R_BRACE], tree) =>
|
||||||
| _ => NONE
|
SOME (canvasWidth, canvasHeight, tree)
|
||||||
|
| SOME _ => NONE
|
||||||
|
| NONE => NONE
|
||||||
end
|
end
|
||||||
| _ => NONE)
|
| _ => NONE)
|
||||||
| NONE => NONE
|
| NONE => NONE
|
||||||
|
|||||||
Reference in New Issue
Block a user