#[begin] reverse 
获取节点在组件树中的路径

@param {Node} node 节点对象
@return {Array}
 /* istanbul ignore next
511081
function getNodePath(node) {
    var nodePaths = [];
    var nodeParent = node;
    while (nodeParent) {
        switch (nodeParent.nodeType) {
            case NodeType.ELEM:
                nodePaths.unshift(nodeParent.tagName);
                break;

            case NodeType.IF:
                nodePaths.unshift('if');
                break;

            case NodeType.FOR:
                nodePaths.unshift('for[' + nodeParent.anode.directives['for'].raw + ']'); // eslint-disable-line dot-notation
                break;

            case NodeType.SLOT:
                nodePaths.unshift('slot[' + (nodeParent.name || 'default') + ']');
                break;

            case NodeType.TPL:
                nodePaths.unshift('template');
                break;

            case NodeType.CMPT:
                nodePaths.unshift('component[' + (nodeParent.subTag || 'root') + ']');
                break;

            case NodeType.TEXT:
                nodePaths.unshift('text');
                break;
        }

        nodeParent = nodeParent.parent;
    }

    return nodePaths;
}
997554
@SuppressWarnings("WeakerAccess")
    public static void reverse(int[] order, int offset, int length) {
        for (int i = 0; i < length / 2; i++) {
            int t = order[offset + i];
            order[offset + i] = order[offset + length - i - 1];
            order[offset + length - i - 1] = t;
        }
    }
944044
function reverseObject (obj) {
  const newObj = {}
  for (let k in obj) {
    newObj[obj[k]] = k
  }
  return newObj
}
982678
function(parentNode, reverse, ofType) {
      parentNode._counted = true;
      if (reverse) {
        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
          var node = nodes[i];
          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
        }
      } else {
        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
          if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
      }
    }
132927
function Element(aNode, parent, scope, owner, reverseWalker) {
    this.aNode = aNode;
    this.owner = owner;
    this.scope = scope;
    this.parent = parent;

    this.lifeCycle = LifeCycle.start;
    this.children = [];
    this._elFns = [];
    this.parentComponent = parent.nodeType === NodeType.CMPT
        ? parent
        : parent.parentComponent;

    this.tagName = aNode.tagName;

    // #[begin] allua
    // ie8- 不支持innerHTML输出自定义标签
    /* istanbul ignore if */
    if (ieOldThan9 && this.tagName.indexOf('-') > 0) {
        this.tagName = 'div';
    }
    // #[end]

    nodeSBindInit(this, aNode.directives.bind);
    this.lifeCycle = LifeCycle.inited;

    // #[begin] reverse
    if (reverseWalker) {
        var currentNode = reverseWalker.current;

        /* istanbul ignore if */
        if (!currentNode) {
            throw new Error('[SAN REVERSE ERROR] Element not found. \nPaths: '
                + getNodePath(this).join(' > '));
        }

        /* istanbul ignore if */
        if (currentNode.nodeType !== 1) {
            throw new Error('[SAN REVERSE ERROR] Element type not match, expect 1 but '
                + currentNode.nodeType + '.\nPaths: '
                + getNodePath(this).join(' > '));
        }

        /* istanbul ignore if */
        if (currentNode.tagName.toLowerCase() !== this.tagName) {
            throw new Error('[SAN REVERSE ERROR] Element tagName not match, expect '
                + this.tagName + ' but meat ' + currentNode.tagName.toLowerCase() + '.\nPaths: '
                + getNodePath(this).join(' > '));
        }

        this.el = currentNode;
        reverseWalker.goNext();

        reverseElementChildren(this, this.scope, this.owner);

        this.lifeCycle = LifeCycle.created;
        this._attached();
        this.lifeCycle = LifeCycle.attached;
    }
    // #[end]
}
868147
def backtrace(node):
    
    path = [(node.x, node.y)]
    while node.parent:
        node = node.parent
        path.append((node.x, node.y))
    path.reverse()
    return path
605423
function  (node) {
		  	var parent = node.parentNode,
			  	path = [],
			  	index = this.getChildIndex(node);

		  if(parent && (path = this.getNodePath(parent))){
			   if(index > -1){
				   path.push(index);
			   }
		  }
		  return path;
		}
184234
public static void reverse(final Object[] arr, final int pos, final int len) {
        for (int l = pos, r = pos + len - 1; l < r; l++, r--) {
            final Object tmp = arr[l];
            arr[l] = arr[r];
            arr[r] = tmp;
        }
    }
