def read_int(form):
    """Read an integer."""
    if len(form) == 0:
        raise SyntaxError('unexpected EOF while reading int')
    s = ""
    while (len(form) > 0):
        ch = form[0]
        if not (ch.isdigit() or ch == '-'):
            return (int(s), form)
        else:
            s = s + ch
            form = form[1:]

    if len(s) > 0:
        return (int(s), form)
    else:
        raise SyntaxError('EOF while reading int')
dataset/ETHPy150Open ensime/ensime-sublime/sexp.py/read_int/original