def __splitTemplate(value, valueParams):
    """ 
    Split string into plus-expression(s) 

    - patchParam: string node containing the placeholders
    - valueParams: list of params to inject
    """

    # Convert list with nodes into Python dict
    # [a, b, c] => {0:a, 1:b, 2:c}
    mapper = { pos: value for pos, value in enumerate(valueParams) }
    
    result = []
    splits = __replacer.split(value)
    if len(splits) == 1:
        return None
    
    pair = Node.Node(None, "plus")

    for entry in splits:
        if entry == "":
            continue
            
        if len(pair) == 2:
            newPair = Node.Node(None, "plus")
            newPair.append(pair)
            pair = newPair

        if __replacer.match(entry):
            pos = int(entry[1]) - 1
            
            # Items might be added multiple times. Copy to protect original.
            try:
                repl = mapper[pos]
            except __HOLE__:
                raise UserError("Invalid positional value: %s in %s" % (entry, value))
            
            copied = copy.deepcopy(mapper[pos])
            if copied.type not in ("identifier", "call"):
                copied.parenthesized = True
            pair.append(copied)
            
        else:
            child = Node.Node(None, "string")
            child.value = entry
            pair.append(child)
            
    return pair
dataset/ETHPy150Open zynga/jasy/jasy/js/optimize/Translation.py/__splitTemplate