Apply the given language handler to sourceCode and add the resulting
decorations to out.
@param {number} basePos the index of sourceCode within the chunk of source
whose decorations are already present on out.
554928
function appendDecorations(basePos, sourceCode, langHandler, out) {
    if (!sourceCode) { return; }
    var job = {
      sourceCode: sourceCode,
      basePos: basePos
    };
    langHandler(job);
    out.push.apply(out, job.decorations);
  }
563320
function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace,
                     &$currentNamespace, &$operatorValue, &$namedParameters )
    {
       switch ( $operatorName )
       {
            case 'opengraph':
            {
                $operatorValue = $this->generateOpenGraphTags( $namedParameters['nodeid'] );
                break;
            }
            case 'language_code':
            {
                $operatorValue = eZLocale::instance()->httpLocaleCode();
                break;
            }
       }
    }
1315941
function rebaseHistSel(pos, from, to, diff) {
    if (to < pos.line) {
      pos.line += diff;
    } else if (from < pos.line) {
      pos.line = from;
      pos.ch = 0;
    }
  }
1275183
function mixin(compiler) {
  compiler._comment = compiler.comment;
  compiler.map = new SourceMap();
  compiler.position = { line: 1, column: 1 };
  compiler.files = {};
  for (var k in exports) compiler[k] = exports[k];
}
739084
function compile( src ) {
    var watch  = arguments.length <= 1 || arguments[1] === void 0 ? true : arguments[1];
    var parent = arguments.length <= 2 || arguments[2] === void 0 ? null : arguments[2];

    var script = new SourceScript( src, parent );

    if( watch ) {
        script.watch();
    }

    return script;
}
178809
function _processReplacements(code, onComplete) {

        /**
         * processes a single replacement
         *
         * @param {string} code
         * @param {Array} positions
         * @param {number} i
         * @param {Function} onComplete
         * @returns void
         */
        function _processReplacement(code, positions, i, onComplete) {
            if (i < positions.length) {
                ++replacement_counter;
                var pos = positions[i],
                    replacement = replacements[CURRENT_LEVEL][pos];
                code = _replaceAtPosition(pos, replacement['replace'], replacement['with'], code);

                // process next function
                var next = function() {
                    _processReplacement(code, positions, ++i, onComplete);
                };

                // use a timeout every 250 to not freeze up the UI
                return replacement_counter % 250 > 0 ? next() : setTimeout(next, 0);
            }

            onComplete(code);
        }

        var string_positions = keys(replacements[CURRENT_LEVEL]);
        _processReplacement(code, string_positions, 0, onComplete);
    }
1124629
function writeJs(source, js, base) {
  var filename = path.basename(source, path.extname(source)) + '.js'
  var srcDir   = path.dirname(source)
  var baseDir  = srcDir.substring(base.length)
  var dir      = options.output ? path.join(options.output, baseDir) : srcDir
  var jsPath   = path.join(dir, filename)
  var compile  = function() {
    fs.writeFile(jsPath, js, function(err) {
      if(options.compile && options.watch) console.log("Compiled " + source)
    })
  }
  fs.exists(dir, function(exists) {
    exists ? compile() : exec("mkdir -p " + dir, compile)
  })
}
26864
function _addPos(pos1, pos2) {
        return {line: pos1.line + pos2.line, ch: (pos2.line === 0 ? pos1.ch + pos2.ch : pos2.ch)};
    }
972502
def _inject_language(self, src, strings):
    """"""
    if src not in self.sources:
      raise ValueError("Invalid source for '{0}': {1}".format(self.name, src))
    def _format_string(s):
      if "{0}" in s and "{1}" and "{src}" in s:
        return s.format(*sorted([src, self.target]), src=src)
      elif "{0}" in s and "{1}" in s:
        return s.format(*sorted([src, self.target]))
      elif "{src}" in s:
        return s.format(src=src)
      else:
        return s
    return [_format_string(s) for s in strings]
347214
function (sourceBuffer, aNode, owner) {
        // inner content
        if (aNode.tagName === 'textarea') {
            var valueProp = getANodeProp(aNode, 'value');
            if (valueProp) {
                sourceBuffer.joinRaw('escapeHTML('
                    + compileExprSource.expr(valueProp.expr)
                    + ')'
                );
            }

            return;
        }

        var htmlDirective = aNode.directives.html;
        if (htmlDirective) {
            sourceBuffer.joinExpr(htmlDirective.value);
        }
        else {
            /* eslint-disable no-use-before-define */
            each(aNode.children, function (aNodeChild) {
                aNodeCompiler.compile(aNodeChild, sourceBuffer, owner);
            });
            /* eslint-enable no-use-before-define */
        }
    }
