def _parse_argument()

in cstar/nodetoolparser/describering.py [0:0]


def _parse_argument(line, tokens, res):
    if not tokens:
        raise ParseException(line, len(line), "Premature end of line")

    name = tokens.pop()
    if not type(name) is Identifier:
        raise ParseException(line, name.offset, "Expected an identifier, not a symbol")

    sym = tokens.pop()
    if sym.val != ':':
        raise ParseException(line, sym.offset, "Expected ':'")

    value = _parse_expression(line, tokens)
    res[name.val] = value