-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepl.html
216 lines (202 loc) · 8.88 KB
/
repl.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="Jsreeram.github.com : jsreeram.github.com" />
<link rel="stylesheet" type="text/css" media="screen"
href="stylesheets/replstyle.css">
<title>River Trail REPL</title>
<style>
#container {
width: 90%;
margin: 0 auto;
}
.jqconsole-header {
font-weight: normal;
color: #ff5333;
width:400px;
font-size:12px;
}
/* The console container element */
#console {
position:absolute;
left:50%;
width: 40%;
height:800px;
background-color:#111111;
padding-left:0px;
margin-left:0px;
border:0px;
overflow-x:hidden;
}
/* The inner console element. */
.jqconsole {
padding: 10px;
overflow-x:hidden;
}
/* The cursor. */
.jqconsole-cursor {
background-color: gray;
}
/* The cursor color when the console looses focus. */
.jqconsole-blurred .jqconsole-cursor {
background-color: #444;
}
/* The current prompt text color */
.jqconsole-prompt {
color: #0d0;
}
/* The command history */
.jqconsole-old-prompt {
color: #0b0;
font-weight: normal;
}
/* The text color when in input mode. */
.jqconsole-input {
color: #dd0;
}
/* Previously entered input. */
.jqconsole-old-input {
color: #bb0;
font-weight: normal;
}
/* The text color of the output. */
.jqconsole-output {
font-weight:bold;
color: #eee;
}
.jqconsole-error-output {
color: red;
}
.jqconsole-info-output {
color: #0d0;
}
</style>
<script type="text/javascript" src="jslib/ParallelArray.js"></script>
<script type="text/javascript" src="jslib/jit/narcissus/jsdefs.js"></script>
<script type="text/javascript" src="jslib/jit/narcissus/jslex.js"></script>
<script type="text/javascript" src="jslib/jit/narcissus/jsparse.js"></script>
<script type="text/javascript" src="jslib/jit/narcissus/jsdecomp.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/definitions.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/helper.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/driver.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/dotviz.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/typeinference.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/rangeanalysis.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/inferblockflow.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/infermem.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/genOCL.js"></script>
<script type="text/javascript" src="jslib/jit/compiler/runOCL.js"></script>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<a id="forkme_banner" href="https://github.com/rivertrail/rivertrail">View on GitHub</a>
<h1 id="project_title">River Trail REPL</h1>
<h2 id="project_tagline">jsreeram.github.com</h2>
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<div id="container">
<div id="editor" style="height: 800px; width: 45%;
float:left"><pre>
var pa = new ParallelArray([1, 2, 3, 4]);
var pa_new = pa.combine(function (i) {
return Math.sqrt(this.get(i));
});</pre></div>
<script src="javascripts/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
//editor.setFontSize(14);
editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/javascript");
editor.setShowPrintMargin(false);
</script>
<img src="images/gray-play.svg" id="run" height="40"
style="position:absolute;left:46%;top:40%;z-index:10"
onclick="jqconsole.Focus();console_run(null,true);return false;"/>
<div id="console"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/jqconsole-2.7.min.js" type="text/javascript" charset="utf-8"></script>
<script>
var header_message =
(window.navigator.userAgent).substring(0,70) + '...\n';
try {
if (RiverTrail.compiler === undefined) {
header_message += 'River Trail not found. Enabling sequential mode...';
var PAT = ParallelArray.prototype;
PAT.combine = PAT.combineSeq;
PAT.map = PAT.mapSeq;
delete PAT.combineSeq;
delete PAT.mapSeq;
delete PAT;
} else {
header_message += 'River Trail Extension loaded. Enabling compiled mode...';
}
} catch (e) {
header_message += 'RiverTrail not found. Enabling sequential mode...';
}
var console_run = function(oinput, fromace) {
var input = oinput;
if(fromace !== undefined) {
input = editor.session.getValue();
}
var output_class = 'jqconsole-output';
if(!(input)) {
jqconsole.Write('\n');
startPrompt();
return;
}
var output = undefined;
var output_string = "";
// Output input with the class jqconsole-output.
input_env += input + ";";
try {
output = eval.call(null, input);
if(output === undefined) {
output_string = "undefined";
}
else {
output_string = output.toString();
}
} catch (e) {
output_string = e.name + " : " + e.message;
console.log(e);
output_class = 'jqconsole-error-output';
}
if(fromace === undefined) {
jqconsole.Write(output_string + '\n\n', output_class);
startPrompt();
}
else {
jqconsole.Write('(Script Loaded)\n\n', 'jqconsole-info-output');
jqconsole.Write(output_string + '\n\n', output_class);
startPrompt();
}
//jqconsole.Write('\n');
/*
if(output !== undefined) {
jqconsole.Write(output_string + '\n\n', 'jqconsole-output');
}
else {
jqconsole.Write(output_string + '\n\n', 'jqconsole-error-output');
}
*/
// Restart the prompt.
}
var input_env = "";
var jqconsole = $('#console').jqconsole(header_message+'\n'+'\n', '>>> ');
var startPrompt = function () {
// Start the prompt with history enabled.
jqconsole.Prompt(true, console_run);
};
startPrompt();
</script>
</div>
</div>
</div>
</body>
</html>