this is only used by tests

def lex(string):
  "this is only used by tests"
  safe_lexer = LEXER.clone() # reentrant? I can't tell, I hate implicit globals. do a threading test
  safe_lexer.input(string)
  a = []
  while 1:
    t = safe_lexer.token()
    if t: a.append(t)
    else: break
  return a