[feaLib] Make include() work like makeotf

This commit is contained in:
Miguel Sousa 2017-02-12 09:09:56 -08:00 committed by Sascha Brawer
parent 78d11e3a0f
commit 75133fc4d1
5 changed files with 4 additions and 3 deletions

View File

@ -188,6 +188,7 @@ class Lexer(object):
class IncludingLexer(object):
def __init__(self, featurefile):
self.lexers_ = [self.make_lexer_(featurefile)]
self.featurefilepath = self.lexers_[0].filename_
def __iter__(self):
return self
@ -210,7 +211,7 @@ class IncludingLexer(object):
#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.dirname(lexer.filename_)
curpath = os.path.dirname(self.featurefilepath)
path = os.path.join(curpath, fname_token)
if len(self.lexers_) >= 5:
raise FeatureLibError("Too many recursive includes",

View File

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

View File

@ -1,4 +1,4 @@
I3a
include(include2.fea);
include(inc/include2.fea);
I3b