?? errormessage.java
字號:
package uk.co.brainycreatures.jpascal.semantic;
/**
* Class to handle error messages.
*
* @author Fidel Viegas
* @version 1.1
*/
public final class ErrorMessage {
/**
* This are all the possible errors that can occurr in a program.
*/
private String errors[] = { "",
"Unknown identifier.",
"Identifier already defined.",
"Constant identifier required.",
"Unary minus not allowed for this type of constant.",
"Unary plus not allowed for this type of constant.",
"Integer constant out of range.",
"Variable should be assigned a value.",
"Exception variable required.",
"Cannot evaluate this identifier.",
"Type mismatch.",
"Invalid function call.",
"Error in statement.",
"Variables of this type may only be declared inside a monitor.",
"Invalid qualifier.",
"Invalid procedure reference.",
"Process identifier required.",
"Real constant out of range.",
"Invalid string.",
"Constant of type integer required.",
"Integer constant too large.",
"Variables of this type may only be declared in a global declaration part.",
"Function identifier expected.",
"Procedure or function identifier expected.",
"Wrong number of arguments.",
"Arrays, conditions, exceptions or channels may not be passed as a function's or procedure's argument.",
"Function, constant or variable identifier expected.",
"Cannot change the value of a constant.",
"An exception may only be thrown in a try, procedure or function block.",
"Procedure identifier must not be the same as monitor identifier.",
"Procedure identifier must not be the same as monitor identifier.",
"Procedure not defined inside monitor",
"Procedure or function identifier must not be the same name as program heading.",
"Monitor or process identifier must not be the same name as program heading.",
"Unknown monitor's procedure.",
"Unknown monitor variable.",
"Only arrays of char, integer, real, string and boolean allowed.",
"Exception must be handled, or it must be declared in the throws clause of this function or procedure.",
"Channel variable required.",
"Condition variable required.",
"Statement may only be accessed inside a process or a monitor's procedure.",
"Statement may only be accessed inside a process or program body.",
"Integer variable required.",
"Variable expected.",
"Statement may only be used inside a process body.",
"Procedure identifier expected.",
"Monitor required.",
"Integer variable, constant or function returning integer.",
"Function, variable or constant required.",
"Invalid cast.",
"Channels of this type are not allowed.",
"Private procedure cannot be accessed outside monitor"
};
/**
* Reports an error message according to the error number and
* location of the identifier that caused the error.
*
* @param errno The error number. This is the index of the array
* containing all the errors.
*
* @param line The line where the error occurred.
*
* @param column The column where the error occurred.
*/
public void report(int errno, int line, int column) {
System.out.println("Error: [" + line + "," + column + "] " +
errors[errno]);
System.out.println("Compilation aborted.");
System.exit(1); // abort program
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -