Skip to content

Commit 3707f1f

Browse files
committed
update to zap 0.10.0
1 parent 311fdc1 commit 3707f1f

File tree

4 files changed

+76
-23
lines changed

4 files changed

+76
-23
lines changed

zap/index.html

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
56
<title>Zig Documentation</title>
67
<link rel="icon" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNTMgMTQwIj48ZyBmaWxsPSIjRjdBNDFEIj48Zz48cG9seWdvbiBwb2ludHM9IjQ2LDIyIDI4LDQ0IDE5LDMwIi8+PHBvbHlnb24gcG9pbnRzPSI0NiwyMiAzMywzMyAyOCw0NCAyMiw0NCAyMiw5NSAzMSw5NSAyMCwxMDAgMTIsMTE3IDAsMTE3IDAsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMzEsOTUgMTIsMTE3IDQsMTA2Ii8+PC9nPjxnPjxwb2x5Z29uIHBvaW50cz0iNTYsMjIgNjIsMzYgMzcsNDQiLz48cG9seWdvbiBwb2ludHM9IjU2LDIyIDExMSwyMiAxMTEsNDQgMzcsNDQgNTYsMzIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTE2LDk1IDk3LDExNyA5MCwxMDQiLz48cG9seWdvbiBwb2ludHM9IjExNiw5NSAxMDAsMTA0IDk3LDExNyA0MiwxMTcgNDIsOTUiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTUwLDAgNTIsMTE3IDMsMTQwIDEwMSwyMiIvPjwvZz48Zz48cG9seWdvbiBwb2ludHM9IjE0MSwyMiAxNDAsNDAgMTIyLDQ1Ii8+PHBvbHlnb24gcG9pbnRzPSIxNTMsMjIgMTUzLDExNyAxMDYsMTE3IDEyMCwxMDUgMTI1LDk1IDEzMSw5NSAxMzEsNDUgMTIyLDQ1IDEzMiwzNiAxNDEsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTI1LDk1IDEzMCwxMTAgMTA2LDExNyIvPjwvZz48L2c+PC9zdmc+">
78
<style type="text/css">
9+
*, *::before, *::after {
10+
box-sizing: border-box;
11+
}
812
body {
913
font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
1014
color: #000000;
@@ -26,6 +30,9 @@
2630
margin: 0;
2731
overflow-x: auto;
2832
}
33+
:not(pre) > code {
34+
white-space: break-spaces;
35+
}
2936
code {
3037
font-family:"Source Code Pro",monospace;
3138
font-size: 0.9em;
@@ -153,6 +160,23 @@
153160
cursor: default;
154161
}
155162

163+
#errors {
164+
background-color: #faa;
165+
position: fixed;
166+
left: 0;
167+
bottom: 0;
168+
width: 100%;
169+
max-height: min(20em, 50vh);
170+
padding: 0.5em;
171+
overflow: auto;
172+
}
173+
#errors h1 {
174+
font-size: 1.5em;
175+
}
176+
#errors pre {
177+
background-color: #fcc;
178+
}
179+
156180
#listSearchResults li.selected {
157181
background-color: #93e196;
158182
}
@@ -167,7 +191,8 @@
167191
margin-top: 0.5em;
168192
}
169193

170-
td {
194+
td, th {
195+
text-align: unset;
171196
vertical-align: top;
172197
margin: 0;
173198
padding: 0.5em;
@@ -247,6 +272,14 @@
247272
#listSearchResults li.selected a {
248273
color: #fff;
249274
}
275+
#errors {
276+
background-color: #800;
277+
color: #fff;
278+
}
279+
#errors pre {
280+
background-color: #a00;
281+
color: #fff;
282+
}
250283
dl > div {
251284
border-color: #373737;
252285
}
@@ -409,6 +442,10 @@ <h1>Keyboard Shortcuts</h1>
409442
<dl><dt><kbd></kbd></dt><dd>Move down in search results</dd></dl>
410443
<dl><dt><kbd></kbd></dt><dd>Go to active search result</dd></dl>
411444
</div>
445+
<div id="errors" class="hidden">
446+
<h1>Errors</h1>
447+
<pre id="errorsText"></pre>
448+
</div>
412449
<script src="main.js"></script>
413450
</body>
414451
</html>

