comparison 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
comparison
equal deleted inserted replaced
1751:acadf9d1214a 1752:675ce534e3ec
424 clientOnly = [], 424 clientOnly = [],
425 serverOnly = [], 425 serverOnly = [],
426 jsFuncs = [], 426 jsFuncs = [],
427 rewrites = [{pkind = Settings.Any, 427 rewrites = [{pkind = Settings.Any,
428 kind = Settings.Prefix, 428 kind = Settings.Prefix,
429 from = capitalize (OS.Path.file fname) ^ "/", to = ""}], 429 from = capitalize (OS.Path.file fname) ^ "/", to = "",
430 hyphenate = false}],
430 filterUrl = [], 431 filterUrl = [],
431 filterMime = [], 432 filterMime = [],
432 filterRequest = [], 433 filterRequest = [],
433 filterResponse = [], 434 filterResponse = [],
434 protocol = NONE, 435 protocol = NONE,
772 | "clientOnly" => clientOnly := ffiS () :: !clientOnly 773 | "clientOnly" => clientOnly := ffiS () :: !clientOnly
773 | "serverOnly" => serverOnly := ffiS () :: !serverOnly 774 | "serverOnly" => serverOnly := ffiS () :: !serverOnly
774 | "jsFunc" => jsFuncs := ffiM () :: !jsFuncs 775 | "jsFunc" => jsFuncs := ffiM () :: !jsFuncs
775 | "rewrite" => 776 | "rewrite" =>
776 let 777 let
777 fun doit (pkind, from, to) = 778 fun doit (pkind, from, to, hyph) =
778 let 779 let
779 val pkind = parsePkind pkind 780 val pkind = parsePkind pkind
780 val (kind, from) = parseFrom from 781 val (kind, from) = parseFrom from
781 in 782 in
782 rewrites := {pkind = pkind, kind = kind, from = from, to = to} :: !rewrites 783 rewrites := {pkind = pkind, kind = kind, from = from, to = to, hyphenate = hyph} :: !rewrites
783 end 784 end
784 in 785 in
785 case String.tokens Char.isSpace arg of 786 case String.tokens Char.isSpace arg of
786 [pkind, from, to] => doit (pkind, from, to) 787 [pkind, from, to, "[-]"] => doit (pkind, from, to, true)
787 | [pkind, from] => doit (pkind, from, "") 788 | [pkind, from, "[-]"] => doit (pkind, from, "", true)
789 | [pkind, from, to] => doit (pkind, from, to, false)
790 | [pkind, from] => doit (pkind, from, "", false)
788 | _ => ErrorMsg.error "Bad 'rewrite' syntax" 791 | _ => ErrorMsg.error "Bad 'rewrite' syntax"
789 end 792 end
790 | "allow" => 793 | "allow" =>
791 (case String.tokens Char.isSpace arg of 794 (case String.tokens Char.isSpace arg of
792 [fkind, pattern] => 795 [fkind, pattern] =>