-
Notifications
You must be signed in to change notification settings - Fork 1
/
read.js
45 lines (43 loc) · 1013 Bytes
/
read.js
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
var result;
var codes = {
javascript: {
a: ['say','ask'],
b: [function(params) {alert(params[1]);},function(params) {result=prompt(params[1],params[2]);}]
}
};
function splitsplit(t,c,n,nnnn) {
var rtrnlst = [""];
var nn = 0;
var nnnnn = 0;
for(var i=0; i<t.length; i++) {
if (t[i+nn]===n && nnnnn===0) {
nn++;
nnnnn++;
}
if (t[i+nn]===nnnn && nnnnn===1) {
nn++;
nnnnn--;
}
if (i+nn<t.length) {
if (t[i+nn]===c && nnnnn===0) {
rtrnlst.push("");
} else {
rtrnlst[rtrnlst.length-1] += t[i+nn];
}}
}
return rtrnlst;
}
var js = codes.javascript.a;
function readFunction(code) {
var parameters = [];
parameters = splitsplit(code,"/","(",")");
for(var aa=0; aa<parameters.length; aa++) {
if (parameters[aa].search("/")!==-1) {
readFunction(parameters[aa]);
parameters[aa] = result;
}
}
if (js.indexOf(parameters[0])!==-1) {
codes.javascript.b[codes.javascript.a.indexOf(parameters[0])](parameters);
}
}