-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathScript.js
More file actions
31 lines (24 loc) · 720 Bytes
/
Script.js
File metadata and controls
31 lines (24 loc) · 720 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
const Token = require( "./Token" ).Token;
exports.Script = class Script{
constructor( script, parser, dataObject ){
this.rawScript = script;
this.parser = parser;
this.subscript = false;
this.scriptBuffer = Buffer.from( script );
this.rootToken = new Token( "SCRIPT", this, null );
}
get rules(){
return this.parser.rules;
}
GetString( length, token ){
let str = this.rawScript.substring( token.point, token.point + length );
token.Seek( length );
return str;
}
SubScript( language ){
return new Script( this.rawScript, this.parser.compiler.parsers[language], {} );
}
get expected(){
return this.rootToken.expected;
}
}