![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol/src/Pharse/DPTokenizer.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function DPTokenizer(opt) { opt = opt || {}; if (opt.elementRegexes) this.elementRegexes = opt.elementRegexes; this._combineTokenRegex(); } DPTokenizer.prototype.elementRegexes = [['string', /("(?:[^"\\]|\\.)*?")|('(?:[^'\\]|\\.)*?')/], ['number', /(\d+([.]\d*)?([eE][+-]?\d+)?|[.]\d+([eE][+-]?\d+)?)/], ['word', /[_a-zA-Z][_a-zA-Z0-9]*/], ['skip', /([\s\r\n]+)|(\/\/[^\n]*)|(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)/], ['dsymbol', /\+\+|--|==|!=|<=|>=|\|\||&&/], ['tsymbol', /\.\.\./], ['symbol', /[^\s_a-zA-Z0-9]/]]; DPTokenizer.prototype._combineTokenRegex = function () { var tokenRegexSource = this.elementRegexes.map(function (cr) { return '(' + cr[1].source + ')'; }).join('|'); this.tokenRegex = new RegExp(tokenRegexSource, 'g'); this.groupIndexOfTypes = this.elementRegexes.slice(0, this.elementRegexes.length - 1).reduce(function (ac, cr) { var subGroupLength = new RegExp(cr[1].source + '|.').exec('a').length; ac.push(ac[ac.length - 1] + subGroupLength); return ac; }, [1]); this.types = this.elementRegexes.reduce(function (ac, cr) { ac[cr[0]] = cr; return ac; }, {}); }; DPTokenizer.prototype.tokenize = function (source) { var regex = new RegExp(this.tokenRegex.source, 'g'); var elementRegexes = this.elementRegexes; var groupIndexOfTypes = this.groupIndexOfTypes; var res = []; var matched = regex.exec(source); var type, i; while (matched) { type = null; for (i = 0; i < groupIndexOfTypes.length; ++i) { if (matched[groupIndexOfTypes[i]]) { type = elementRegexes[i][0]; } } res.push({ type: type, content: matched[0], start: matched.index, end: matched.index + matched[0].length }); matched = regex.exec(source); } return res; }; var _default = DPTokenizer; exports.default = _default;