387459
function reverse (value) {
  var r = '';
  var stack = null;
  var num = null;

  var a = (value + 'E').split('');

  for(var i = 0, j = a.length - 1; i <= j; i++) {
    var x = a[i];
    switch(x) {
    case '千':
      stack = (stack || 0) + (num || 1) * 1000;
      num = null;
      break;
    case '百':
      stack = (stack || 0) + (num || 1) * 100;
      num = null;
      break;
    case '十':
      stack = (stack || 0) + (num || 1) * 10;
      num = null;
      break;
    default:
      var idx = ALL_NUM.indexOf(x);
      if (idx === -1) {
        if (stack !== null || num !== null) {
          r += (stack || 0) + (num || 0);
          stack = null;
          num = null;
        }
        if (i !== j) {
          r += x;
        }
      } else {
        if (num === 0) {
          r += '0';
        }
        num = (num || 0) * 10 + idx % 10;
      }
      break;
    }
  }
  return r;
}
1345364
function(nodes, formula, root, reverse, ofType) {
      if (nodes.length == 0) return [];
      if (formula == 'even') formula = '2n+0';
      if (formula == 'odd')  formula = '2n+1';
      var h = Selector.handlers, results = [], indexed = [], m;
      h.mark(nodes);
      for (var i = 0, node; node = nodes[i]; i++) {
        if (!node.parentNode._counted) {
          h.index(node.parentNode, reverse, ofType);
          indexed.push(node.parentNode);
        }
      }
      if (formula.match(/^\d+$/)) { // just a number
        formula = Number(formula);
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.nodeIndex == formula) results.push(node);
      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
        if (m[1] == "-") m[1] = -1;
        var a = m[1] ? Number(m[1]) : 1;
        var b = m[2] ? Number(m[2]) : 0;
        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
          for (var j = 0; j < l; j++)
            if (node.nodeIndex == indices[j]) results.push(node);
        }
      }
      h.unmark(nodes);
      h.unmark(indexed);
      return results;
    }
658157
def find_reverse(str)
      index = items.reverse.index {|i| i.index < current_row && i.name.start_with?(str)} || items.reverse.index {|i| i.name.start_with? str}
      move_cursor items.size - index - 1 if index
    end
483434
function (node) {
        if (node.nodeType != 1 || !dtd.$removeEmpty[ node.tagName ]) {
            return 0;
        }
        node = node.firstChild;
        while (node) {
            //如果是创建的bookmark就跳过
            if (domUtils.isBookmarkNode(node)) {
                return 0;
            }
            if (node.nodeType == 1 && !domUtils.isEmptyInlineElement(node) ||
                node.nodeType == 3 && !domUtils.isWhitespace(node)
                ) {
                return 0;
            }
            node = node.nextSibling;
        }
        return 1;

    }
1075609
function reverse(obj) {
    if (!is_1.isValue(obj))
        return null;
    // Reverse an array.
    if (is_1.isArray(obj))
        return obj.reverse();
    // Reverse a string.
    if (is_1.isString(obj)) {
        var i = obj.toString().length;
        var tmpStr = '';
        while (i--)
            tmpStr += obj[i];
        return tmpStr;
    }
    // Reverse an object.
    var result = {};
    for (var p in obj) {
        if (is_1.isObject(obj[p]))
            continue;
        result[obj[p]] = p;
    }
    return result;
}
914670
function toArray (span, root) {
  if(!span[root]) return null
  var a = [root]
  while(span[root])
    a.push(root = span[root])
  return a.reverse()
}
1227437
function getAncestors(node) {
    const ancestorsStartingAtParent = [];

    for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
        ancestorsStartingAtParent.push(ancestor);
    }

    return ancestorsStartingAtParent.reverse();
}
1058045
private static void reverse(int[] path, int i, int j) {
        while (i < j) {
            int tmp = path[i];
            path[i] = path[j];
            path[j] = tmp;
            i++;
            j--;
        }
    }
812890
function parseFunction (node) {
	const args = [];
	let index = 0;
	node.nodes.forEach((subNode) => {
		if (subNode.type === "div" && subNode.value === ",") {
			// 遇到`,`下标自加1
			index++;
			return;
		} else if (subNode.type === "function") {
			// 将参数中的`color-stop`,`from`,`to`三种function特殊处理
			if ((subNode.value === "from" || subNode.value === "to" || subNode.value === "color-stop")) {
				let colorStop = subNode.nodes.filter((colorStopInfo) => {
					// colorStop的子节点，除function和word外，都丢去
					return colorStopInfo.type === "function" || colorStopInfo.type === "word";
				}).map((colorStopInfo) => {
					// colorStop的子节点，转换为字符串
					return valueParser.stringify(colorStopInfo);
				});

				// 组装新的对象传递出去
				colorStop = {
					nodes: colorStop,
					type: "function",
					value: subNode.value,
				};

				// 不使用第三个数组维度，而是将其存在最上面的维度上
				args[index] = colorStop;
				return args[index];
			}
		} else if (subNode.type !== "word") {
			return;
		}

		if (!args[index]) {
			// 如果未初始化该数组维度，对其初始化
			args[index] = [];
		}
		// 未特殊处理的function，还有普通的word，将其转字符串
		args[index].push(valueParser.stringify(subNode));
	});
	// 返回转换后的数组
	return args;
}