def convert(gr, raw_node):
    """
    Convert raw node information to a Node or Leaf instance.

    This is passed to the parser driver which calls it whenever a reduction of a
    grammar rule produces a new complete node, so that the tree is build
    strictly bottom-up.
    """
    type, value, context, children = raw_node
    if not children:
        t = tokens.get(type, None)
        if t is not None:
            return t(value, context)
    t = symbols.get(type, None)
    if t is not None:
        return t(children, context)
    try:
        raise NotImplementedError(grammar.number2symbol[type])
    except __HOLE__:
        raise NotImplementedError(token.tok_name[type])
dataset/ETHPy150Open tailhook/pyzza/pyzza/parser.py/convert