`(,(concat
"\\_<"
(regexp-opt '("let" "in" "begin" "end" "with" "where" "extern" "type"
- "val" "context" "Root")
+ "val" "context" "Root" "if" "then" "else")
t)
"\\_>")
extern val userSource : emailUser -> aliasSource;
{{The part appear before the "@" in your desired source address}}
extern val defaultSource : aliasSource;
-{{Matches any mail to this domain that doesn't match any other rule, with the
- exception of systemwide usernames like UNIX users.}}
-extern val catchAllSource : aliasSource;
-{{Matches any mail to this domain that doesn't match any other rule, even
- for systemwide usernames.}}
+{{Matches any mail to this domain that doesn't match any other rule.}}
extern type aliasTarget;
{{A place to redirect messages}}
{{Silently delete mail to the user at the current domain.}}
val defaultAlias = \email -> aliasPrim defaultSource (addressTarget email);
-{{When a message to the current domain doesn't match any other alias and isn't a
- UNIX username, send it to this e-mail address.}}
-val catchAllAlias = \email -> aliasPrim catchAllSource (addressTarget email);
-{{When a message to the current domain doesn't match any other alias, send it to
+{{When a message to the current domain doesn't match any other rule, send it to
this e-mail address.}}
end
end;
-val addCatchAllAlias = begin
+val addDefaultAlias = begin
mailbox <- Mailbox;
- catchAllAlias mailbox
+ defaultAlias mailbox
end;
val addWww = begin
end
end;
-val domNoWwwNoDefaultAlias =
+val dom =
\ d : (your_domain) ->
\\ config : Domain ->
domain d with
handleMail;
dns (dnsMX 1 "deleuze.hcoop.net");
- config
- end;
-
-val domNoDefaultAlias =
- \ d : (your_domain) ->
- \\ config : Domain ->
- domNoWwwNoDefaultAlias d with
- addWww;
- config
- end;
+ createWWW : bool <- CreateWWW;
+ if createWWW then
+ addWww
+ else
+ Skip
+ end;
-val domNoWww =
- \ d : (your_domain) ->
- \\ config : Domain ->
- domNoWwwNoDefaultAlias d with
- config;
- addCatchAllAlias;
- end;
+ defAl : bool <- DefaultAlias;
+ if defAl then
+ addDefaultAlias
+ else
+ Skip
+ end;
-val dom =
- \ d : (your_domain) ->
- \\ config : Domain ->
- domNoDefaultAlias d with
- config;
- addCatchAllAlias;
+ config
end;
val nameserver = \host -> dns (dnsNS host);
| LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE
| EQ | COMMA | BSLASH | BSLASHBSLASH | SEMI | LET | IN | BEGIN | END
| IF | THEN | ELSE
- | ROOT
+ | ROOT | SKIP
| EXTERN | TYPE | VAL | WITH | WHERE | CONTEXT
%nonterm
%name Domtool
+%nonassoc THEN ELSE
%right SEMI
%nonassoc COLON
%nonassoc IN
| exp SEMI (exp)
| SYMBOL LARROW CSYMBOL SEMI exp (EGet (SYMBOL, NONE, CSYMBOL, exp), (SYMBOLleft, expright))
| SYMBOL COLON typ LARROW CSYMBOL SEMI exp (EGet (SYMBOL, SOME typ, CSYMBOL, exp), (SYMBOLleft, expright))
- | IF exp THEN exp ELSE exp (EIf (exp1, exp2, exp3), (IFleft, exp3right))
+ | IF exp THEN exp ELSE exp END (EIf (exp1, exp2, exp3), (IFleft, ENDright))
apps : term (term)
| apps term (EApp (apps, term), (appsleft, termright))
| LBRACK elist RBRACK (EList elist, (LBRACKleft, RBRACKright))
| LET exp IN exp END (ELocal (exp1, exp2), (LETleft, ENDright))
| SYMBOL (EVar SYMBOL, (SYMBOLleft, SYMBOLright))
+ | SKIP (ESkip, (SKIPleft, SKIPright))
sets : CSYMBOL EQ apps SEMIopt ([(ESet (CSYMBOL, apps), (CSYMBOLleft, appsright))])
| CSYMBOL EQ apps SEMI sets ((ESet (CSYMBOL, apps), (CSYMBOLleft, appsright))
<INITIAL> "if" => (Tokens.IF (yypos, yypos + size yytext));
<INITIAL> "then" => (Tokens.THEN (yypos, yypos + size yytext));
<INITIAL> "else" => (Tokens.ELSE (yypos, yypos + size yytext));
+<INITIAL> "Skip" => (Tokens.SKIP (yypos, yypos + size yytext));
<INITIAL> "extern" => (Tokens.EXTERN (yypos, yypos + size yytext));
<INITIAL> "type" => (Tokens.TYPE (yypos, yypos + size yytext));
case e of
ESkip => SM.empty
| ESet (ev, e) => SM.insert (SM.empty, ev, e)
- | EGet (x, _, ev, e) => exec' evs (Reduce.subst x (lookup (evs, ev)) e)
+ | EGet (x, _, ev, e) =>
+ let
+ val e' = Reduce.subst x (lookup (evs, ev)) e
+ in
+ exec' evs (Reduce.reduceExp Env.empty e')
+ end
| ESeq es =>
let
val (new, _) =
StringMap.empty), dl),
(fn () => (ESkip, dl)))
+val _ = Defaults.registerDefault ("CreateWWW",
+ (TBase "bool", dl),
+ (fn () => (EVar "true", dl)))
+
+val _ = Defaults.registerDefault ("DefaultAlias",
+ (TBase "bool", dl),
+ (fn () => (EVar "true", dl)))
+
end
| EWith (e1, e2) => dBox [p_exp e1, space 1, keyword "with", p_exp e2, space 1, keyword "end"]
| EIf (e1, e2, e3) => dBox [keyword "if", space 1, p_exp e1,
space 1, keyword "then", space 1, p_exp e2,
- space 1, keyword "else", space 1, p_exp e2]
+ space 1, keyword "else", space 1, p_exp e3]
and p_exp e = p_exp' false e
fun p_decl d =
| EIf (e1, e2, e3) =>
let
- val t = (newUnif (), loc)
-
val t1 = checkExp G e1
val t2 = checkExp G e2
val t3 = checkExp G e3
in
(subTyp (t1, bool))
handle Unify ue =>
- dte (WrongType ("\"If\" test",
+ dte (WrongType ("\"if\" test",
e1,
t1,
bool,
SOME ue));
- subTyp (t2, t);
- (subTyp (t3, t))
- handle Unify ue =>
- dte (WrongType ("\"Else\" case",
- eAll,
- t3,
- t2,
- SOME ue));
- t
+ (subTyp (t2, t3); t3)
+ handle Unify _ =>
+ ((subTyp (t3, t2); t2)
+ handle Unify ue =>
+ (dte (WrongType ("\"else\" case",
+ eAll,
+ t3,
+ t2,
+ SOME ue));
+ (TError, loc)))
end
end