/** * Adds a preprocessor error message to error list along with the current token's information * (like line number, etc.). * * @param errorMessage the error message. * @param lexeme the current lexeme. */ protected void addPreprocessorErrorMessage(String errorMessage, String lexeme) { String error = "(" + getCurrentStreamName() + ") " + "Line " + (streamStack.peek().lineNum) + ", Token \"" + lexeme + "\": " + errorMessage; preprocessorErrorList.add(error); }
/** * Gets the list of error messages. * * @return an array of error messages. */ public String[] getErrorMessages() { String[] out = new String[preprocessorErrorList.size()]; int i = 0; for (String s : preprocessorErrorList) out[i++] = s; return out; }