757010
function addCoreInstructions() {
  this._validateInstruction = this.ajv.compile(require('jsonscript/schema/instruction.json'));
  coreInstructions.forEach(function (inst) {
    this.addInstruction(inst, instructionKeywords[inst.evaluate.validatorKeyword], false);
  }, this);
}
429234
@Override
    protected void handleTransliterate(Replaceable text,
                                       Position pos, boolean isIncremental) {
        int start = pos.start;
        int limit = pos.limit;
        int i, ipat;

      loop:
        while (start < limit) {
            // Loop over the forms in spec[].  Exit this loop when we
            // match one of the specs.  Exit the outer loop if a
            // partial match is detected and isIncremental is true.
            for (ipat = 0; spec[ipat] != END;) {

                // Read the header
                int prefixLen = spec[ipat++];
                int suffixLen = spec[ipat++];
                int radix     = spec[ipat++];
                int minDigits = spec[ipat++];
                int maxDigits = spec[ipat++];

                // s is a copy of start that is advanced over the
                // characters as we parse them.
                int s = start;
                boolean match = true;

                for (i=0; i<prefixLen; ++i) {
                    if (s >= limit) {
                        if (i > 0) {
                            // We've already matched a character.  This is
                            // a partial match, so we return if in
                            // incremental mode.  In non-incremental mode,
                            // go to the next spec.
                            if (isIncremental) {
                                break loop;
                            }
                            match = false;
                            break;
                        }
                    }
                    char c = text.charAt(s++);
                    if (c != spec[ipat + i]) {
                        match = false;
                        break;
                    }
                }

                if (match) {
                    int u = 0;
                    int digitCount = 0;
                    for (;;) {
                        if (s >= limit) {
                            // Check for partial match in incremental mode.
                            if (s > start && isIncremental) {
                                break loop;
                            }
                            break;
                        }
                        int ch = text.char32At(s);
                        int digit = UCharacter.digit(ch, radix);
                        if (digit < 0) {
                            break;
                        }
                        s += UTF16.getCharCount(ch);
                        u = (u * radix) + digit;
                        if (++digitCount == maxDigits) {
                            break;
                        }
                    }

                    match = (digitCount >= minDigits);

                    if (match) {
                        for (i=0; i<suffixLen; ++i) {
                            if (s >= limit) {
                                // Check for partial match in incremental mode.
                                if (s > start && isIncremental) {
                                    break loop;
                                }
                                match = false;
                                break;
                            }
                            char c = text.charAt(s++);
                            if (c != spec[ipat + prefixLen + i]) {
                                match = false;
                                break;
                            }
                        }

                        if (match) {
                            // At this point, we have a match
                            String str = UTF16.valueOf(u);
                            text.replace(start, s, str);
                            limit -= s - start - str.length();
                            // The following break statement leaves the
                            // loop that is traversing the forms in
                            // spec[].  We then parse the next input
                            // character.
                            break;
                        }
                    }
                }

                ipat += prefixLen + suffixLen;
            }

            if (start < limit) {
                start += UTF16.getCharCount(text.char32At(start));
            }
        }

        pos.contextLimit += limit - pos.limit;
        pos.limit = limit;
        pos.start = start;
    }
339011
function BaseN(options) {

    var self = this;
    var opt = options || {};

    // assert
    if (opt.max && opt.length) {
        throw new Error('cannot specify both max and length');
    }

    // merge in default options
    for (var key in DEFAULT_OPTIONS) {
        if (!opt.hasOwnProperty(key)) {
            opt[key] = DEFAULT_OPTIONS[key];
        }
    }

    /**
     * a string of all allowed characters used for encoding/decoding.
     * @type {String}
     */
    self.characters = opt.characters;

    /**
     * number of unique characters used to encode ids.
     * @type {Number}
     */
    self.base = opt.base || opt.characters.length;

    /**
     * max length of id string.
     * @type {Number}
     */
    self.length = opt.length || self._findLength(opt.max);
}
1084881
private function fixLinesBetweenUses(int $usePos, int $previousUseEndPos): void
    {
        $file = $this->getFile();

        $posBeforeIndentation = TokenHelper::findPreviousContent(
            $file,
            T_WHITESPACE,
            $file->eolChar,
            $usePos,
            $previousUseEndPos
        );

        $file->fixer->beginChangeset();
        if ($posBeforeIndentation !== null) {
            for ($i = $previousUseEndPos + 1; $i <= $posBeforeIndentation; $i++) {
                $file->fixer->replaceToken($i, '');
            }
        }
        for ($i = 0; $i <= self::LINES_BETWEEN_USES; $i++) {
            $file->fixer->addNewline($previousUseEndPos);
        }
        $file->fixer->endChangeset();
    }
685761
function initAppHandlers (cfg = {}) {
	_.each(handlers, (handler, name) => App[name] = _.partial(handler, _, (_.isFunction(cfg[name])) ? cfg[name] : _.noop));
}
675471
function addSourceToNode(
  node: TreeDirectory,
  url: ParsedURL,
  source: Source
): Source | TreeNode[] {
  const isFile = !isPathDirectory(url.path);

  if (node.type == "source") {
    throw new Error(`Unexpected type "source" at: ${node.name}`);
  }

  // if we have a file, and the subtree has no elements, overwrite the
  // subtree contents with the source
  if (isFile) {
    // $FlowIgnore
    node.type = "source";
    return source;
  }

  const { filename } = url;
  const { found: childFound, index: childIndex } = findNodeInContents(
    node,
    createTreeNodeMatcher(filename, false, null)
  );

  // if we are readding an existing file in the node, overwrite the existing
  // file and return the node's contents
  if (childFound) {
    const existingNode = node.contents[childIndex];
    if (existingNode.type === "source") {
      existingNode.contents = source;
    }

    return node.contents;
  }

  // if this is a new file, add the new file;
  const newNode = createSourceNode(filename, source.url, source);
  const contents = node.contents.slice(0);
  contents.splice(childIndex, 0, newNode);
  return contents;
}
1305239
function baseConforms(source) {
      var props = keys(source);
      return function(object) {
        return baseConformsTo(object, source, props);
      };
    }