private void fact() throws IOException { if (sta.lastToken() == TOKEN_ID) { builder.buildOperand(sta.getString()); sta.nextTokenType(); } else if (sta.lastToken() == TOKEN_NUM) { builder.buildOperand(sta.getInt()); sta.nextTokenType(); } else if (sta.lastToken() == TOKEN_OSB) { sta.nextTokenType(); expr(); if (sta.lastToken() != TOKEN_CSB) throw new InvalidExpressionError("Expected ]. Got '" + sta.lastToken() + "' instead."); sta.nextTokenType(); } else throw new InvalidExpressionError( "Expected [, a number or an identifier. Got '" + sta.lastToken() + "' instead."); }