def semestergruppe(self, tup, buffer):
        """@result: 
            
            [
              (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString),
              (eintrag-Tupel), ...
            ]
            """
        subTree = multiMap(tup[-1], buffer=buffer)

        infoString, jahr, semestergruppe = dispatchList(self, subTree["header"], buffer)[0]

        result = []
        if "sections" in subTree:
            eintraege = dispatchList(self, subTree["sections"], buffer)[0]

            for e in eintraege:
                gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende = e
                result.append(
                    (
                        semestergruppe,
                        gruppenKuerzel,
                        fach,
                        dozent,
                        raum,
                        jahr,
                        woche,
                        wochentag,
                        anfang,
                        ende,
                        infoString,
                    )
                )

        return result
Exemple #2
0
    def semestergruppe(self, tup, buffer):
        """@result: 
        
        [
          (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString),
          (eintrag-Tupel), ...
        ]
        """
        subTree = multiMap(tup[-1], buffer=buffer)

        infoString, jahr, semestergruppe = dispatchList(
            self, subTree['header'], buffer)[0]

        result = []
        if "sections" in subTree:
            eintraege = dispatchList(self, subTree['sections'], buffer)[0]

            if semestergruppe == None:
                semestergruppe = self._derive_gruppenkuerzel(eintraege)

            for e in eintraege:
                gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende = e
                result.append(
                    (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr,
                     woche, wochentag, anfang, ende, infoString))

        return result
 def wochenRange(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     anfangsWoche = dispatchList(self, subTree['anfangsWoche'], buffer)[0]
     endWoche = dispatchList(self, subTree['endWoche'], buffer)[0]
     return map(lambda x: str(x), range(
         int(anfangsWoche),
         int(endWoche) + 1))
Exemple #4
0
    def wahlpflichtmodul(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)
        
        alphanumGruppe = dispatchList(self, subTree['alphanumGruppe'], buffer)[0]
        no = dispatchList(self, subTree['no'], buffer)[0]

        return wahlpflichtmodul2FullName(alphanumGruppe, no)
Exemple #5
0
 def eintrag(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     if 'sixtupel' in subTree:
         result = dispatchList(self, subTree['sixtupel'], buffer)[0]
     else:
         result = dispatchList(self, subTree['septupel'], buffer)[0]
     return result
 def eintrag(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     if 'sixtupel' in subTree:
         result = dispatchList(self, subTree['sixtupel'], buffer)[0]
     else:
         result = dispatchList(self, subTree['septupel'], buffer)[0]
     return result
Exemple #7
0
 def wocheOrWochenRange(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     wochen = []
     if 'woche' in subTree:
         wochen = dispatchList(self, subTree['woche'], buffer)
     if 'wochenRange' in subTree:
         wochen = dispatchList(self, subTree['wochenRange'], buffer)[0]
     return wochen
 def wocheOrWochenRange(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     wochen = []
     if 'woche' in subTree:
         wochen = dispatchList(self, subTree['woche'], buffer)
     if 'wochenRange' in subTree:
         wochen = dispatchList(self, subTree['wochenRange'], buffer)[0]
     return wochen
Exemple #9
0
 def wpPraktikum(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     
     alphanumGruppe = dispatchList(self, subTree['alphanumGruppe'], buffer)[0]
     no = dispatchList(self, subTree['no'], buffer)[0]
     gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]
     
     return wpPraktikum2FullName(alphanumGruppe, no, gruppe)
 def header(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     infoString, jahr = dispatchList(self,subTree['ersteZeile'], buffer)[0]
     gruppenKuerzel = ''
     if 'zweiteZeile' in subTree:
         gruppenKuerzel = dispatchList(self,subTree['zweiteZeile'], buffer)[0]
     else:
         gruppenKuerzel = None
     return (infoString, jahr, gruppenKuerzel)
 def section(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     wochen = dispatchList(self,subTree['wochen'], buffer)[0]
     eintraege = dispatchList(self,subTree['eintrag'], buffer)
     eintraegeMitWoche = []
     for woche in wochen:
         for e in eintraege:
             gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende = e
             eintraegeMitWoche.append((gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende))
     return eintraegeMitWoche
Exemple #12
0
 def header(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     infoString, jahr = dispatchList(self, subTree['ersteZeile'], buffer)[0]
     gruppenKuerzel = ''
     if 'zweiteZeile' in subTree:
         gruppenKuerzel = dispatchList(self, subTree['zweiteZeile'],
                                       buffer)[0]
     else:
         gruppenKuerzel = None
     return (infoString, jahr, gruppenKuerzel)
Exemple #13
0
    def vorlUebung(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = dispatchList(self, subTree['fachKuerzel'], buffer)[0]

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Vorl./Übung", nummer)
Exemple #14
0
    def tutorium(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = dispatchList(self, subTree['fachKuerzel'], buffer)[0]

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Tutorium", nummer=nummer)
Exemple #15
0
 def section(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     wochen = dispatchList(self, subTree['wochen'], buffer)[0]
     eintraege = dispatchList(self, subTree['eintrag'], buffer)
     eintraegeMitWoche = []
     for woche in wochen:
         for e in eintraege:
             gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende = e
             eintraegeMitWoche.append((gruppenKuerzel, fach, dozent, raum,
                                       woche, wochentag, anfang, ende))
     return eintraegeMitWoche
Exemple #16
0
    def projekt(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName("PJ", nummer=nummer, gruppe=gruppe)
Exemple #17
0
    def uebung(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = dispatchList(self, subTree['fachKuerzel'], buffer)[0]

        nummer = ""
        if "no" in subTree:
            nummer = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Übung", nummer, gruppe)
Exemple #18
0
    def orientierungseinheit(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        roemNr = ""
        if "oe1" in subTree:
            roemNr = dispatchList(self, subTree["oe1"], buffer)[0]
        elif "oe2" in subTree:
            roemNr = dispatchList(self, subTree["oe2"], buffer)[0]
        else:
#            raise Exception("wrong control flow! Veranstaltungskuerzel = " + buffer)
            roemNr = "" #FIXME: just a workaround

        return orientierungseinheit2FullName(roemNr)
Exemple #19
0
    def labor(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        labKuerzel = dispatchList(self, subTree['labKuerzel'], buffer)[0]
        #remove the trailing 'L'
        fachKuerzel = labKuerzel[0:len(labKuerzel)-1]

        nummer = ""
        if "no" in subTree:
            nummer = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Labor", nummer, gruppe)
Exemple #20
0
    def praktikum(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        prakKuerzel = dispatchList(self, subTree['prakKuerzel'], buffer)[0]
        #remove the trailing 'P'
        fachKuerzel = prakKuerzel[0:len(prakKuerzel)-1]

        nummer = ""
        if "no" in subTree:
            nummer = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Praktikum", nummer, gruppe)
Exemple #21
0
    def verbundprojekt(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        verbKuerzel = dispatchList(self, subTree['verbKuerzel'], buffer)[0]
        #remove the trailing 'J'
        fachKuerzel = verbKuerzel[0:len(verbKuerzel)-1]

        no = ""
        if "no" in subTree:
            no = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        fullName = veranstaltung2FullName(fachKuerzel, "Verbundprojekt", no, gruppe)
        return fullName.replace("Verbundprojekt Verbundprojekt", "Verbundprojekt")
Exemple #22
0
    def teamStudienEinstieg(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName("TSE", gruppe=gruppe)
Exemple #23
0
    def awSeminar(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = "AW"

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Seminar", nummer)
Exemple #24
0
 def septupel(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel, fach = dispatchList(self, subTree['fach'], buffer)[0]
     dozent = dispatchList(self, subTree['dozent'], buffer)[0]
     raum = dispatchList(self, subTree['raum'], buffer)[0]
     raum += " (" + dispatchList(self, subTree['gebaeude'], buffer)[0] + ")"
     wochentag = dispatchList(self, subTree['wochentag'], buffer)[0]
     anfang = dispatchList(self, subTree['anfang'], buffer)[0]
     ende = dispatchList(self, subTree['ende'], buffer)[0]
     return (gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende)
 def septupel(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel, fach = dispatchList(self, subTree["fach"], buffer)[0]
     dozent = dispatchList(self, subTree["dozent"], buffer)[0]
     raum = dispatchList(self, subTree["raum"], buffer)[0]
     raum += " (" + dispatchList(self, subTree["gebaeude"], buffer)[0] + ")"
     wochentag = dispatchList(self, subTree["wochentag"], buffer)[0]
     anfang = dispatchList(self, subTree["anfang"], buffer)[0]
     ende = dispatchList(self, subTree["ende"], buffer)[0]
     return (gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende)
 def septupel(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel, fach = dispatchList(self, subTree['fach'], buffer)[0]
     dozent = dispatchList(self, subTree['dozent'], buffer)[0]
     raum = dispatchList(self, subTree['raum'], buffer)[0]
     raum += " (" + dispatchList(self, subTree['gebaeude'], buffer)[0] + ")"
     wochentag = dispatchList(self, subTree['wochentag'], buffer)[0]
     anfang = dispatchList(self, subTree['anfang'], buffer)[0]
     ende = dispatchList(self, subTree['ende'], buffer)[0]
     return (gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende)
Exemple #27
0
 def array_dimension(self, value, buffer_):  # @UnusedVariable
     # value = (tag, left, right, taglist)
     _av = dispatchList(self, value[3], buffer_)
     # if resulting list of sizes along all dimensions has only a single
     # entry than reduce it to a scalar size value otherwise convert to
     # numpy.int64 array
     if len(_av) == 1:
         return int(_av[0])
     elif len(_av) > 1:
         return np.array(_av, dtype=np.int64)
     else:
         raise ValueError('definition value list is empty:', _av)
Exemple #28
0
 def in_expr(self, tags, buffer):
     """
         >>> input = "foo in ('bar', 'baz', 'barbar')"
         >>> proc = ProcessessExpression()
         >>> proc(parse('in_expr', input), input)
         InExpression(foo, ('bar', 'baz', 'barbar'))
     """
     retval = result = dispatchList(self, tags[IDX_CHILDREN], buffer )
     #~ pprint(retval)
     return InExpression(retval[0], retval[1:])
     var_name = self(tags[IDX_CHILDREN][0], buffer)
     var_value = self(tags[IDX_CHILDREN][1], buffer)
     return EqualExpression(var_name, var_value)
Exemple #29
0
 def in_expr(self, tags, buffer):
     """
         >>> input = "foo in ('bar', 'baz', 'barbar')"
         >>> proc = ProcessessExpression()
         >>> proc(parse('in_expr', input), input)
         InExpression(foo, ('bar', 'baz', 'barbar'))
     """
     retval = result = dispatchList(self, tags[IDX_CHILDREN], buffer)
     #~ pprint(retval)
     return InExpression(retval[0], retval[1:])
     var_name = self(tags[IDX_CHILDREN][0], buffer)
     var_value = self(tags[IDX_CHILDREN][1], buffer)
     return EqualExpression(var_name, var_value)
Exemple #30
0
 def inline_parameter_value(self, value, buffer_):
     # value = (tag, left, right, taglist)
     if value[3][0][0] == "qstring":
         return getString(value, buffer_).strip(' \t\n\r\f"')
     _av = dispatchList(self, value[3], buffer_)
     # if list of attribute values contains only one entry reduce it
     # to scalar value. Otherwise # insert the string "<!?c?!>" which
     # will be used by the # AmiraHeader._load_parameters function to
     # distinguisch between a list of constant parameter values and a
     # list of sub parameters
     if len(_av) == 1:
         return _av[0]
     return ['<!?c?!>'] + _av
    def semestergruppe(self,tup,buffer):
        """@result: 
        
        [
          (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString, version),
          (eintrag-Tupel), ...
        ]
        """
        subTree = multiMap(tup[-1],buffer=buffer)

        infoString, version, semester, jahr, semestergruppe = dispatchList(self,subTree['header'], buffer)[0]

        result = []
        if "sections" in subTree:
            eintraege = dispatchList(self,subTree['sections'], buffer)[0]

            if semestergruppe == None:
                semestergruppe = self._derive_gruppenkuerzel(eintraege)

            for e in eintraege:
                gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende = e
                result.append((semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString, version, semester))

        return result
Exemple #32
0
 def attribute_value(self, value, buffer_):  # @UnusedVariable
     # value = (tag, left, right, taglist)
     _av = dispatchList(self, value[3], buffer_)
     # if list of attribute values contains only one entry reduce it
     # to scalar value. In case the list contains more than one value
     # insert the string "<!?c?!>" which will be used by the
     # AmiraHeader._load_parameters function to distinguisch between
     # a list of constant parameter values and a list of parameters
     # in case list of parameter values is empty return None
     if len(_av) == 1:
         return _av[0]
     elif len(_av) > 1:
         return ["<!?c?!>"] + _av
     elif len(_av) == 0:
         return None
     else:
         raise ValueError('attribute value list is empty:', _av)
Exemple #33
0
 def materials(self, value, buffer_):  # @UnusedVariable
     # value = (tag, left, right, taglist)
     _av = dispatchList(self, value[3], buffer_)
     # currently gramma handles dedicated materials section as additional
     # parameters section starting with Materials instead of Parameters.
     # rewrite it to materials struture to ensure they do not overwrite
     # the preceeding parameters section
     return {
         'materials': [{
             'parameter_name':
             _strip_material_name.sub('', _item[_id]['parameter_value']),
             'parameter_value':
             _item[:_id] + _item[_id + 1:]
         } for _item, _id in ((_item, [
             _index for _index, _val in enumerate(_item)
             if _val['parameter_name'] in ['name', 'Name']
         ][0]) for _item in _av)]
     }
Exemple #34
0
    def quoted(self, tags, buffer):
        """
            >>> proc = ProcessessExpression()
            >>> input = "'foo'"
            >>> proc(parse('quoted', input), input)
            'foo'
            >>> input = "'foo bar'"
            >>> proc(parse('quoted', input), input)
            'foo bar'
        """
        retval = result = dispatchList(self, tags[IDX_CHILDREN], buffer )
        def concat(values):
            retval = ''
            for item in values:
                if item:
                    retval += item
            return retval

        retval = concat(retval)
        #~ pprint(retval)
        return retval
        return self(tags[IDX_CHILDREN][1], buffer)
Exemple #35
0
    def quoted(self, tags, buffer):
        """
            >>> proc = ProcessessExpression()
            >>> input = "'foo'"
            >>> proc(parse('quoted', input), input)
            'foo'
            >>> input = "'foo bar'"
            >>> proc(parse('quoted', input), input)
            'foo bar'
        """
        retval = result = dispatchList(self, tags[IDX_CHILDREN], buffer)

        def concat(values):
            retval = ''
            for item in values:
                if item:
                    retval += item
            return retval

        retval = concat(retval)
        #~ pprint(retval)
        return retval
        return self(tags[IDX_CHILDREN][1], buffer)
Exemple #36
0
            self.enum_sets[cm])

        return cm, self.messages[cm]

    def _get_message_namespace(self):
        return '-'.join(m[0] for m in self.message_stack)

    def message_label(self, (tag, start, stop, subtags), buffer):
        self.current_message = self._get_message_namespace() + '-' + buffer[start:stop]
        if self.current_message in self.messages:
            raise ProtoParseError(start, stop, buffer, "message %s already defined" % self.current_message)
        self.messages[self.current_message] = {}, [] # fields, submessages

    def message_body(self, (tag, start, stop, subtags), buffer):
        if subtags:
            return dispatchList(self, subtags, buffer)

    def field_require(self, (tag, start, stop, subtags), buffer):
        req = buffer[start:stop]
        return req

    def field_type(self, (tag, start, stop, subtags), buffer):
        qualifier = dispatchList(self, subtags, buffer)
        # qualifier will be the package the type is imported from, unless
        # it is zero length. buffer[start:stop] - qualifier will leave us
        # with the type name.
        if len(qualifier) > 0 and len(qualifier[0]) > 0:
            ns = qualifier[0][:-1]
            typ = buffer[start+len(qualifier[0]):stop]
            return QualifiedTypeDecl(ns, typ, self.scope_table.current_scope())
        else:
Exemple #37
0
            count = u''
            if self.count != 1:
                count = self.count
            return u'%sd%d%s%s%s%s' % (count, self.dieSize, filter, modifier, repeat, self.sort)
        else:
            return u'%s' % (self.staticNumber,)


class Processor(disp.DispatchProcessor):
    def diceExpression(self, (t,s1,s2,sub), buffer):
        self.expr = DiceExpression()
        disp.dispatchList(self, sub, buffer)
        return self.expr

    def randomNumber(self, (t,s1,s2,sub), buffer):
        return disp.dispatchList(self, sub, buffer)

    def staticNumber(self, (t,s1,s2,sub), buffer):
        self.expr.staticNumber = int(buffer[s1:s2])

    def dieSet(self, (t,s1,s2,sub), buffer):
        return disp.dispatchList(self, sub, buffer)

    def sorted(self, (t,s1,s2,sub), buffer):
        self.expr.sort = 'sort'

    def filter(self, (t,s1,s2,sub), buffer):
        self.expr.filterDirection = buffer[s1].lower()
        self.expr.filterCount = int(buffer[s1+1:s2])

    def count(self, (t,s1,s2,sub), buffer):
 def sections(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     eintraegeList = dispatchList(self, subTree['section'], buffer)
     eintraege = reduce(lambda x, y: x + y, eintraegeList)
     return eintraege
 def zweiteZeile(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel = dispatchList(self, subTree['gruppenKuerzel'],
                                   buffer)[0]
     return gruppenKuerzel
 def semester(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     jahr = dispatchList(self, subTree['jahr'], buffer)[0]
     return jahr
 def infoString(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     jahr = dispatchList(self, subTree['semester'], buffer)[0]
     infoString = str(getString(tup, buffer))
     return (infoString, jahr)
Exemple #42
0
 def get(veranstaltung):
     return dispatchList(self, subTree[veranstaltung], buffer)[0]
Exemple #43
0
 def data_definitions(self, value, buffer_):
     # value = (tag, left, right, taglist)
     return {'data_definitions': dispatchList(self, value[3], buffer_)}
Exemple #44
0
 def number_seq(self, value, buffer_):
     # value = (tag, left, right, taglist)
     return dispatchList(self, value[3], buffer_)
Exemple #45
0
 def array_declarations(self, value, buffer_):  # @UnusedVariable
     # value = (tag, left, right, taglist)
     return {'array_declarations': dispatchList(self, value[3], buffer_)}
Exemple #46
0

class CommandProcessor(disp.DispatchProcessor):
    commandArgsFound = None
    commandName = None
    botName = None

    def commandIdentifier(self, (t,s1,s2,sub), buffer):
        disp.dispatchList(self, sub, buffer)
        self.commandName = buffer[s1:s2]

    def commandArgs(self, (t,s1,s2,sub), buffer):
        self.commandArgsFound = buffer[s1:s2]

    def command(self, (t,s1,s2,sub), buffer):
        disp.dispatchList(self, sub, buffer)
        return self.botName, self.commandName, self.commandArgsFound

    def botname(self, (t,s1,s2,sub), buffer):
        self.botName = buffer[s1:s2].lower()

def parseCommand(s):
    commandParser = parser.Parser(grammar, root="commandRoot")
    succ, children, end = commandParser.parse(s, processor=CommandProcessor())
    if not succ or not end == len(s):
        raise RuntimeError('%s is not a command' % (s,))
    return children



class Sentence(object):
Exemple #47
0
#
# Parsing infrastructure
#


class ACLProcessor(DispatchProcessor):
    pass


def default_processor(self, (tag, start, stop, subtags), buffer):
    if not subtags:
        return buffer[start:stop]
    elif len(subtags) == 1:
        return dispatch(self, subtags[0], buffer)
    else:
        return dispatchList(self, subtags, buffer)


def make_nondefault_processor(action):
    if callable(action):

        def processor(self, (tag, start, stop, subtags), buffer):
            if tag in subtagged:
                results = [
                    getattr(self, subtag[0])(subtag, buffer)
                    for subtag in subtags
                ]
                return action(strip_comments(results))
            else:
                return action(buffer[start:stop])
    else:
Exemple #48
0
 def gwKurs(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     gwKuerzel = dispatchList(self, subTree['gwKuerzel'], buffer)[0]
     return gwKurs2FullName(gwKuerzel)