-
Notifications
You must be signed in to change notification settings - Fork 2
/
tile3.html
114 lines (101 loc) · 2.92 KB
/
tile3.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>TurtleScript tile test (mk II)</title>
<style type="text/css">
/* default text styles/colors */
.ts {
font-size: 14px;
font-family: Helvetica, Arial, Sans-Serif;
color: black;
white-space: normal;
}
/* Don't style any lists as lists. */
.ts ul {
list-style-type: none; margin: 0; padding: 0;
}
/* Don't show text-selection cursor */
.ts, .ts li, .ts span { cursor: default; }
/* don't wrap lines */
.ts li { white-space: nowrap; overflow: hidden; }
.ts li { min-width: -moz-min-content; }
/* ----- basic structure ----- */
.ts div.e {
display: block;
}
.ts div.e > span {
display: inline-block;
position: relative;
}
.ts div.e > span > span {
display: inline-table;
}
.ts div.e > span > span > span {
display: table-cell;
}
.ts div.stmt {
display: block;
}
.ts div.stmt > span {
display: inline-block;
}
/* ----- fake shapes ----- */
.ts div.stmt > span { border: 2px solid green; }
.ts .expr:before,
.ts .exprleft:before { content: "<"; }
.ts .expr:after,
.ts .exprright:after { content: ">"; }
.ts .binop:before { content: ">"; }
.ts .binop:after { content: "<"; }
.ts .exprstart:after { content: "<"; }
.ts .exprend:before { content: ">"; }
/* strange code to do expression continuations */
.ts .e .connect {
position: absolute; bottom: -5px; left: 0; height: 5px; width: 100%;
}
.ts .efirst + * { margin-top: 5px; }
/* object nesting */
.ts .newobj { border: 2px solid blue; }
.ts .enest.objnest > span { border-left: 10px solid blue; }
.ts .e .connect.objconn { background: blue; }
/* function nesting */
.ts .func { border: 2px solid red; }
.ts .enest.funcnest > span { border-left: 10px solid red; }
.ts .e .connect.funcconn { background: red; }
/* code pretty-printing */
.tsx ul.indent { margin-left: 2em; /* 2 space tabs */ }
.tsx .comment { color: #a00; text-style: italic; }
.tsx .keyword { color: #0a0; }
.tsx .var { color: #bb0; }
.tsx .literal { }
.ts .lit { color: blue; }
.ts .semi { color: #888; }
.ts .binop { color: #bb0; }
.ts .id { color: #0a0; }
div.ts { margin-bottom: 1em; }
</style>
</head>
<body>
<h1>TurtleScript tile test 3</h1>
<SCRIPT src="./global.js"></SCRIPT>
<SCRIPT src="./extensions.js"></SCRIPT>
<SCRIPT src="./tokenize.js"></SCRIPT>
<SCRIPT src="./parse.js"></SCRIPT>
<SCRIPT src="./json2.js"></SCRIPT>
<SCRIPT src="./jcompile.js"></SCRIPT>
<SCRIPT src="./render2.js"></SCRIPT>
<pre class="ts">
<SCRIPT>
parse = make_parse(tokenize);
source = "var original_symbol = { nud: function () { this.error('Undefined.'); }, led: function (left) { this.error('Missing operator.'); } };";
//source = "var sym = { a: 1, b: 2 }.supercalifragilisticexp;";
//source = "var sym = function(a) { return a; };";
tree = parse(source);
render = make_render(html_escape);
document.write(render(tree));
</SCRIPT>
</pre>
<hr>
<!-- hhmts start -->Last modified: Thu May 19 19:01:08 EDT 2011 <!-- hhmts end -->
</body> </html>