class Token {

    public static String unescape(String text) {
        if (text == null) {
            return null;
        }

        if (text.indexOf('\\') < 0) {
            return text;
        }

        int len = text.length();
        boolean escaped = false;
        StringBuilder builder = new StringBuilder();


        for (int i = 0; i < len; ++i) {
            char ch = text.charAt(i);

            if (ch == '\\' && escaped == false) {
                escaped = true;
                continue;
            }

            escaped = false;
            builder.append(ch);
        }

        return builder.toString();
    }

}