package xhl.core;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import xhl.core.elements.CodeList;
import xhl.core.exceptions.EvaluationException;

/**
 * LanguageProcessor, which reads code from the file and outputs error messages
 * to the standard error output.
 *
 * @author Sergej Chodarev
 */
public class ConsoleLanguageProcessor extends LanguageProcessor {

    public ConsoleLanguageProcessor(Language lang) {
        super(lang);
    }

    public void process(String filename) throws FileNotFoundException,
            IOException {
        Reader reader = new Reader();
        CodeList program = reader.read(new FileReader(filename));
        try {
            execute(program);
        } catch (EvaluationException e) {
            System.err.printf("%s: %s", e.getPosition(), e);
        }
    }
}

@@ -813,16 +813,18 @@
 (%22%25s: %25s
+%5Cn
 %22, e.get

Add new line at the end of error message