-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjj_js.js
More file actions
32 lines (30 loc) · 760 Bytes
/
objj_js.js
File metadata and controls
32 lines (30 loc) · 760 Bytes
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
function objj_compiler(str, path, bundle, callback)
{
this._lexer = new Worker('objj_js_lexer.js');
this._parser = new Worker('objj_js_parser.js');
var parser = this._parser;
this._executable = null;
this._code = str;
this._dependencies = [];
var dependencies = this._dependencies;
this._bundle = bundle;
this._path = path;
this._lexer.onmessage = function(message)
{
parser.postMessage(message.data);
}
this._parser.onmessage = function(message)
{
callback(new Executable(message.data, dependencies));
}
}
objj_compiler.prototype.parse = function()
{
this._start = new Date();
this._startLexing = this._start;
this._lexer.postMessage(this._code);
}
function preprocess(str, path, bundle, callback)
{
new objj_compiler(str, path, bundle, callback).parse();
}