У меня сложное время, соответствующее фигурным скобкам в этом коде. Он продолжает указывать «else» без ошибки «if», но не уверен, как должен читаться синтаксис. Если кто-то может помочь, это будет оценено по достоинству. Вот код:Подходящие фигурные скобки
private void compileFactor() {
boolean its_a_variable = theInfo.isVar();
if (isIdent(theToken)) {
String ident = theToken;
theToken = t.token(); // handles var and const cases!
IdentInfo theInfo = symTable.lookup(ident);
}
boolean its_a_variable = theInfo.isVar();
int theAddr = theInfo.getAddr();
boolean isGlobal = theInfo.getIsGlobal();
int constValue = theInfo.getValue();
if (its_a_variable) { // pld12: CHANGE THIS!!
int theAddr = theInfo.getAddr();
boolean isGlobal = theInfo.getIsGlobal();
if (theAddr == -1) t.error("undeclared identifier used in expr: "+ident);
if (isGlobal) cs.emit(Machine.LOAD, theAddr);
else cs.emit(Machine.LOADF, theAddr);
} else {
int constValue = theInfo.getValue();
if (constValue = null) t.error("undeclared identifier used in expr: "+ident);
else {
cs.emitLOADI(theNumber);
}
else if (isNumber(theToken)) {
int theNumber = new Integer(theToken).intValue();
cs.emitLOADINT(theNumber);
theToken = t.token();
}
else if (equals(theToken, "(")) { // nothing to do to generate code!
accept("(");
compileExpr();
accept(")");
}
}
Почему вы не можете использовать текстовый редактор с простым синтаксисом пониманием, чтобы отслеживать все соответствующие открывающие и закрывающие скобки? – artdanil
Пожалуйста, скажите, какой язык это. –