# - - - T x n y . _ _ b i n d C o l l i s i o n def __bindCollision ( self, scan, code, codeSet ): '''Create bindings for a collision group. [ (scan is a Scan instance) and (code is a collision code) and (codeSet is a set of disambiguations) -> if self is compatible with (code) as a collision form and the forms in (codeSet) as disambiguations -> self.abTab +:= those bindings else -> Log() +:= error message(s) raise SyntaxError ] '''
First create a binding for the group; see Section 29, “
class CollBind: Cluster of colliding
codes”. Then attempt to add
this binding to the symbol table.
#-- 1 -- # [ collBind := a new CollBind instance binding (code) # to (collSet) ] collBind = CollBind ( code, codeSet ) #-- 2 -- # [ if code is in self.abTab -> # collSym := the entry from self.abTab # else -> # self.abTab +:= a new, unbound entry for (code) # collSym := that entry ] collSym = self.abTab.addAbbr ( code ) #-- 3 -- # [ if collBind can be combined with collSym -> # collSym := collSym combined with collBind # else -> # Log() +:= error message(s) # raise SyntaxError ] try: collSym.bind ( collBind ) except ValueError: scan.syntax ( "This use of '%s' is incompatible with " "the existing use, %s." % (code, collSym.binding()) )