Ejemplo n.º 1
0
  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.");
    }
  }
Ejemplo n.º 2
0
  public Boolean have(String s) {

    if (currentSymbol != null && s.equals(currentSymbol.getType())) {
      nextSymbol();
      return true;
    } else {
      return false;
    }
  }