64 }
65
66 private enum MyPunctuatorAndOperator implements TokenType {
67 STAR("*"), COLON(","), EQUAL("="), EQUAL_OP("=="), MUL_ASSIGN("*="), NOT_EQUAL("!=");68
69 private final String value;
70
96 STRUCT("struct"),
97 INT("int"), VOID("void"),
98 RETURN("return"), IF("if"), ELSE("else"), WHILE("while"),
99 CONTINUE("continue"), BREAK("break");100
101 private final String value;
102
95
96 STRUCT("struct"),
97 INT("int"), VOID("void"),
98 RETURN("return"), IF("if"), ELSE("else"), WHILE("while"), 99 CONTINUE("continue"), BREAK("break");
100
101 private final String value;
94 public static enum Keywords implements TokenType {
95
96 STRUCT("struct"),
97 INT("int"), VOID("void"), 98 RETURN("return"), IF("if"), ELSE("else"), WHILE("while"),
99 CONTINUE("continue"), BREAK("break");
100
65 EQ("="), COMMA(","), SEMICOLON(";"),
66 ADD("+"), SUB("-"), MUL("*"), DIV("/"),
67 EQEQ("=="), NE("!="), LT("<"), LTE("<="), GT(">"), GTE(">="),
68 INC("++"), DEC("--"), 69 HASH("#");
70
71 private final String value;
Multiple variables (or fields) should not be declared on the same line.
Declaring more than one variables (or fields) on the same line makes the code harder to read. Things might get more confusing if some of those variables are initiliazed and some of them are not.
class Klass {
private int a, b = 20;
private void method() {
double d1, d2 = 3.5, d3;
// ... rest of the code
}
}
Consider declaring one variable per line.
class Klass {
private int a;
private int b = 20;
private void method() {
double d1;
double d2 = 3.5;
double d3;
// ... rest of the code
}
}