Patch a position on each node in `nodes`. `offset` is the offset in `file` this run of content starts at.
973654
function patch(config, nodes, offset) {
  var position = config.location.toPosition
  var length = nodes.length
  var index = -1
  var start = offset
  var children
  var node
  var end

  while (++index < length) {
    node = nodes[index]
    children = node.children

    if (children) {
      patch(config, children, start)
    }

    end = start + toString(node).length

    node.position = {start: position(start), end: position(end)}

    start = end
  }

  return nodes
}
1289600
function position() {
      var before = now()

      return update

      // Add the position to a node.
      function update(node, indent) {
        var prev = node.position
        var start = prev ? prev.start : before
        var combined = []
        var n = prev && prev.end.line
        var l = before.line

        node.position = new Position(start)

        // If there was already a `position`, this node was merged.  Fixing
        // `start` wasn’t hard, but the indent is different.  Especially
        // because some information, the indent between `n` and `l` wasn’t
        // tracked.  Luckily, that space is (should be?) empty, so we can
        // safely check for it now.
        if (prev && indent && prev.indent) {
          combined = prev.indent

          if (n < l) {
            while (++n < l) {
              combined.push((offset[n] || 0) + 1)
            }

            combined.push(before.column)
          }

          indent = combined.concat(indent)
        }

        node.position.indent = indent || []

        return node
      }
    }
1037038
function NodeWrapper(node, session) {
        this.node = node;
        this.session = session;
        this.cache = new Cache();
        this.positions = new Cache();
    }
1138964
def patch_xml(files, root_file=None, float_precision=3):
    
    if float_precision < 0:
        raise ValueError("precision must be greater than 0")

    def fix_path(match):
        path = match.group(1)
        if path:
            head, tail = os.path.split(path)
            new_path = os.path.join(os.path.basename(head), tail)
        else:
            new_path = ''
        return '<Input>{0}</Input>'.format(new_path)

    for xmlfilename in files:
        xmlfilename = os.path.abspath(os.path.normpath(xmlfilename))
        patched_xmlfilename = '{0}.tmp'.format(xmlfilename)
        log.info("patching {0} ...".format(xmlfilename))
        fin = open(xmlfilename, 'r')
        fout = open(patched_xmlfilename, 'w')
        for line in fin:
            if root_file is not None:
                line = re.sub(
                    'InputFile="[^"]*"',
                    'InputFile="{0}"'.format(root_file), line)
            line = line.replace(
                '<StatError Activate="True"  InputFile=""  '
                'HistoName=""  HistoPath=""  />',
                '<StatError Activate="True" />')
            line = re.sub(
                '<Combination OutputFilePrefix="(\S*)" >',
                '<Combination OutputFilePrefix="hist2workspace" >', line)
            line = re.sub('\w+=""', '', line)
            line = re.sub('\s+/>', ' />', line)
            line = re.sub('(\S)\s+</', r'\1</', line)
            # HistFactory bug:
            line = re.sub('InputFileHigh="\S+"', '', line)
            line = re.sub('InputFileLow="\S+"', '', line)
            # HistFactory bug:
            line = line.replace(
                '<ParamSetting Const="True"></ParamSetting>', '')
            # chop off floats to desired precision
            line = re.sub(
                r'"(\d*\.\d{{{0:d},}})"'.format(float_precision + 1),
                lambda x: '"{0}"'.format(
                    str(round(float(x.group(1)), float_precision))),
                line)
            line = re.sub('"\s\s+(\S)', r'" \1', line)
            line = re.sub('<Input>(.*)</Input>', fix_path, line)
            fout.write(line)
        fin.close()
        fout.close()
        shutil.move(patched_xmlfilename, xmlfilename)
        if not os.path.isfile(os.path.join(
                              os.path.dirname(xmlfilename),
                              'HistFactorySchema.dtd')):
            rootsys = os.getenv('ROOTSYS', None)
            if rootsys is not None:
                dtdfile = os.path.join(rootsys, 'etc/HistFactorySchema.dtd')
                target = os.path.dirname(xmlfilename)
                if os.path.isfile(dtdfile):
                    log.info("copying {0} to {1} ...".format(dtdfile, target))
                    shutil.copy(dtdfile, target)
                else:
                    log.warning("{0} does not exist".format(dtdfile))
            else:
                log.warning(
                    "$ROOTSYS is not set so cannot find HistFactorySchema.dtd")
