public String getTokenName(int t) {
		if ( t==-1 ) return "EOF";

		if ( atn.grammarType == ATNType.LEXER &&
				t >= Character.MIN_VALUE && t <= Character.MAX_VALUE )
		{
			switch (t) {
				case '\n':
					return "'\\n'";
				case '\r':
					return "'\\r'";
				case '\t':
					return "'\\t'";
				case '\b':
					return "'\\b'";
				case '\f':
					return "'\\f'";
				case '\\':
					return "'\\\\'";
				case '\'':
					return "'\\''";
				default:
					if ( Character.UnicodeBlock.of((char)t)==Character.UnicodeBlock.BASIC_LATIN &&
							!Character.isISOControl((char)t) ) {
						return '\''+Character.toString((char)t)+'\'';
					}
					// turn on the bit above max "\uFFFF" value so that we pad with zeros
					// then only take last 4 digits
					String hex = Integer.toHexString(t|0x10000).toUpperCase().substring(1,5);
					String unicodeStr = "'\\u"+hex+"'";
					return unicodeStr;
			}
		}

		if (tokenNames != null && t >= 0 && t < tokenNames.size()) {
			return tokenNames.get(t);
		}

		return String.valueOf(t);
	}
For testing really; gives a human readable version of the ATN
tool-testsuite/test/org/antlr/v4/test/tool/ATNDescriber.java