'Parse a function call (like ``%foo{bar,baz}``) starting at
``pos``.  Possibly appends a Call object to ``parts`` and update
``pos``. The character at ``pos`` must be ``%``.'

def parse_call(self):

    assert (self.pos < len(self.string))
    assert (self.string[self.pos] == FUNC_DELIM)
    start_pos = self.pos
    self.pos += 1
    ident = self._parse_ident()
    if (not ident):
        self.parts.append(FUNC_DELIM)
        return
    if (self.pos >= len(self.string)):
        self.parts.append(self.string[start_pos:self.pos])
        return
    if (self.string[self.pos] != GROUP_OPEN):
        self.parts.append(self.string[start_pos:self.pos])
        return
    self.pos += 1
    args = self.parse_argument_list()
    if ((self.pos >= len(self.string)) or (self.string[self.pos] != GROUP_CLOSE)):
        self.parts.append(self.string[start_pos:self.pos])
        return
    self.pos += 1
    self.parts.append(Call(ident, args, self.string[start_pos:self.pos]))
