@Test public void testInvalidCharSetsAndStringLiterals() {
		String grammar =
				"lexer grammar Test;\n" +
				"INVALID_STRING_LITERAL_RANGE: 'GH'..'LM';\n" +
				"INVALID_CHAR_SET:             [\\u24\\uA2][\\{];\n" +  //https://github.com/antlr/antlr4/issues/1077
				"EMPTY_STRING_LITERAL_RANGE:   'F'..'A' | 'Z';\n" +
				"EMPTY_CHAR_SET:               [f-az][];\n" +
				"START_HYPHEN_IN_CHAR_SET:     [-z];\n" +
				"END_HYPHEN_IN_CHAR_SET:       [a-];\n" +
				"SINGLE_HYPHEN_IN_CHAR_SET:    [-];\n" +
				"VALID_STRING_LITERALS:        '\\u1234' | '\\t' | '\\'';\n" +
				"VALID_CHAR_SET:               [`\\-=\\]];" +
				"EMPTY_CHAR_SET_WITH_INVALID_ESCAPE_SEQUENCE: [\\'];";  // https://github.com/antlr/antlr4/issues/1556

		String expected =
				"error(" + ErrorType.INVALID_LITERAL_IN_LEXER_SET.code + "): Test.g4:2:30: multi-character literals are not allowed in lexer sets: 'GH'\n" +
				"error(" + ErrorType.INVALID_LITERAL_IN_LEXER_SET.code + "): Test.g4:2:36: multi-character literals are not allowed in lexer sets: 'LM'\n" +
				"error(" + ErrorType.INVALID_ESCAPE_SEQUENCE.code + "): Test.g4:3:30: invalid escape sequence \\u24\\u\n" +
				"error(" + ErrorType.INVALID_ESCAPE_SEQUENCE.code + "): Test.g4:3:40: invalid escape sequence \\{\n" +
				"error(" + ErrorType.EMPTY_STRINGS_AND_SETS_NOT_ALLOWED.code + "): Test.g4:4:33: string literals and sets cannot be empty: 'F'..'A'\n" +
				"error(" + ErrorType.EMPTY_STRINGS_AND_SETS_NOT_ALLOWED.code + "): Test.g4:5:30: string literals and sets cannot be empty: 'f'..'a'\n" +
				"error(" + ErrorType.EMPTY_STRINGS_AND_SETS_NOT_ALLOWED.code + "): Test.g4:5:36: string literals and sets cannot be empty: []\n" +
				"error(" + ErrorType.INVALID_ESCAPE_SEQUENCE.code + "): Test.g4:10:84: invalid escape sequence \\'\n";

		String[] pair = new String[] {
				grammar,
				expected
		};

		testErrors(pair, true);
	}
This is a regression test for antlr/antlr4#959 "NullPointerException".
https://github.com/antlr/antlr4/issues/959
tool-testsuite/test/org/antlr/v4/test/tool/TestToolSyntaxErrors.java