public Expression<?> consume(final ConsumableBuffer<Token<PrologTokenType, ?>> buffer) {
		final Token<PrologTokenType, ?> first = buffer.peek();

		Expression<?> expr = null;
		switch (first.getType()) {
		case ATOM:
			buffer.next();
			expr = new AtomExpression(first);
			break;
		case VARIABLE:
			buffer.next();
			expr = new VariableExpression(first);
			break;
		case NUMBER:
			buffer.next();
			expr = new NumberExpression((Token<PrologTokenType, Number>) first);
			break;
		case OPENBRACKET:
			final ArrayExpressionListener arrel = new ArrayExpressionListener(reporter);
			expr = arrel.consume(buffer);
			break;
		case OPENPAREN:
			final ArrayExpressionListener argel = new ArgumentsExpressionListener(reporter);
			expr = argel.consume(buffer);
			break;
		default:
			assert (false);
			break;
		}

		return expr;
	}