package org.spoofax.jsglr2.parser;

import org.spoofax.jsglr2.parser.result.ParseFailureCause;

public class ParseException extends Exception {

    private static final long serialVersionUID = 5070826083429554841L;

    public ParseException(ParseFailureCause.Type failureType, Position position, Integer character) {
        super(message(failureType, position, character));
    }

    private static String message(ParseFailureCause.Type failureType, Position position, Integer character) {
        StringBuilder message = new StringBuilder();

        message.append(failureType.message);

        if(position != null)
            message.append(
                " at offset " + position.offset + "(line " + position.line + ", column " + position.column + ")");

        if(character != null)
            message.append(" at character " + new String(Character.toChars(character)));

        return message.toString();
    }

}

@@ -29,16 +29,87 @@
 arser;%0A%0A
+import org.metaborg.parsetable.characterclasses.CharacterClassFactory;%0A
 import o
@@ -911,36 +911,41 @@
 %22 + 
-new String(Character.toChars
+CharacterClassFactory.intToString
 (cha
@@ -952,17 +952,16 @@
 racter))
-)
 ;%0A%0A     

Use helper to print whitespace characters with encodings