-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.js
34 lines (22 loc) · 1010 Bytes
/
debug.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
/*****************************************************************************
DEBUG
*****************************************************************************/
function debug_postSourceLinesToTextAreaOutput() {
textarea_output.value = "";
for (var j = 0; j < source_line.length; j++) {
textarea_output.value += getSourceLineAsComment( source_line[j] ) + "\n";
}
}
function debug_getTokenOutputLineByIndex( i ) {
return " pos:" + token[i].position.toString().padEnd(2, " ") + " [" + token[i].type.padEnd(7, " ") + "] <" + token[i].value + ">\n";
}
function debug_postTokensToTextAreaOutput() {
for (var i = 0; i < token.length; i++) {
textarea_output.value += debug_getTokenOutputLine( i );
}
}
function debug_currentToken() {
textarea_output.value += debug_getTokenOutputLineByIndex( current_token_index );
// Terminate script execution
throw new Error( '"END" BY DEBUG FUNCTION "debug_currentToken()"' );
}