changeset 291:550100a44cca

'read' for strings
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 11:56:53 -0400
parents df00701f2323
children 6e665c7c96f6
files src/prepare.sml tests/fromString.ur
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/prepare.sml	Sun Sep 07 11:53:30 2008 -0400
+++ b/src/prepare.sml	Sun Sep 07 11:56:53 2008 -0400
@@ -60,6 +60,12 @@
         in
             ((ECon (dk, pc, SOME e), loc), sns)
         end
+      | ESome (t, e) =>
+        let
+            val (e, sns) = prepExp (e, sns)
+        in
+            ((ESome (t, e), loc), sns)
+        end
       | EFfi _ => (e, sns)
       | EFfiApp (m, x, es) =>
         let
--- a/tests/fromString.ur	Sun Sep 07 11:53:30 2008 -0400
+++ b/tests/fromString.ur	Sun Sep 07 11:56:53 2008 -0400
@@ -8,6 +8,11 @@
           None => 0.0
         | Some n => n
 
+fun s2s s =
+        case read _ s of
+          None => "Error"
+        | Some s => s
+
 fun s2b s =
         case read _ s of
           None => False
@@ -23,4 +28,6 @@
         Error = {cdata (show _ (s2b "Error"))}<br/>
         False = {cdata (show _ (s2b "false"))}<br/>
         True = {cdata (show _ (s2b "trUE"))}<br/>
+        <br/>
+        Hi = {cdata (s2s "Hi")}<br/>
 </body></html>