146501
def position_node?(node)
      node.respond_to?(:length) &&
        node.length == 2 &&
        node.respond_to?(:all?) &&
        node.all? { |child| child.respond_to?(:to_i) }
    end
630912
function Position(file, line, column) {
  this.file = file;
  this.line = line || 1;
  this.column = column || 0;
}
10147
function setOffsetToIndex(startIndex, offset, baseline) {
            const loc = sourceCode.getLocFromIndex(startIndex)
            setOffsetToLoc(loc, offset, baseline)
        }
232229
function isBlockStartPoint(node, offset) {
	return (!node.parentNode && offset == 0)
		|| (0 <= offset - 1
		&& offset - 1 < node.childNodes.length
		&& isVisible(node.childNodes[offset - 1])
		&& (isBlockNode(node.childNodes[offset - 1])
		|| isHtmlElement(node.childNodes[offset - 1], "br")));
}
1361332
def apply_offset(self):
    ''''''
    self._ensure_modification_is_safe()

    if self.query.offset != 0:
      self._iterable = \
        offset_gen(self.query.offset, self._iterable, self._skipped_inc)
1100571
function patch(node, tag) {
    var data = node.data || (node.data = {})
    data.partOfSpeech = tag
  }
252788
def horz_offset(self, offset):
        
        self.get_or_add_xMode().val = ST_LayoutMode.FACTOR
        self.get_or_add_x().val = offset
639010
def add_offset(self, offset):
        
        self.timestamps = [ts + offset for ts in self.timestamps]
900511
def _add_section(self, node):
        
        self._filldown(node.lineno)

        # push a new context onto stack
        self.context.append(node.name)
        self._update_current_context()

        for _ in map(self.visit, iter_child_nodes(node)):
            pass

        # restore current context
        self.context.pop()
        self._update_current_context()
947628
def create_patch(before_node, after_node)
      if before_node.to_html == after_node.to_html
        []
      else
        create_patch_from_children(before_node, after_node)
      end
    end
210857
function ignoreNode(node) {
            const unknownNodeTokens = new Set(sourceCode.getTokens(node, { includeComments: true }));

            unknownNodeTokens.forEach(token => {
                if (!unknownNodeTokens.has(offsets.getFirstDependency(token))) {
                    const firstTokenOfLine = tokenInfo.getFirstTokenOfLine(token);

                    if (token === firstTokenOfLine) {
                        offsets.ignoreToken(token);
                    } else {
                        offsets.setDesiredOffset(token, firstTokenOfLine, 0);
                    }
                }
            });
        }
1317582
def insert_position(node)
      case node.type
      when :block
        node.children[1].children.empty? ? node.children[0].loc.expression.end_pos + 3 : node.children[1].loc.expression.end_pos
      when :class
        node.children[1] ? node.children[1].loc.expression.end_pos : node.children[0].loc.expression.end_pos
      else
        node.children.last.loc.expression.end_pos
      end
    end
73835
function(offset){
            if(arguments.length > 0){
                this.each(function(inx,ele){
                    var node = vQ(ele);
                    var coords = node.offset(),
                        parentOffset = ele.offsetParent.offset(),
                        props = {
                            top: coords.top - parentOffset.top,
                            left: coords.left - parentOffset.left
                        };
                    if (node.css('position') == 'static'){
                        props['position'] = 'relative';
                    }
                    node.css(props);
                });
            }
            if (!this.length) return null;
            if (!vQ.contains(document.documentElement, this[0]))
                return {top: 0, left: 0};
            var obj = this[0].getBoundingClientRect();
            return {
                left: obj.left + window.pageXOffset,
                top: obj.top + window.pageYOffset,
                width: Math.round(obj.width),
                height: Math.round(obj.height)
            };
        }