return current char and step if @test succeed, where 
   @test: a python function with one argument, which tests on one char and return True or False
          @test must be registered with register_function

def string_on_predicate0(compiler, cont, test):
  '''return current char and step if @test succeed, where 
   @test: a python function with one argument, which tests on one char and return True or False
          @test must be registered with register_function'''
  test = test.interlang()
  text = compiler.new_var(il.ConstLocalVar('text'))
  pos = compiler.new_var(il.ConstLocalVar('pos'))
  length = compiler.new_var(il.ConstLocalVar('length'))
  p = compiler.new_var(il.LocalVar('p'))
  if not isinstance(test, il.PyFunction):
    raise DaoCompileTypeError(test)
  return il.Begin((
    il.AssignFromList(text, pos, il.parse_state),
    il.Assign(length, il.Len(text)),
    il.If(il.Ge(pos,il.Len(text)), 
      cont(il.String('')),
      il.begin(
        il.Assign(p, pos),
        il.While(il.And(il.Lt(p, length), il.Call(test, il.GetItem(text, p))),
               il.AddAssign(p, il.Integer(1))),
        il.SetParseState(il.Tuple(text, p)),
        il.append_failcont(compiler, 
                           il.SetParseState(il.Tuple(text, pos))),
        cont(il.GetItem(text, il.Slice2(pos, p)))))))