Server IP : 108.163.255.210 / Your IP : 3.142.198.250 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/public_html/indijourneys.com/node_modules/braces/lib/ |
Upload File : |
'use strict'; var Node = require('snapdragon-node'); var utils = require('./utils'); /** * Braces parsers */ module.exports = function(braces, options) { braces.parser .set('bos', function() { if (!this.parsed) { this.ast = this.nodes[0] = new Node(this.ast); } }) /** * Character parsers */ .set('escape', function() { var pos = this.position(); var m = this.match(/^(?:\\(.)|\$\{)/); if (!m) return; var prev = this.prev(); var last = utils.last(prev.nodes); var node = pos(new Node({ type: 'text', multiplier: 1, val: m[0] })); if (node.val === '\\\\') { return node; } if (node.val === '${') { var str = this.input; var idx = -1; var ch; while ((ch = str[++idx])) { this.consume(1); node.val += ch; if (ch === '\\') { node.val += str[++idx]; continue; } if (ch === '}') { break; } } } if (this.options.unescape !== false) { node.val = node.val.replace(/\\([{}])/g, '$1'); } if (last.val === '"' && this.input.charAt(0) === '"') { last.val = node.val; this.consume(1); return; } return concatNodes.call(this, pos, node, prev, options); }) /** * Brackets: "[...]" (basic, this is overridden by * other parsers in more advanced implementations) */ .set('bracket', function() { var isInside = this.isInside('brace'); var pos = this.position(); var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]-)(\]|[^*+?]+)|\[)/); if (!m) return; var prev = this.prev(); var val = m[0]; var negated = m[1] ? '^' : ''; var inner = m[2] || ''; var close = m[3] || ''; if (isInside && prev.type === 'brace') { prev.text = prev.text || ''; prev.text += val; } var esc = this.input.slice(0, 2); if (inner === '' && esc === '\\]') { inner += esc; this.consume(2); var str = this.input; var idx = -1; var ch; while ((ch = str[++idx])) { this.consume(1); if (ch === ']') { close = ch; break; } inner += ch; } } return pos(new Node({ type: 'bracket', val: val, escaped: close !== ']', negated: negated, inner: inner, close: close })); }) /** * Empty braces (we capture these early to * speed up processing in the compiler) */ .set('multiplier', function() { var isInside = this.isInside('brace'); var pos = this.position(); var m = this.match(/^\{((?:,|\{,+\})+)\}/); if (!m) return; this.multiplier = true; var prev = this.prev(); var val = m[0]; if (isInside && prev.type === 'brace') { prev.text = prev.text || ''; prev.text += val; } var node = pos(new Node({ type: 'text', multiplier: 1, match: m, val: val })); return concatNodes.call(this, pos, node, prev, options); }) /** * Open */ .set('brace.open', function() { var pos = this.position(); var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); if (!m) return; var prev = this.prev(); var last = utils.last(prev.nodes); // if the last parsed character was an extglob character // we need to _not optimize_ the brace pattern because // it might be mistaken for an extglob by a downstream parser if (last && last.val && isExtglobChar(last.val.slice(-1))) { last.optimize = false; } var open = pos(new Node({ type: 'brace.open', val: m[0] })); var node = pos(new Node({ type: 'brace', nodes: [] })); node.push(open); prev.push(node); this.push('brace', node); }) /** * Close */ .set('brace.close', function() { var pos = this.position(); var m = this.match(/^\}/); if (!m || !m[0]) return; var brace = this.pop('brace'); var node = pos(new Node({ type: 'brace.close', val: m[0] })); if (!this.isType(brace, 'brace')) { if (this.options.strict) { throw new Error('missing opening "{"'); } node.type = 'text'; node.multiplier = 0; node.escaped = true; return node; } var prev = this.prev(); var last = utils.last(prev.nodes); if (last.text) { var lastNode = utils.last(last.nodes); if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) { var open = last.nodes[0]; var text = last.nodes[1]; if (open.type === 'brace.open' && text && text.type === 'text') { text.optimize = false; } } } if (brace.nodes.length > 2) { var first = brace.nodes[1]; if (first.type === 'text' && first.val === ',') { brace.nodes.splice(1, 1); brace.nodes.push(first); } } brace.push(node); }) /** * Capture boundary characters */ .set('boundary', function() { var pos = this.position(); var m = this.match(/^[$^](?!\{)/); if (!m) return; return pos(new Node({ type: 'text', val: m[0] })); }) /** * One or zero, non-comma characters wrapped in braces */ .set('nobrace', function() { var isInside = this.isInside('brace'); var pos = this.position(); var m = this.match(/^\{[^,]?\}/); if (!m) return; var prev = this.prev(); var val = m[0]; if (isInside && prev.type === 'brace') { prev.text = prev.text || ''; prev.text += val; } return pos(new Node({ type: 'text', multiplier: 0, val: val })); }) /** * Text */ .set('text', function() { var isInside = this.isInside('brace'); var pos = this.position(); var m = this.match(/^((?!\\)[^${}[\]])+/); if (!m) return; var prev = this.prev(); var val = m[0]; if (isInside && prev.type === 'brace') { prev.text = prev.text || ''; prev.text += val; } var node = pos(new Node({ type: 'text', multiplier: 1, val: val })); return concatNodes.call(this, pos, node, prev, options); }); }; /** * Returns true if the character is an extglob character. */ function isExtglobChar(ch) { return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+'; } /** * Combine text nodes, and calculate empty sets (`{,,}`) * @param {Function} `pos` Function to calculate node position * @param {Object} `node` AST node * @return {Object} */ function concatNodes(pos, node, parent, options) { node.orig = node.val; var prev = this.prev(); var last = utils.last(prev.nodes); var isEscaped = false; if (node.val.length > 1) { var a = node.val.charAt(0); var b = node.val.slice(-1); isEscaped = (a === '"' && b === '"') || (a === "'" && b === "'") || (a === '`' && b === '`'); } if (isEscaped && options.unescape !== false) { node.val = node.val.slice(1, node.val.length - 1); node.escaped = true; } if (node.match) { var match = node.match[1]; if (!match || match.indexOf('}') === -1) { match = node.match[0]; } // replace each set with a single "," var val = match.replace(/\{/g, ',').replace(/\}/g, ''); node.multiplier *= val.length; node.val = ''; } var simpleText = last.type === 'text' && last.multiplier === 1 && node.multiplier === 1 && node.val; if (simpleText) { last.val += node.val; return; } prev.push(node); }