[feaLib] Clarify error message for malformed glyph class references

The new message makes clearer what exactly the parser was looking for
when processing a glyph class reference.
This commit is contained in:
Sascha Brawer 2015-08-03 09:47:06 +02:00
parent bb5a7e7caf
commit 4169e584cc
2 changed files with 6 additions and 3 deletions

View File

@ -92,8 +92,10 @@ class Parser(object):
self.cur_token_location_)
result.update(gc.glyphs)
else:
raise ParserError("Expected glyph name, range, or reference",
self.cur_token_location_)
raise ParserError(
"Expected glyph name, glyph range, "
"or glyph class reference",
self.cur_token_location_)
self.expect_symbol_("]")
return result

View File

@ -26,7 +26,8 @@ class ParserTest(unittest.TestCase):
def test_glyphclass_bad(self):
self.assertRaisesRegex(
ParserError, "Expected glyph name, range, or reference",
ParserError,
"Expected glyph name, glyph range, or glyph class reference",
self.parse, "@bad = [a 123];")
def test_glyphclass_duplicate(self):