public String toErrorMessage()
	{
		boolean displayParser = (currentParser != null);
		boolean displayGrammar = (currentGrammar != null && (currentParser == null || !currentParser.isUnitary()));

		StringBuffer rv = new StringBuffer();
		if(displayParser)   rv.append("[parser ").append(currentParser.getName()).append("]");
		if(displayParser && displayGrammar) rv.append(" ");
		if(displayGrammar)  rv.append("[grammar ").append(currentGrammar.getName()).append("]");
		if(displayParser || displayGrammar) rv.append(": ");
		rv.append(message);
		return rv.toString();
	}