def add_language_system_statements(self, ff): self.hoist_languages() if len(self.scripts_and_languages.keys()) == 0: return if len(self.scripts_and_languages.keys()) == 1: return for s, entry in self.scripts_and_languages.items(): for l in entry: ff.statements.append(feaast.LanguageSystemStatement(s, l))
def parse_languagesystem_(self): assert self.cur_token_ == "languagesystem" location = self.cur_token_location_ script = self.expect_script_tag_() language = self.expect_language_tag_() self.expect_symbol_(";") if script == "DFLT" and language != "dflt": raise FeatureLibError( 'For script "DFLT", the language must be "dflt"', self.cur_token_location_) return ast.LanguageSystemStatement(location, script, language)
def add_language_system_statements(self, ff): self.hoist_languages() total_languages = sum( [len(x) for x in self.scripts_and_languages.values()]) if total_languages < 2: return for s, entry in self.scripts_and_languages.items(): for l in entry: ff.statements.append(feaast.LanguageSystemStatement(s, l))
def parse_languagesystem_(self): assert self.cur_token_ == "languagesystem" location = self.cur_token_location_ script, language = self.expect_tag_(), self.expect_tag_() self.expect_symbol_(";") return ast.LanguageSystemStatement(location, script, language)