-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.js
42 lines (27 loc) · 1.27 KB
/
error.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
/*****************************************************************************
ERROR
*****************************************************************************/
function ThrowSyntaxError( message ) {
message = "Syntax Error in line " + source_line[current_source_line_index].line_number + " at position " + token[current_token_index].position + ".\n\n" + message + ".\n\nCompilation aborted!";
// Message in "textarea_output"
emitCodeLine( "\n\n****************************************************************" );
emitCodeLine( "\n\n" + message );
emitCodeLine( "\n\n****************************************************************" );
no_error = false;
writeCodeToTextAreaOutput();
textarea_output.focus();
// Message in alert box
alert( message );
// Terminate script execution
throw new Error();
}
function ThrowSyntaxErrorIfEOLInsteadOf( expected ) {
if ( currentTokenType() == 'EOL' ) {
ThrowSyntaxError( expected + " expected" );
}
}
function ThrowSyntaxErrorIfOperandIsNotImmediate( operand_addressing_mode, operand_value ) {
if ( operand_addressing_mode != 'imm' ) {
ThrowSyntaxError( 'Immediate addressing mode expected in operand "'+operand_value+'"' );
}
}