about summary refs log tree commit diff stats
path: root/archive/0.vm.arc/charterm/planet-docs/doc/racket.css
blob: 021e4da57783f493018ea952ad1c8c2265e495d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/* See the beginning of "scribble.css". */

/* Monospace: */
.RktIn, .RktRdr, .RktPn, .RktMeta,
.RktMod, .RktKw, .RktVar, .RktSym,
.RktRes, .RktOut, .RktCmt, .RktVal,
.RktBlk {
  font-family: monospace;
  white-space: inherit;
}

/* Serif: */
.inheritedlbl {
  font-family: serif;
}

/* Sans-serif: */
.RBackgroundLabelInner {
  font-family: sans-serif;
}

/* ---------------------------------------- */
/* Inherited methods, left margin */

.inherited {
  width: 100%;
  margin-top: 0.5em;
  text-align: left;
  background-color: #ECF5F5;
}

.inherited td {
  font-size: 82%;
  padding-left: 1em;
  text-indent: -0.8em;
  padding-right: 0.2em;
}

.inheritedlbl {
  font-style: italic;
}

/* ---------------------------------------- */
/* Racket text styles */

.RktIn {
  color: #cc6633;
  background-color: #eeeeee;
}

.RktInBG {
  background-color: #eeeeee;
}

.RktRdr {
}

.RktPn {
  color: #843c24;
}

.RktMeta {
  color: black;
}

.RktMod {
  color: black;
}

.RktOpt {
  color: black;
}

.RktKw {
  color: black;
  /* font-weight: bold; */
}

.RktErr {
  color: red;
  font-style: italic;
}

.RktVar {
  color: #262680;
  font-style: italic;
}

.RktSym {
  color: #262680;
}

.RktValLink {
  text-decoration: none;
  color: blue;
}

.RktModLink {
  text-decoration: none;
  color: blue;
}

.RktStxLink {
  text-decoration: none;
  color: black;
  /* font-weight: bold; */
}

.RktRes {
  color: #0000af;
}

.RktOut {
  color: #960096;
}

.RktCmt {
  color: #c2741f;
}

.RktVal {
  color: #228b22;
}

/* ---------------------------------------- */
/* Some inline styles */

.together {
  width: 100%;
}

.prototype, .argcontract, .RBoxed {
  white-space: nowrap;
}

.prototype td {
  vertical-align: text-top;
}
.longprototype td {
  vertical-align: bottom;
}

.RktBlk {
  white-space: inherit;
  text-align: left;
}

.RktBlk tr {
  white-space: inherit;
}

.RktBlk td {
  vertical-align: baseline;
  white-space: inherit;
}

.argcontract td {
  vertical-align: text-top;
}

.highlighted {
  background-color: #ddddff;
}

.defmodule {
  width: 100%;
  background-color: #F5F5DC;
}

.specgrammar {
  float: right;
}

.RBibliography td {
  vertical-align: text-top;
}

.leftindent {
 margin-left: 1em;
 margin-right: 0em;
}

.insetpara {
 margin-left: 1em;
 margin-right: 1em;
}

.Rfilebox {
}

.Rfiletitle {
  text-align: right;
  margin: 0em 0em 0em 0em;
}

.Rfilename {
  border-top: 1px solid #6C8585;
  border-right: 1px solid #6C8585;
  padding-left: 0.5em;
  padding-right: 0.5em;
  background-color: #ECF5F5;
}

.Rfilecontent {
  margin: 0em 0em 0em 0em;
}

/* ---------------------------------------- */
/* For background labels */

.RBackgroundLabel {
   float: right;
   width: 0px;
   height: 0px;
}

.RBackgroundLabelInner {
   position: relative;
   width: 25em;
   left: -25.5em;
   top: 0px;
   text-align: right;
   color: white;
   z-index: 0;
   font-weight: bold;
}

.RForeground {
   position: relative;
   left: 0px;
   top: 0px;
   z-index: 1;
}
s="o"><< "'\n" << end(); continue; } reagent/*copy*/ product = inst.products.at(0); // Update product While Type-checking Merge const type_tree* product_base_type = product.type->atom ? product.type : product.type->left; assert(product_base_type->atom); if (product_base_type->value == 0 || !contains_key(Type, product_base_type->value)) { raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); continue; } const type_info& info = get(Type, product_base_type->value); if (info.kind != CONTAINER && info.kind != EXCLUSIVE_CONTAINER) { raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end(); continue; } check_merge_call(inst.ingredients, product, caller, inst); } } void check_merge_call(const vector<reagent>& ingredients, const reagent& product, const recipe& caller, const instruction& inst) { int ingredient_index = 0; merge_check_state state; state.data.push(merge_check_point(product, 0)); while (true) { assert(!state.data.empty()); trace(102, "transform") << ingredient_index << " vs " << SIZE(ingredients) << end(); if (ingredient_index >= SIZE(ingredients)) { raise << maybe(caller.name) << "too few ingredients in '" << to_original_string(inst) << "'\n" << end(); return; } reagent& container = state.data.top().container; if (!container.type) return; // error handled elsewhere const type_tree* top_root_type = container.type->atom ? container.type : container.type->left; assert(top_root_type->atom); type_info& container_info = get(Type, top_root_type->value); switch (container_info.kind) { case CONTAINER: { // degenerate case: merge with the same type always succeeds if (state.data.top().container_element_index == 0 && types_coercible(container, inst.ingredients.at(ingredient_index))) return; const reagent& expected_ingredient = element_type(container.type, state.data.top().container_element_index); trace(102, "transform") << "checking container " << to_string(container) << " || " << to_string(expected_ingredient) << " vs ingredient " << ingredient_index << end(); // if the current element is the ingredient we expect, move on to the next element/ingredient if (types_coercible(expected_ingredient, ingredients.at(ingredient_index))) { ++ingredient_index; ++state.data.top().container_element_index; while (state.data.top().container_element_index >= SIZE(get(Type, get_base_type(state.data.top().container.type)->value).elements)) { state.data.pop(); if (state.data.empty()) { if (ingredient_index < SIZE(ingredients)) raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); return; } ++state.data.top().container_element_index; } } // if not, maybe it's a field of the current element else { // no change to ingredient_index state.data.push(merge_check_point(expected_ingredient, 0)); } break; } // End check_merge_call Special-cases default: { if (!types_coercible(container, ingredients.at(ingredient_index))) { raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << to_original_string(inst) << "'\n" << end(); raise << " (expected '" << debug_string(container) << "')\n" << end(); raise << " (got '" << debug_string(ingredients.at(ingredient_index)) << "')\n" << end(); return; } ++ingredient_index; // ++state.data.top().container_element_index; // unnecessary, but wouldn't do any harm do { state.data.pop(); if (state.data.empty()) { if (ingredient_index < SIZE(ingredients)) raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end(); return; } ++state.data.top().container_element_index; } while (state.data.top().container_element_index >= SIZE(get(Type, get_base_type(state.data.top().container.type)->value).elements)); } } } // never gets here assert(false); } //: replaced in a later layer //: todo: find some clean way to take this call completely out of this layer const type_tree* get_base_type(const type_tree* t) { return t; } void test_merge_check_product() { Hide_errors = true; run( "def main [\n" " 1:num <- merge 3\n" "]\n" ); CHECK_TRACE_CONTENTS( "error: main: 'merge' should yield a container in '1:num <- merge 3'\n" ); } :(before "End Includes") #include <stack> using std::stack;