comparison src/jscomp.sml @ 829:20fe00fd81da

Substring functions; fix a nasty MonoReduce pattern match substitution bug
author Adam Chlipala <adamc@hcoop.net>
date Sat, 30 May 2009 13:29:00 -0400
parents 497c7dbcc695
children 74e9e7642f08
comparison
equal deleted inserted replaced
828:14a6c0971d89 829:20fe00fd81da
623 | PNone _ => strcat [str ("(d" ^ Int.toString depth ^ "?"), 623 | PNone _ => strcat [str ("(d" ^ Int.toString depth ^ "?"),
624 fail, 624 fail,
625 str ":", 625 str ":",
626 succ, 626 succ,
627 str ")"] 627 str ")"]
628 | PSome (t, p) => strcat (str ("(d" ^ Int.toString depth ^ "?") 628 | PSome (t, p) => strcat [str ("(d" ^ Int.toString depth ^ "?(d" ^ Int.toString (depth+1)
629 :: (if isNullable t then 629 ^ "=d" ^ Int.toString depth
630 [str ("d" ^ Int.toString depth 630 ^ (if isNullable t then
631 ^ "=d" ^ Int.toString depth ^ ".v")] 631 ".v"
632 else 632 else
633 []) 633 "")
634 @ [jsPat depth inner p succ fail, 634 ^ ","),
635 str ":", 635 jsPat (depth+1) inner p succ fail,
636 fail, 636 str "):",
637 str ")"]) 637 fail,
638 str ")"]
638 639
639 val jsifyString = String.translate (fn #"\"" => "\\\"" 640 val jsifyString = String.translate (fn #"\"" => "\\\""
640 | #"\\" => "\\\\" 641 | #"\\" => "\\\\"
641 | ch => String.str ch) 642 | ch => String.str ch)
642 643