diff --git a/dotscape b/dotscape index d0cc043..7e04700 100755 Binary files a/dotscape and b/dotscape differ diff --git a/functional-core/file/parse-file.sml b/functional-core/file/parse-file.sml index 7b58591..77ac6c9 100644 --- a/functional-core/file/parse-file.sml +++ b/functional-core/file/parse-file.sml @@ -5,7 +5,7 @@ end structure ParseFile :> PARSE_FILE = struct - datatype triangle_token = X | Y | COORD of Real32.real | UNKNOWN of string + datatype triangle_token = X | Y | R | G | B | COORD of Real32.real | UNKNOWN of string val zero: Real32.real = 0.0 @@ -26,6 +26,7 @@ struct , Y , COORD y3 ] => + (* file format not specifying any colours *) SOME { x1 = x1 , y1 = y1 @@ -37,6 +38,40 @@ struct , g = zero , b = zero } + | [ X + , COORD x1 + , Y + , COORD y1 + + , X + , COORD x2 + , Y + , COORD y2 + + , X + , COORD x3 + , Y + , COORD y3 + + , R + , COORD r + , G + , COORD g + , B + , COORD b + ] => + (* file format specifying rgb *) + SOME + { x1 = x1 + , y1 = y1 + , x2 = x2 + , y2 = y2 + , x3 = x3 + , y3 = y3 + , r = r + , g = g + , b = b + } | _ => NONE fun tokeniseString str = @@ -44,6 +79,12 @@ struct X else if str = "y" then Y + else if str = "r" then + R + else if str = "g" then + G + else if str = "B" then + B else case Real32.fromString str of SOME num => COORD num