Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
1432:7d024767b024 | 1433:66092ce45a76 |
---|---|
305 val (s, _) = Substring.splitr Char.isSpace s | 305 val (s, _) = Substring.splitr Char.isSpace s |
306 in | 306 in |
307 s | 307 s |
308 end | 308 end |
309 | 309 |
310 val trimS = Substring.string o trim o Substring.full | |
311 | |
310 structure M = BinaryMapFn(struct | 312 structure M = BinaryMapFn(struct |
311 type ord_key = string | 313 type ord_key = string |
312 val compare = String.compare | 314 val compare = String.compare |
313 end) | 315 end) |
314 | 316 |
345 let | 347 let |
346 val s = #1 (Substring.splitl (fn ch => ch <> #"#") (Substring.full s)) | 348 val s = #1 (Substring.splitl (fn ch => ch <> #"#") (Substring.full s)) |
347 val s = #1 (Substring.splitr (not o Char.isSpace) s) | 349 val s = #1 (Substring.splitr (not o Char.isSpace) s) |
348 in | 350 in |
349 Substring.string (if Substring.size s > 0 andalso Char.isSpace (Substring.sub (s, Substring.size s - 1)) then | 351 Substring.string (if Substring.size s > 0 andalso Char.isSpace (Substring.sub (s, Substring.size s - 1)) then |
350 Substring.trimr 1 s | 352 if Substring.size s > 1 andalso Char.isSpace (Substring.sub (s, Substring.size s - 2)) then |
353 Substring.trimr 2 s | |
354 else | |
355 Substring.trimr 1 s | |
351 else | 356 else |
352 s) | 357 s) |
353 end) (TextIO.inputLine inf) | 358 end) (TextIO.inputLine inf) |
354 | 359 |
355 fun parseUrp' accLibs fname = | 360 fun parseUrp' accLibs fname = |
634 ("", "")) | 639 ("", "")) |
635 | 640 |
636 fun ffiM () = | 641 fun ffiM () = |
637 case String.fields (fn ch => ch = #"=") arg of | 642 case String.fields (fn ch => ch = #"=") arg of |
638 [f, s] => | 643 [f, s] => |
639 (case String.fields (fn ch => ch = #".") f of | 644 let |
640 [m, x] => ((m, x), s) | 645 val f = trimS f |
641 | _ => (ErrorMsg.error (cmd ^ " argument not of the form Module.func=func'"); | 646 val s = trimS s |
642 (("", ""), ""))) | 647 in |
648 case String.fields (fn ch => ch = #".") f of | |
649 [m, x] => ((m, x), s) | |
650 | _ => (ErrorMsg.error (cmd ^ " argument not of the form Module.func=func'"); | |
651 (("", ""), "")) | |
652 end | |
643 | _ => (ErrorMsg.error (cmd ^ " argument not of the form Module.func=func'"); | 653 | _ => (ErrorMsg.error (cmd ^ " argument not of the form Module.func=func'"); |
644 (("", ""), "")) | 654 (("", ""), "")) |
645 in | 655 in |
646 case cmd of | 656 case cmd of |
647 "prefix" => prefix := SOME arg | 657 "prefix" => prefix := SOME arg |