VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
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/keeview_app/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/keeview_app/html/parser.js
if (function () {
    var parser = {};

    parser.newInstance = function () {
        var rv = {};
        var host = {
            preprocess: [],
            rules: [],
            charnodes: {},
            nodes: {}
        };
        host.addRule = function (host) {
            return function (rule) {
                var st, t, tc, ch, i, j, m, n, s, x = [];
                var node;
                if (rule === undefined) return false;
                if (rule === null) return false;
                if (rule.source === undefined) return false;
                if (rule.content === undefined) return false;
                if (host.nodes[rule.source] === undefined) {
                    host.nodes[rule.source] = {
                        available: [],
                        target: []
                    };
                }
                host.nodes[rule.source].target.push(host.rules.length);
                t = {
                    source: rule.source
                };
                if (rule.safe !== undefined) t.safe = rule.safe; else t.safe = false;
                if (rule.safe0 !== undefined) t.safe0 = rule.safe0; else t.safe0 = false;
                if (rule.safe1 !== undefined) t.safe1 = rule.safe1; else t.safe1 = false;
                if (rule.safe2 !== undefined) t.safe2 = rule.safe2; else t.safe2 = false;
                if (rule.priority !== undefined) t.priority = rule.priority; else t.priority = 0;
                if (rule.compile !== undefined) t.compile = rule.compile;
                n = rule.content.length;
                for (i = tc = 0; i < n; i++) {
                    if (rule.content[i].substr(0, 1) != " ") {
                        x.push({
                            type: "node",
                            content: rule.content[i]
                        });
                    }
                    else {
                        x.push({
                            type: "text",
                            content: rule.content[i].substr(1)
                        });
                        node = host.charnodes;
                        for (j = rule.content[i].length - 1; j > 0; j--) {
                            ch = rule.content[i].substr(j, 1);
                            if (node[ch] === undefined) node[ch] = {};
                            node = node[ch];
                        }
                        node.value = true;
                    }
                    if (host.nodes[rule.content[i]] === undefined) {
                        host.nodes[rule.content[i]] = {
                            available: [],
                            target: []
                        };
                    }
                    host.nodes[rule.content[i]].available.push({
                        index: host.rules.length,
                        pos: i
                    });
                }
                t.content = x;
                host.rules.push(t);
                return true;
            }
        } (host);
        rv.addRule = function (host) {
            return function (rule) {
                var st, t, i, n;
                if (rule === undefined) return false;
                if (rule === null) return false;
                if (rule.contents !== undefined) {
                    t = true;
                    n = rule.contents.length;
                    for (i = 0; i < n; i++) {
                        rule.content = rule.contents[i];
                        t &&= host.addRule(rule);
                    }
                    return t;
                }
                return host.addRule(rule);
            }
        } (host);
        rv.addPreprocess = function (host) {
            return function (func) {
                host.preprocess.push(func);
            }
        } (host);
        rv.build = function (host) {
            return function () {
                var newhost = {
                    preprocess: [],
                    rules: [],
                    charnodes: EncodingClass.string.duplicate(host.charnodes),
                    nodes: EncodingClass.string.duplicate(host.nodes)
                };
                var i;
                for (i = 0; i < host.preprocess.length; i++) {
                    newhost.preprocess.push(host.preprocess[i]);
                }
                for (i = 0; i < host.rules.length; i++) {
                    newhost.rules.push(host.rules[i]);
                }
                newhost.goUp = function (host) {
                    return function (tree, index) {
                        var n, node;
                        while (index > 0) {
                            n = ((index + 1) >> 1) - 1;
                            if (tree[n].length <= tree[index].length) break;
                            node = tree[n];
                            tree[n] = tree[index];
                            tree[index] = node;
                            index = n;
                        }
                    }
                } (newhost);
                newhost.goDown = function (host) {
                    return function (tree, index) {
                        var node, li;
                        while (true) {
                            li = (index << 1) + 1;
                            if (tree.length <= li) break;
                            if (tree.length > li + 1) {
                                if (tree[li].length > tree[li + 1].length) li++;
                            }
                            if (tree[index].length > tree[li].length) {
                                node = tree[index];
                                tree[index] = tree[li];
                                tree[li] = node;
                                index = li;
                            }
                            else {
                                break;
                            }
                        }
                    }
                } (newhost);
                newhost.addTreeNode = function (host) {
                    return function (tree, node) {
                        tree.push(node);
                        host.goUp(tree, tree.length - 1);
                    }
                } (newhost);
                newhost.getTreeNode = function (host) {
                    return function (tree) {
                        var rv;
                        if (tree.length == 1) return tree.pop();
                        rv = tree[0];
                        tree[0] = tree.pop();
                        host.goDown(tree, 0);
                        return rv;
                    }
                } (newhost);
                newhost.setSymbol = function (host) {
                    return function (htree, content, symbol, index, tlength) {
                        var prevpos = index - tlength;
                        var rindex, rpos, isnew, xlength, source;
                        var j, k, m, p, t;
                        if (host.nodes[symbol] === undefined) return;
                        m = host.nodes[symbol].available.length;
                        for (j = 0; j < m; j++) {
                            rindex = host.nodes[symbol].available[j].index;
                            rpos = host.nodes[symbol].available[j].pos;
                            source = host.rules[rindex].source;
                            if (rpos > 0) {
                                if (prevpos < 0) continue;
                                if (content[prevpos].part[rindex] === undefined) continue;
                                if (content[prevpos].part[rindex][rpos - 1] === undefined) continue;
                            }
                            if (content[index].part[rindex] === undefined) content[index].part[rindex] = {};
                            if (content[index].part[rindex][rpos] === undefined) content[index].part[rindex][rpos] = [];
                            if (rpos > 0) {
                                p = content[prevpos].part[rindex][rpos - 1].length;
                                for (k = 0; k < p; k++) {
                                    xlength = content[prevpos].part[rindex][rpos - 1][k].length + tlength;
                                    content[index].part[rindex][rpos].push({
                                        length: xlength,
                                        lastlength: tlength
                                    });
                                    if (rpos == host.rules[rindex].content.length - 1) {
                                        isnew = true;
                                        if (content[index].fmark[source] !== undefined) {
                                            if (content[index].fmark[source][xlength] !== undefined) {
                                                isnew = false;
                                                if (content[index].fmark[source][xlength].priority < host.rules[rindex].priority) {
                                                    content[index].fmark[source][xlength].priority = host.rules[rindex].priority;
                                                    content[index].finished[source][content[index].fmark[source][xlength].index] = {
                                                        rule: rindex,
                                                        length: xlength,
                                                        lastlength: tlength
                                                    };
                                                }
                                            }
                                        }
                                        if (isnew) {
                                            if (content[index].fmark[source] === undefined) content[index].fmark[source] = {};
                                            if (content[index].finished[source] === undefined) content[index].finished[source] = [];
                                            content[index].fmark[source][xlength] = {
                                                priority: host.rules[rindex].priority,
                                                index: content[index].finished[source].length
                                            };
                                            content[index].finished[source].push({
                                                rule: rindex,
                                                length: xlength,
                                                lastlength: tlength
                                            });
                                            host.addTreeNode(htree, {
                                                symbol: source,
                                                rule: rindex,
                                                length: xlength,
                                                lastlength: tlength
                                            });
                                        }
                                    }
                                }
                            }
                            else {
                                xlength = tlength;
                                content[index].part[rindex][rpos].push({
                                    length: xlength,
                                    lastlength: tlength
                                });
                                if (host.rules[rindex].content.length == 1) {
                                    isnew = true;
                                    if (content[index].fmark[source] !== undefined) {
                                        if (content[index].fmark[source][xlength] !== undefined) {
                                            isnew = false;
                                            if (content[index].fmark[source][xlength].priority < host.rules[rindex].priority) {
                                                content[index].fmark[source][xlength].priority = host.rules[rindex].priority;
                                                content[index].finished[source][content[index].fmark[source][xlength].index] = {
                                                    rule: rindex,
                                                    length: xlength,
                                                    lastlength: tlength
                                                };
                                            }
                                        }
                                    }
                                    if (isnew) {
                                        if (content[index].fmark[source] === undefined) content[index].fmark[source] = {};
                                        if (content[index].finished[source] === undefined) content[index].finished[source] = [];
                                        content[index].fmark[source][xlength] = {
                                            priority: host.rules[rindex].priority,
                                            index: content[index].finished[source].length
                                        };
                                        content[index].finished[source].push({
                                            rule: rindex,
                                            length: xlength,
                                            lastlength: tlength
                                        });
                                        host.addTreeNode(htree, {
                                            symbol: source,
                                            rule: rindex,
                                            length: xlength,
                                            lastlength: tlength
                                        });
                                    }
                                }
                            }
                        }
                    }
                } (newhost);
                newhost.findRuleIndex = function (host) {
                    return function (content, source, position, length) {
                        var findex, rindex;
                        findex = content[position].fmark[source][length].index;
                        rindex = content[position].finished[source][findex].rule;
                        return rindex;
                    }
                } (newhost);
                newhost.compile = function (host) {
                    return function (content, source, index, xlength) {
                        var r = [], xr = [];
                        var tlength, nlength, source, rindex, findex;
                        var i, j, k, v, m, stext = "";
                        rindex = host.findRuleIndex(content, source, index, xlength);
                        for (i = host.rules[rindex].content.length - 1; i >= 0; i--) {
                            m = content[index].part[rindex][i].length;
                            k = -1;
                            for (j = 0; j < m; j++) {
                                if (content[index].part[rindex][i][j].length == xlength) {
                                    k = j;
                                    break;
                                }
                            }
                            tlength = content[index].part[rindex][i][k].lastlength;
                            v = {
                                index: index,
                                source: host.rules[rindex].content[i].content,
                                length: tlength
                            };
                            r.unshift(v);
                            xlength -= tlength;
                            index -= tlength;
                        }
                        for (i = 0; i < r.length; i++) {
                            if (host.rules[rindex].content[i].type == "text") {
                                r[i] = {
                                    name: "",
                                    text: host.rules[rindex].content[i].content,
                                    children: []
                                }
                            }
                            else if ((content[r[i].index].compiled !== undefined) && (content[r[i].index].type == "symbol") && (content[r[i].index].content == r[i].source) && (r[i].length == 1)) {
                                r[i] = content[r[i].index].compiled;
                            }
                            else {
                                r[i] = host.compile(content, r[i].source, r[i].index, r[i].length);
                            }
                            if (r[i].text !== undefined) stext += r[i].text;
                        }
                        m = {
                            name: source,
                            text: stext,
                            children: r
                        }
                        if (host.rules[rindex].compile !== undefined) {
                            r = host.rules[rindex].compile(r);
                        }
                        else {
                            r = undefined;
                        }
                        if (r !== undefined) return r;
                        return m;
                    }
                } (newhost);
                var f = function (host) {
                    console.log(host);
                    return function (content) {
                        var i, j, k, m, n, p, t = [], htree, node;
                        var ch, rindex, rpos, tlength, prevpos, safenode, safenode0, safenode1, safenode2;
                        var safeleft, saferight;
                        n = content.length;
                        for (i = 0; i < n; i++) {
                            t.push({
                                type: "char",
                                content: content.substr(i, 1),
                                start: i,
                                end: i + 1
                            });
                        }
                        content = t;
                        n = host.preprocess.length;
                        for (i = 0; i < n; i++) {
                            content = host.preprocess[i](content);
                        }
                        t = [];
                        n = content.length;
                        if (n == 0) return null;
                        for (i = 0; i < n; i++) {
                            content[i].finished = {};
                            content[i].part = {};
                            content[i].fmark = {};
                        }
                        for (i = 0; i < content.length; i++) {
                            htree = [];
                            switch (content[i].type) {
                                case "char":
                                    ch = "";
                                    node = host.charnodes;
                                    for (j = i; j >= 0; j--) {
                                        if (content[j].type != "char") break;
                                        if (node[content[j].content] === undefined) break;
                                        node = node[content[j].content];
                                        ch = content[j].content + ch;
                                        if ((host.nodes[" " + ch] !== undefined) && (node.value !== undefined)) {
                                            host.setSymbol(htree, content, " " + ch, i, i - j + 1);
                                        }
                                    }
                                    break;
                                case "symbol":
                                    tlength = 1;
                                    ch = content[i].content;
                                    if (content[i].finished[ch] === undefined) content[i].finished[ch] = [];
                                    if (content[i].fmark[ch] === undefined) content[i].fmark[ch] = {};
                                    if (content[i].fmark[ch][1] === undefined) {
                                        content[i].fmark[ch][1] = {
                                            priority: 0,
                                            index: 0
                                        };
                                        content[i].finished[ch] = [{
                                            rule: -1,
                                            length: 1,
                                            lastlength: 1
                                        }];
                                    }
                                    host.setSymbol(htree, content, ch, i, tlength);
                                    break;
                            }
                            safenode = null;
                            safenode0 = null;
                            safenode1 = null;
                            safenode2 = null;
                            while (htree.length > 0) {
                                node = host.getTreeNode(htree);
                                if (host.rules[node.rule].safe) {
                                    if (safenode === null) {
                                        safenode = node;
                                    }
                                    else if (safenode.length < node.length) {
                                        safenode = node;
                                    }
                                }
                                if (host.rules[node.rule].safe0 && (node.length == i+1)) {
                                    safenode0 = node;
                                }
                                safeleft = false;
                                if (node.length == i+1) {
                                    safeleft = true;
                                }
                                else if (content[i - node.length].type == "symbol") {
                                    safeleft = true;
                                }
                                else if (content[i - node.length].type == "char") {
                                    if ((content[i - node.length].content == " ") ||
                                        (content[i - node.length].content == "\t") ||
                                        (content[i - node.length].content == "\r") ||
                                        (content[i - node.length].content == "\n")) {
                                            safeleft = true;
                                        }
                                }
                                saferight = false;
                                if (i == content.length - 1) {
                                    saferight = true;
                                }
                                else if (content[i + 1].type == "symbol") {
                                    saferight = true;
                                }
                                else if (content[i + 1].type == "char") {
                                    if ((content[i + 1].content == " ") ||
                                        (content[i + 1].content == "\t") ||
                                        (content[i + 1].content == "\r") ||
                                        (content[i + 1].content == "\n")) {
                                            saferight = true;
                                        }
                                }
                                if (host.rules[node.rule].safe1 && safeleft) {
                                    safenode1 = node;
                                }
                                if (host.rules[node.rule].safe2 && safeleft && saferight) {
                                    safenode2 = node;
                                }
                                host.setSymbol(htree, content, node.symbol, i, node.length);
                            }
                            if ((safenode1 === null) && (safenode2 !== null)) safenode1 = safenode2;
                            if ((safenode0 === null) && (safenode1 !== null)) safenode0 = safenode1;
                            if ((safenode === null) && (safenode0 !== null)) safenode = safenode0;
                            if (safenode !== null) {
                                content[i].compiled = host.compile(content, safenode.symbol, i, safenode.length);
                                k = i - safenode.length + 1;
                                content[k] = content[i];
                                content[k].type = "symbol";
                                content[k].content = safenode.symbol;
                                content[k].finished = {};
                                content[k].finished[safenode.symbol] = [{
                                    rule: safenode.rule,
                                    length: 1,
                                    lastlength: 1
                                }];
                                content[k].fmark = {};
                                content[k].fmark[safenode.symbol] = {"1": {
                                    priority: host.rules[safenode.rule].priority,
                                    index: 0
                                }};
                                content[k].part = {};
                                for (j = i + 1; j < content.length; j++) {
                                    content[k + j - i] = content[j];
                                }
                                m = content.length + k - i;
                                while (content.length > m) content.pop();
                                i = k - 1;
                            }
                        }
                        console.log(content);
                        n = content.length;
                        if (n == 0) return null;
                        if (content[n - 1].fmark.final === undefined) return null;
                        if (content[n - 1].fmark.final[n] === undefined) return null;
                        return host.compile(content, "final", n - 1, n);
                    }
                } (newhost);
                return f;
            }
        } (host);
        return Object.freeze(rv);
    }
    window.parserBuilder = Object.freeze(parser);

    return 0;
} () != 0) window = window;

VaKeR 2022