summaryrefslogtreecommitdiff
path: root/src/compiler.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-03-10 20:22:03 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-03-10 20:22:03 -0500
commit1fe0be9d980e9a4a47874680e4ac4ee1de6dd374 (patch)
treeaacb1636006c4769a35985cd865b599a4ff6d8f9 /src/compiler.sml
parentc824364cb48385480667ce646425d37ec0ad87b0 (diff)
Ignore JavaScript events in Effectize; allow extra spaces for 'jsFunc'; eat carriage returns at line ends in .urp files
Diffstat (limited to 'src/compiler.sml')
-rw-r--r--src/compiler.sml20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index ed76fa8c..572129bf 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -307,6 +307,8 @@ fun trim s =
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 @@ fun inputCommentableLine inf =
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 parseUrp' accLibs fname =
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