diff src/compiler.sml @ 1752:675ce534e3ec

New optional suffice for 'rewrite' in .urp files: [-]
author Adam Chlipala <adam@chlipala.net>
date Sun, 06 May 2012 15:27:30 -0400
parents 1e940643a5f0
children b5f5e8d439c7
line wrap: on
line diff
--- a/src/compiler.sml	Sun May 06 15:15:46 2012 -0400
+++ b/src/compiler.sml	Sun May 06 15:27:30 2012 -0400
@@ -426,7 +426,8 @@
                        jsFuncs = [],
                        rewrites = [{pkind = Settings.Any,
                                     kind = Settings.Prefix,
-                                    from = capitalize (OS.Path.file fname) ^ "/", to = ""}],
+                                    from = capitalize (OS.Path.file fname) ^ "/", to = "",
+                                    hyphenate = false}],
                        filterUrl = [],
                        filterMime = [],
                        filterRequest = [],
@@ -774,17 +775,19 @@
                                   | "jsFunc" => jsFuncs := ffiM () :: !jsFuncs
                                   | "rewrite" =>
                                     let
-                                        fun doit (pkind, from, to) =
+                                        fun doit (pkind, from, to, hyph) =
                                             let
                                                 val pkind = parsePkind pkind
                                                 val (kind, from) = parseFrom from
                                             in
-                                                rewrites := {pkind = pkind, kind = kind, from = from, to = to} :: !rewrites
+                                                rewrites := {pkind = pkind, kind = kind, from = from, to = to, hyphenate = hyph} :: !rewrites
                                             end
                                     in
                                         case String.tokens Char.isSpace arg of
-                                            [pkind, from, to] => doit (pkind, from, to)
-                                          | [pkind, from] => doit (pkind, from, "")
+                                            [pkind, from, to, "[-]"] => doit (pkind, from, to, true)
+                                          | [pkind, from, "[-]"] => doit (pkind, from, "", true)
+                                          | [pkind, from, to] => doit (pkind, from, to, false)
+                                          | [pkind, from] => doit (pkind, from, "", false)
                                           | _ => ErrorMsg.error "Bad 'rewrite' syntax"
                                     end
                                   | "allow" =>