def string_to_state(s):
    """s is a string possibly preceded by > or @."""
    s = lexer(s)
    attrs = {}
    while True:
        if s.cur == '>':
            attrs['start'] = True
            s.pos += 1
        elif s.cur == '@':
            attrs['accept'] = True
            s.pos += 1
        else:
            break
    x = parse_symbol(s)
    parse_end(s)
    return x, attrs
def string_to_state ( s ) : s = lexer ( s ) attrs = { } while True : if s . cur == '>' : attrs [ 'start' ] = True s . pos += 1 elif s . cur == '@' : attrs [ 'accept' ] = True s . pos += 1 else : break x = parse_symbol ( s ) parse_end ( s ) return x , attrs
s is a string possibly preceded by > or @.