zap/main.js

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
(function() {
22
const CAT_namespace = 0;
3-
const CAT_global_variable = 1;
4-
const CAT_function = 2;
5-
const CAT_primitive = 3;
6-
const CAT_error_set = 4;
7-
const CAT_global_const = 5;
8-
const CAT_alias = 6;
9-
const CAT_type = 7;
10-
const CAT_type_type = 8;
11-
const CAT_type_function = 9;
3+
const CAT_container = 1;
4+
const CAT_global_variable = 2;
5+
const CAT_function = 3;
6+
const CAT_primitive = 4;
7+
const CAT_error_set = 5;
8+
const CAT_global_const = 6;
9+
const CAT_alias = 7;
10+
const CAT_type = 8;
11+
const CAT_type_type = 9;
12+
const CAT_type_function = 10;
13+
14+
const LOG_err = 0;
15+
const LOG_warn = 1;
16+
const LOG_info = 2;
17+
const LOG_debug = 3;
1218

1319
const domDocTestsCode = document.getElementById("docTestsCode");
1420
const domFnErrorsAnyError = document.getElementById("fnErrorsAnyError");
@@ -47,6 +53,8 @@
4753
const domStatus = document.getElementById("status");
4854
const domTableFnErrors = document.getElementById("tableFnErrors");
4955
const domTldDocs = document.getElementById("tldDocs");
56+
const domErrors = document.getElementById("errors");
57+
const domErrorsText = document.getElementById("errorsText");
5058

5159
var searchTimer = null;
5260

@@ -83,13 +91,24 @@
8391

8492
WebAssembly.instantiateStreaming(wasm_promise, {
8593
js: {
86-
log: function(ptr, len) {
94+
log: function(level, ptr, len) {
8795
const msg = decodeString(ptr, len);
88-
console.log(msg);
89-
},
90-
panic: function (ptr, len) {
91-
const msg = decodeString(ptr, len);
92-
throw new Error("panic: " + msg);
96+
switch (level) {
97+
case LOG_err:
98+
console.error(msg);
99+
domErrorsText.textContent += msg + "\n";
100+
domErrors.classList.remove("hidden");
101+
break;
102+
case LOG_warn:
103+
console.warn(msg);
104+
break;
105+
case LOG_info:
106+
console.info(msg);
107+
break;
108+
case LOG_debug:
109+
console.debug(msg);
110+
break;
111+
}
93112
},
94113
},
95114
}).then(function(obj) {
@@ -184,6 +203,7 @@
184203
const category = wasm_exports.categorize_decl(decl_index, 0);
185204
switch (category) {
186205
case CAT_namespace:
206+
case CAT_container:
187207
return renderNamespacePage(decl_index);
188208
case CAT_global_variable:
189209
case CAT_primitive:
@@ -426,16 +446,12 @@
426446
while (true) {
427447
const member_category = wasm_exports.categorize_decl(member, 0);
428448
switch (member_category) {
429-
case CAT_namespace:
430-
if (wasm_exports.decl_field_count(member) > 0) {
431-
typesList.push({original: original, member: member});
432-
} else {
433-
namespacesList.push({original: original, member: member});
434-
}
435-
continue member_loop;
436449
case CAT_namespace:
437450
namespacesList.push({original: original, member: member});
438451
continue member_loop;
452+
case CAT_container:
453+
typesList.push({original: original, member: member});
454+
continue member_loop;
439455
case CAT_global_variable:
440456
varsList.push(member);
441457
continue member_loop;

zap/main.wasm

2.03 KB
Binary file not shown.

zap/sources.tar

1.64 MB
Binary file not shown.

0 commit comments

Comments
 (0)