public Boolean have(String s) { if (currentSymbol != null && s.equals(currentSymbol.getType())) { nextSymbol(); return true; } else { return false; } }
public void mustBe(String s) { if (currentSymbol == null) { error("END OF PROGRAM"); } else if (s.equals(currentSymbol.getType())) { nextSymbol(); } else { error("error: \"" + currentSymbol.getValue() + "\"" + " found where \"" + s + "\" expected."); } }