Ejemplo n.º 1
0
tree
add_default_capture (tree lambda_stack, tree id, tree initializer)
{
  bool this_capture_p = (id == this_identifier);

  tree var = NULL_TREE;

  tree saved_class_type = current_class_type;

  tree node;

  for (node = lambda_stack;
       node;
       node = TREE_CHAIN (node))
    {
      tree lambda = TREE_VALUE (node);

      current_class_type = LAMBDA_EXPR_CLOSURE (lambda);
      if (DECL_PACK_P (initializer))
	initializer = make_pack_expansion (initializer);
      var = add_capture (lambda,
                            id,
                            initializer,
                            /*by_reference_p=*/
			    (!this_capture_p
			     && (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda)
				 == CPLD_REFERENCE)),
			    /*explicit_init_p=*/false);
      initializer = convert_from_reference (var);
    }

  current_class_type = saved_class_type;

  return var;
}
Ejemplo n.º 2
0
Archivo: rxx.C Proyecto: aosmith/okws
bool
repl_t::parse (str in)
{
  const char *bp = in.cstr ();
  const char *ep = bp + in.len ();
  const char *last = bp;
  size_t inc = 1;

  for (const char *p = bp; p < ep; p += inc) {
    bool is_dig = false;
    inc = 1;
    
    if (p == ep - 1 || *p != '$') { /* noop */ }

    else if (p[1] == '$' || (is_dig = (isdigit (p[1])))) {

      add_str (bp, last, p, ep);
      inc = 2;

      if (is_dig) {
	add_capture (p[1] - '0');
	last = p + 2;
      } else {
	last = p + 1;
      }
    }

  }
  add_str (bp, last, ep, ep);
  return true;
}