Mercurial > urweb
diff src/compiler.sml @ 1433:66092ce45a76
Ignore JavaScript events in Effectize; allow extra spaces for 'jsFunc'; eat carriage returns at line ends in .urp files
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 10 Mar 2011 20:22:03 -0500 |
parents | 56ba9c442a2d |
children | 3d5e4c5fb6ee |
line wrap: on
line diff
--- a/src/compiler.sml Thu Mar 10 19:26:35 2011 -0500 +++ b/src/compiler.sml Thu Mar 10 20:22:03 2011 -0500 @@ -307,6 +307,8 @@ s end +val trimS = Substring.string o trim o Substring.full + structure M = BinaryMapFn(struct type ord_key = string val compare = String.compare @@ -347,7 +349,10 @@ val s = #1 (Substring.splitr (not o Char.isSpace) s) in Substring.string (if Substring.size s > 0 andalso Char.isSpace (Substring.sub (s, Substring.size s - 1)) then - Substring.trimr 1 s + if Substring.size s > 1 andalso Char.isSpace (Substring.sub (s, Substring.size s - 2)) then + Substring.trimr 2 s + else + Substring.trimr 1 s else s) end) (TextIO.inputLine inf) @@ -636,10 +641,15 @@ fun ffiM () = case String.fields (fn ch => ch = #"=") arg of [f, s] => - (case String.fields (fn ch => ch = #".") f of - [m, x] => ((m, x), s) - | _ => (ErrorMsg.error (cmd ^ " argument not of the form Module.func=func'"); - (("", ""), ""))) + let + val f = trimS f + val s = trimS s + in + case String.fields (fn ch => ch = #".") f of + [m, x] => ((m, x), s) + | _ => (ErrorMsg.error (cmd ^ " argument not of the form Module.func=func'"); + (("", ""), "")) + end | _ => (ErrorMsg.error (cmd ^ " argument not of the form Module.func=func'"); (("", ""), "")) in