fix lexer/parser bugs, add code in file-thread.sml to handle loading/saving of files (but loading is not completely finished yet)

This commit is contained in:
2025-07-12 07:03:09 +01:00
parent eb0b8d31b2
commit dcf6bc074d
8 changed files with 42 additions and 43 deletions

View File

@@ -8,8 +8,6 @@ struct
open FileMessage
open InputMessage
datatype parse_result = OK of unit | PARSE_ERROR
val structureName = "Green"
val filename = "green.dsc"
val exportFilename = "green.sml"
@@ -49,7 +47,21 @@ struct
fun parse (io, acc) = ()
fun loadSquares (path, inputMailbox) = ()
fun loadIO (io, str) =
case TextIO.inputLine io of
SOME line => loadIO (io, str ^ line)
| NONE => str
fun loadSquares (path, inputMailbox) =
let
val io = TextIO.openIn filename
val str = loadIO (io, "")
val () = TextIO.closeIn io
in
case Parser.parse str of
SOME (canvasWidth, canvasHeight, grid) => ()
| NONE => ()
end
fun saveSquares squaresString =
let