annotate src/core.sml @ 1889:c40ed80be943

Fix regression in execution of 'onError' handlers
author Adam Chlipala <adam@chlipala.net>
date Thu, 14 Nov 2013 06:16:58 -0500
parents e15234fbb163
children
rev   line source
adam@1848 1 (* Copyright (c) 2008, 2013, Adam Chlipala
adamc@16 2 * All rights reserved.
adamc@16 3 *
adamc@16 4 * Redistribution and use in source and binary forms, with or without
adamc@16 5 * modification, are permitted provided that the following conditions are met:
adamc@16 6 *
adamc@16 7 * - Redistributions of source code must retain the above copyright notice,
adamc@16 8 * this list of conditions and the following disclaimer.
adamc@16 9 * - Redistributions in binary form must reproduce the above copyright notice,
adamc@16 10 * this list of conditions and the following disclaimer in the documentation
adamc@16 11 * and/or other materials provided with the distribution.
adamc@16 12 * - The names of contributors may not be used to endorse or promote products
adamc@16 13 * derived from this software without specific prior written permission.
adamc@16 14 *
adamc@16 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
adamc@16 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
adamc@16 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
adamc@16 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
adamc@16 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
adamc@16 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
adamc@16 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
adamc@16 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
adamc@16 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
adamc@16 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
adamc@16 25 * POSSIBILITY OF SUCH DAMAGE.
adamc@16 26 *)
adamc@16 27
adamc@16 28 structure Core = struct
adamc@16 29
adamc@16 30 type 'a located = 'a ErrorMsg.located
adamc@16 31
adamc@16 32 datatype kind' =
adamc@16 33 KType
adamc@16 34 | KArrow of kind * kind
adamc@16 35 | KName
adamc@16 36 | KRecord of kind
adamc@87 37 | KUnit
adamc@214 38 | KTuple of kind list
adamc@16 39
adamc@626 40 | KRel of int
adamc@626 41 | KFun of string * kind
adamc@626 42
adamc@16 43 withtype kind = kind' located
adamc@16 44
adamc@16 45 datatype con' =
adamc@16 46 TFun of con * con
adamc@16 47 | TCFun of string * kind * con
adamc@16 48 | TRecord of con
adamc@16 49
adamc@16 50 | CRel of int
adamc@16 51 | CNamed of int
adamc@48 52 | CFfi of string * string
adamc@16 53 | CApp of con * con
adamc@16 54 | CAbs of string * kind * con
adamc@16 55
adamc@626 56 | CKAbs of string * con
adamc@626 57 | CKApp of con * kind
adamc@626 58 | TKFun of string * con
adamc@626 59
adamc@16 60 | CName of string
adamc@16 61
adamc@16 62 | CRecord of kind * (con * con) list
adamc@16 63 | CConcat of con * con
adamc@621 64 | CMap of kind * kind
adamc@16 65
adamc@87 66 | CUnit
adamc@87 67
adamc@214 68 | CTuple of con list
adamc@214 69 | CProj of con * int
adamc@214 70
adamc@16 71 withtype con = con' located
adamc@16 72
adamc@731 73 datatype datatype_kind = datatype DatatypeKind.datatype_kind
adamc@188 74
adamc@177 75 datatype patCon =
adamc@177 76 PConVar of int
adamc@192 77 | PConFfi of {mod : string, datatyp : string, params : string list,
adamc@192 78 con : string, arg : con option, kind : datatype_kind}
adamc@177 79
adamc@177 80 datatype pat' =
adamc@177 81 PWild
adamc@182 82 | PVar of string * con
adamc@177 83 | PPrim of Prim.t
adamc@192 84 | PCon of datatype_kind * patCon * con list * pat option
adamc@182 85 | PRecord of (string * pat * con) list
adamc@177 86
adamc@177 87 withtype pat = pat' located
adamc@177 88
adam@1848 89 datatype failure_mode = datatype Settings.failure_mode
adam@1848 90
adamc@16 91 datatype exp' =
adamc@16 92 EPrim of Prim.t
adamc@16 93 | ERel of int
adamc@16 94 | ENamed of int
adamc@192 95 | ECon of datatype_kind * patCon * con list * exp option
adamc@48 96 | EFfi of string * string
adam@1663 97 | EFfiApp of string * string * (exp * con) list
adamc@16 98 | EApp of exp * exp
adamc@26 99 | EAbs of string * con * con * exp
adamc@16 100 | ECApp of exp * con
adamc@16 101 | ECAbs of string * kind * exp
adamc@16 102
adamc@626 103 | EKAbs of string * exp
adamc@626 104 | EKApp of exp * kind
adamc@626 105
adamc@29 106 | ERecord of (con * exp * con) list
adamc@16 107 | EField of exp * con * { field : con, rest : con }
adamc@445 108 | EConcat of exp * con * exp * con
adamc@149 109 | ECut of exp * con * { field : con, rest : con }
adamc@493 110 | ECutMulti of exp * con * { rest : con }
adamc@16 111
adamc@182 112 | ECase of exp * (pat * exp) list * { disc : con, result : con }
adamc@177 113
adamc@102 114 | EWrite of exp
adamc@102 115
adamc@110 116 | EClosure of int * exp list
adamc@110 117
adamc@450 118 | ELet of string * con * exp * exp
adamc@450 119
adam@1848 120 | EServerCall of int * exp list * con * failure_mode
adamc@607 121
adamc@16 122 withtype exp = exp' located
adamc@16 123
adamc@731 124 datatype effect = datatype Export.effect
adamc@731 125 datatype export_kind = datatype Export.export_kind
adamc@144 126
adamc@16 127 datatype decl' =
adamc@16 128 DCon of string * int * kind * con
adamc@807 129 | DDatatype of (string * int * string list * (string * int * con option) list) list
adamc@109 130 | DVal of string * int * con * exp * string
adamc@125 131 | DValRec of (string * int * con * exp * string) list
adamc@1104 132 | DExport of export_kind * int * bool
adamc@707 133 | DTable of string * int * con * string * exp * con * exp * con
adamc@338 134 | DSequence of string * int * string
adamc@754 135 | DView of string * int * string * exp * con
adamc@271 136 | DDatabase of string
adamc@461 137 | DCookie of string * int * con * string
adamc@720 138 | DStyle of string * int * string
adamc@1075 139 | DTask of exp * exp
adamc@1199 140 | DPolicy of exp
adam@1294 141 | DOnError of int
adamc@16 142
adamc@16 143 withtype decl = decl' located
adamc@16 144
adamc@16 145 type file = decl list
adamc@16 146
adamc@16 147 end