Allow include statements not terminated by a semicolon
The lexer passes the semicolon to the parser, which will read over it. Resolves https://github.com/behdad/fonttools/issues/552.
This commit is contained in:
parent
9ec04f0537
commit
7eed24725f
@ -187,9 +187,9 @@ class IncludingLexer(object):
|
|||||||
fname_type, fname_token, fname_location = lexer.next()
|
fname_type, fname_token, fname_location = lexer.next()
|
||||||
if fname_type is not Lexer.FILENAME:
|
if fname_type is not Lexer.FILENAME:
|
||||||
raise FeatureLibError("Expected file name", fname_location)
|
raise FeatureLibError("Expected file name", fname_location)
|
||||||
semi_type, semi_token, semi_location = lexer.next()
|
#semi_type, semi_token, semi_location = lexer.next()
|
||||||
if semi_type is not Lexer.SYMBOL or semi_token != ";":
|
#if semi_type is not Lexer.SYMBOL or semi_token != ";":
|
||||||
raise FeatureLibError("Expected ';'", semi_location)
|
# raise FeatureLibError("Expected ';'", semi_location)
|
||||||
curpath, _ = os.path.split(lexer.filename_)
|
curpath, _ = os.path.split(lexer.filename_)
|
||||||
path = os.path.join(curpath, fname_token)
|
path = os.path.join(curpath, fname_token)
|
||||||
if len(self.lexers_) >= 5:
|
if len(self.lexers_) >= 5:
|
||||||
|
@ -141,8 +141,11 @@ class IncludingLexerTest(unittest.TestCase):
|
|||||||
"I1a include1.fea:1",
|
"I1a include1.fea:1",
|
||||||
"I0 include0.fea:1",
|
"I0 include0.fea:1",
|
||||||
"I1b include1.fea:3",
|
"I1b include1.fea:3",
|
||||||
|
"; include2.fea:2",
|
||||||
"I2b include2.fea:3",
|
"I2b include2.fea:3",
|
||||||
|
"; include3.fea:2",
|
||||||
"I3b include3.fea:3",
|
"I3b include3.fea:3",
|
||||||
|
"; include4.fea:2",
|
||||||
"I4b include4.fea:3"
|
"I4b include4.fea:3"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
2
Lib/fontTools/feaLib/testdata/include1.fea
vendored
2
Lib/fontTools/feaLib/testdata/include1.fea
vendored
@ -1,3 +1,3 @@
|
|||||||
I1a
|
I1a
|
||||||
include(include0.fea);
|
include(include0.fea)
|
||||||
I1b
|
I1b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user