"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/oniguruma/lib/oniguruma.js" (8 Mar 2017, 1848 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 (function() {
    2   var OnigRegExp, OnigScanner, OnigString;
    3 
    4   OnigScanner = require('../build/Release/onig_scanner.node').OnigScanner;
    5 
    6   OnigString = require('../build/Release/onig_scanner.node').OnigString;
    7 
    8   OnigRegExp = require('./onig-reg-exp');
    9 
   10   OnigScanner.prototype.findNextMatch = function(string, startPosition, callback) {
   11     if (startPosition == null) {
   12       startPosition = 0;
   13     }
   14     if (typeof startPosition === 'function') {
   15       callback = startPosition;
   16       startPosition = 0;
   17     }
   18     string = this.convertToString(string);
   19     startPosition = this.convertToNumber(startPosition);
   20     return this._findNextMatch(string, startPosition, (function(_this) {
   21       return function(error, match) {
   22         if (match != null) {
   23           match.scanner = _this;
   24         }
   25         return typeof callback === "function" ? callback(error, match) : void 0;
   26       };
   27     })(this));
   28   };
   29 
   30   OnigScanner.prototype.findNextMatchSync = function(string, startPosition) {
   31     var match;
   32     if (startPosition == null) {
   33       startPosition = 0;
   34     }
   35     string = this.convertToString(string);
   36     startPosition = this.convertToNumber(startPosition);
   37     match = this._findNextMatchSync(string, startPosition);
   38     if (match != null) {
   39       match.scanner = this;
   40     }
   41     return match;
   42   };
   43 
   44   OnigScanner.prototype.convertToString = function(value) {
   45     if (value === void 0) {
   46       return 'undefined';
   47     } else if (value === null) {
   48       return 'null';
   49     } else {
   50       return value.toString();
   51     }
   52   };
   53 
   54   OnigScanner.prototype.convertToNumber = function(value) {
   55     value = parseInt(value);
   56     if (!isFinite(value)) {
   57       value = 0;
   58     }
   59     value = Math.max(value, 0);
   60     return value;
   61   };
   62 
   63   exports.OnigString = OnigString;
   64 
   65   exports.OnigScanner = OnigScanner;
   66 
   67   exports.OnigRegExp = OnigRegExp;
   68 
   69 }).call(this);