Ejemplo n.º 1
0
static cmark_node *function_link_match(cmark_syntax_extension *self,
                                cmark_parser *parser,
                                cmark_node *parent,
                                cmark_inline_parser *inline_parser)
{
  cmark_node *ret = NULL;
  delimiter *tmp_delim;
  int offset;
  int start;

  offset = cmark_inline_parser_get_offset(inline_parser);

  if (offset == 0)
    goto done;

  if (cmark_inline_parser_peek_at(inline_parser, offset + 1) != ')')
    goto done;

  start = offset - 1;

  if (!is_valid_c(cmark_inline_parser_peek_at(inline_parser, start)))
    goto done;

  while (start >= 0) {
    unsigned char c = cmark_inline_parser_peek_at(inline_parser, start);

    if (is_valid_c(c)) {
      start -= 1;
    } else {
      break;
    }
  }

  ret = fixup_nodes(inline_parser, parent, offset - start - 1);

  if (!ret)
    goto done;

  tmp_delim = cmark_inline_parser_get_last_delimiter(inline_parser);

  while (tmp_delim) {
    delimiter *prev = tmp_delim->previous;

    if (tmp_delim->position < start + 1) {
      break;
    }

    cmark_inline_parser_remove_delimiter(inline_parser, tmp_delim);
    tmp_delim = prev;
  }

  cmark_inline_parser_advance_offset(inline_parser);
  cmark_inline_parser_advance_offset(inline_parser);

done:
  return ret;
}
Ejemplo n.º 2
0
node::node(const node& _node) throw(std::bad_alloc)
{
	std::u32string tmp1 = _node._string;
	std::list<node> tmp2 = _node.xarray;
	std::map<std::u32string, std::list<node>> tmp3 = _node.xobject;
	std::vector<node*> tmp4 = _node.xarray_index;

	vtype = _node.vtype;
	_number = _node._number;
	_boolean = _node._boolean;
	_string = _node._string;
	xarray = _node.xarray;
	xobject = _node.xobject;
	xarray_index = _node.xarray_index;
	fixup_nodes(_node);
}
Ejemplo n.º 3
0
node& node::operator=(const node& _node) throw(std::bad_alloc)
{
	if(this == &_node)
		return *this;
	std::u32string tmp1 = _node._string;
	std::list<node> tmp2 = _node.xarray;
	std::map<std::u32string, std::list<node>> tmp3 = _node.xobject;
	std::vector<node*> tmp4 = _node.xarray_index;

	vtype = _node.vtype;
	_number = _node._number;
	_boolean = _node._boolean;
	std::swap(_string, tmp1);
	std::swap(xarray, tmp2);
	std::swap(xobject, tmp3);
	std::swap(xarray_index, tmp4);
	fixup_nodes(_node);
	return *this;
}