Next / Previous / Contents / Shipman's homepage

6.12. UniData._readGroups(): Process entity group data

unidata.py
# - - -   U n i D a t a . _ r e a d G r o u p s

    def _readGroups(self, root):
        '''Set up ._groupMap.

          [ self._groupMap  :=  as invariant from root
            self._entSetMap  :=  as invariant from root ]
        '''
        #-- 1
        self._groupMap = {}
        self._entSetMap = {}

Here are the relevant productions from charlist.rnc.

unicode = element unicode
{ (entitygroups?, mathvariants?, unicodeblocks?, mathclasses?, charlist)*
}
entitygroups = element entitygroups { group* }

The processing of the group element is handled by Section 6.22, “UniGroup.__init__().

unidata.py
        #-- 2
        # [ root has an ENTITYGROUPS_N child ->
        #     entityGroups  :=  that child ]
        entityGroups = root.find(ENTITYGROUPS_N)

        #-- 3
        # [ self._groupMap  +:=  entries whose keys are the entity group
        #       names from GROUP_N children of entityGroups, and each
        #       related value is a new UniGroup instance representing
        #       that child ]
        for groupNode in entityGroups.findall(GROUP_N):
            group = UniGroup(self, groupNode)
            self._groupMap[group.name] = group