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:
Sascha Brawer 2016-03-20 17:26:20 +01:00
parent 9ec04f0537
commit 7eed24725f
3 changed files with 7 additions and 4 deletions

View File

@ -187,9 +187,9 @@ class IncludingLexer(object):
fname_type, fname_token, fname_location = lexer.next()
if fname_type is not Lexer.FILENAME:
raise FeatureLibError("Expected file name", fname_location)
semi_type, semi_token, semi_location = lexer.next()
if semi_type is not Lexer.SYMBOL or semi_token != ";":
raise FeatureLibError("Expected ';'", semi_location)
#semi_type, semi_token, semi_location = lexer.next()
#if semi_type is not Lexer.SYMBOL or semi_token != ";":
# raise FeatureLibError("Expected ';'", semi_location)
curpath, _ = os.path.split(lexer.filename_)
path = os.path.join(curpath, fname_token)
if len(self.lexers_) >= 5:

View File

@ -141,8 +141,11 @@ class IncludingLexerTest(unittest.TestCase):
"I1a include1.fea:1",
"I0 include0.fea:1",
"I1b include1.fea:3",
"; include2.fea:2",
"I2b include2.fea:3",
"; include3.fea:2",
"I3b include3.fea:3",
"; include4.fea:2",
"I4b include4.fea:3"
])

View File

@ -1,3 +1,3 @@
I1a
include(include0.fea);
include(include0.fea)
I1b