# - - - T x n y . _ _ a d d C o d e s def __addCodes ( self, scan, taxon ): '''Add symbol table entries for a new taxon. [ (scan is a Scan instance) and (taxon is a Taxon instance) -> if the bindings for the code(s) from taxon are consistent with the state of self -> self.abTab +:= those bindings else -> Log() +:= error message(s) raise SyntaxError ] '''
Higher-level taxa don't have codes; eliminate this case.
#-- 1 -- if taxon.canon is None: return
There are two cases for the addition of symbol table entries for this taxon. Of course the addition may fail due to conflicts with existing bindings.
If there is no disambiguation code, add a
StdBind for the canonical code. See Section 17.13, “
Txny.__addCodeStd(): Create a standard
If there is a disambiguation, add a
for the disambiguation, and also a
for the canonical code. See Section 17.14, “
Txny.__addCodeColl(): Add standard and
collision symbol bindings”.
#-- 2 -- # [ if taxon.disamb is None -> # if a StdBind binding for taxon.canon can be # combined with self.abTab -> # self.abTab +:= a StdBind binding for taxon.canon # else -> # Log() +:= error message(s) # raise SyntaxError # else -> # if a StdBind binding for taxon.disamb and a # CollBind binding for taxon.canon can be combined # with self.abTab -> # self.abTab +:= a StdBind binding for taxon.disamb # and a CollBind binding for taxon.canon # else -> # Log() +:= error message(s) # raise SyntaxError ] if taxon.disamb is None: self.__addCodeStd ( scan, taxon, taxon.canon ) else: self.__addCodeColl ( scan, taxon )