[feaLib] Enforce uniform lookup types inside named lookup blocks
This commit is contained in:
parent
0963673d58
commit
2537a4da29
@ -34,6 +34,10 @@ class Builder(object):
|
||||
type(self.cur_lookup_) == builder_class and
|
||||
self.cur_lookup_.lookup_flag == self.lookup_flag_):
|
||||
return self.cur_lookup_
|
||||
if self.cur_lookup_name_ and self.cur_lookup_:
|
||||
raise FeatureLibError(
|
||||
"Within a named lookup block, all rules must be of "
|
||||
"the same lookup type and flag", location)
|
||||
self.cur_lookup_ = builder_class(location, self.lookup_flag_)
|
||||
self.lookups_.append(self.cur_lookup_)
|
||||
if self.cur_lookup_name_:
|
||||
|
@ -166,6 +166,23 @@ class BuilderTest(unittest.TestCase):
|
||||
"Lookup \"foo\" has already been defined",
|
||||
self.build, "lookup foo {} foo; lookup foo {} foo;")
|
||||
|
||||
def test_lookup_multiple_flags(self):
|
||||
# TODO(sascha): As soon as we have a working implementation
|
||||
# of the "lookupflag" statement, test whether the compiler
|
||||
# rejects rules of the same lookup type but different flags.
|
||||
pass
|
||||
|
||||
def test_lookup_multiple_types(self):
|
||||
self.assertRaisesRegex(
|
||||
FeatureLibError,
|
||||
"Within a named lookup block, all rules must be "
|
||||
"of the same lookup type and flag",
|
||||
self.build,
|
||||
"lookup foo {"
|
||||
" sub f f i by f_f_i;"
|
||||
" sub A from [A.alt1 A.alt2];"
|
||||
"} foo;")
|
||||
|
||||
|
||||
class LigatureSubstBuilderTest(unittest.TestCase):
|
||||
def test_make_key(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user