-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExceptions.java
More file actions
61 lines (53 loc) · 1.59 KB
/
Exceptions.java
File metadata and controls
61 lines (53 loc) · 1.59 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package calc;
//exceptions handled in this project
//base class is CalculatorExceptions
class CalculatorException extends Exception {
CalculatorException(String s){
super(s);
}
}
class UnknownSymbolException extends CalculatorException{
UnknownSymbolException(String c){
super("Unknown Symbol : " + c);
}
}
class InvalidIdentifierException extends CalculatorException {
InvalidIdentifierException(String identifier){
super("Invalid Identifier : " + identifier);
}
}
class IncorrectParamException extends CalculatorException {
IncorrectParamException(String var_name){
super("Incorrect parameter " + var_name + ", please use 'x'.");
}
}
class FunctionReDefinitionException extends CalculatorException {
FunctionReDefinitionException(String f_name){
super("Incorrect attempt to redefine function " + f_name);
}
}
class InvalidSyntaxException extends CalculatorException{
InvalidSyntaxException(String exp){
super("Syntax Error in line : " + exp);
}
}
class IdentifierConflictException extends CalculatorException {
IdentifierConflictException(String name){
super("Identifier " + name + " already bound to another object");
}
}
class VariableNotFoundException extends CalculatorException {
VariableNotFoundException(String v){
super(v + " : No such variable.");
}
}
class FunctionNotFoundException extends CalculatorException {
FunctionNotFoundException(String f){
super(f + " : No such function.");
}
}
class InvalidExpressionException extends CalculatorException {
InvalidExpressionException(){
super("Syntax error.");
}
}