Projekt

Obecné

Profil

Stáhnout (148 KB) Statistiky
| Větev: | Tag: | Revize:
1
"no use strict";
2
!(function(window) {
3
if (typeof window.window != "undefined" && window.document)
4
    return;
5
if (window.require && window.define)
6
    return;
7

    
8
if (!window.console) {
9
    window.console = function() {
10
        var msgs = Array.prototype.slice.call(arguments, 0);
11
        postMessage({type: "log", data: msgs});
12
    };
13
    window.console.error =
14
    window.console.warn = 
15
    window.console.log =
16
    window.console.trace = window.console;
17
}
18
window.window = window;
19
window.ace = window;
20

    
21
window.onerror = function(message, file, line, col, err) {
22
    postMessage({type: "error", data: {
23
        message: message,
24
        data: err.data,
25
        file: file,
26
        line: line, 
27
        col: col,
28
        stack: err.stack
29
    }});
30
};
31

    
32
window.normalizeModule = function(parentId, moduleName) {
33
    // normalize plugin requires
34
    if (moduleName.indexOf("!") !== -1) {
35
        var chunks = moduleName.split("!");
36
        return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]);
37
    }
38
    // normalize relative requires
39
    if (moduleName.charAt(0) == ".") {
40
        var base = parentId.split("/").slice(0, -1).join("/");
41
        moduleName = (base ? base + "/" : "") + moduleName;
42
        
43
        while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
44
            var previous = moduleName;
45
            moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
46
        }
47
    }
48
    
49
    return moduleName;
50
};
51

    
52
window.require = function require(parentId, id) {
53
    if (!id) {
54
        id = parentId;
55
        parentId = null;
56
    }
57
    if (!id.charAt)
58
        throw new Error("worker.js require() accepts only (parentId, id) as arguments");
59

    
60
    id = window.normalizeModule(parentId, id);
61

    
62
    var module = window.require.modules[id];
63
    if (module) {
64
        if (!module.initialized) {
65
            module.initialized = true;
66
            module.exports = module.factory().exports;
67
        }
68
        return module.exports;
69
    }
70
   
71
    if (!window.require.tlns)
72
        return console.log("unable to load " + id);
73
    
74
    var path = resolveModuleId(id, window.require.tlns);
75
    if (path.slice(-3) != ".js") path += ".js";
76
    
77
    window.require.id = id;
78
    window.require.modules[id] = {}; // prevent infinite loop on broken modules
79
    importScripts(path);
80
    return window.require(parentId, id);
81
};
82
function resolveModuleId(id, paths) {
83
    var testPath = id, tail = "";
84
    while (testPath) {
85
        var alias = paths[testPath];
86
        if (typeof alias == "string") {
87
            return alias + tail;
88
        } else if (alias) {
89
            return  alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
90
        } else if (alias === false) {
91
            return "";
92
        }
93
        var i = testPath.lastIndexOf("/");
94
        if (i === -1) break;
95
        tail = testPath.substr(i) + tail;
96
        testPath = testPath.slice(0, i);
97
    }
98
    return id;
99
}
100
window.require.modules = {};
101
window.require.tlns = {};
102

    
103
window.define = function(id, deps, factory) {
104
    if (arguments.length == 2) {
105
        factory = deps;
106
        if (typeof id != "string") {
107
            deps = id;
108
            id = window.require.id;
109
        }
110
    } else if (arguments.length == 1) {
111
        factory = id;
112
        deps = [];
113
        id = window.require.id;
114
    }
115
    
116
    if (typeof factory != "function") {
117
        window.require.modules[id] = {
118
            exports: factory,
119
            initialized: true
120
        };
121
        return;
122
    }
123

    
124
    if (!deps.length)
125
        // If there is no dependencies, we inject "require", "exports" and
126
        // "module" as dependencies, to provide CommonJS compatibility.
127
        deps = ["require", "exports", "module"];
128

    
129
    var req = function(childId) {
130
        return window.require(id, childId);
131
    };
132

    
133
    window.require.modules[id] = {
134
        exports: {},
135
        factory: function() {
136
            var module = this;
137
            var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) {
138
                switch (dep) {
139
                    // Because "require", "exports" and "module" aren't actual
140
                    // dependencies, we must handle them seperately.
141
                    case "require": return req;
142
                    case "exports": return module.exports;
143
                    case "module":  return module;
144
                    // But for all other dependencies, we can just go ahead and
145
                    // require them.
146
                    default:        return req(dep);
147
                }
148
            }));
149
            if (returnExports)
150
                module.exports = returnExports;
151
            return module;
152
        }
153
    };
154
};
155
window.define.amd = {};
156
require.tlns = {};
157
window.initBaseUrls  = function initBaseUrls(topLevelNamespaces) {
158
    for (var i in topLevelNamespaces)
159
        require.tlns[i] = topLevelNamespaces[i];
160
};
161

    
162
window.initSender = function initSender() {
163

    
164
    var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter;
165
    var oop = window.require("ace/lib/oop");
166
    
167
    var Sender = function() {};
168
    
169
    (function() {
170
        
171
        oop.implement(this, EventEmitter);
172
                
173
        this.callback = function(data, callbackId) {
174
            postMessage({
175
                type: "call",
176
                id: callbackId,
177
                data: data
178
            });
179
        };
180
    
181
        this.emit = function(name, data) {
182
            postMessage({
183
                type: "event",
184
                name: name,
185
                data: data
186
            });
187
        };
188
        
189
    }).call(Sender.prototype);
190
    
191
    return new Sender();
192
};
193

    
194
var main = window.main = null;
195
var sender = window.sender = null;
196

    
197
window.onmessage = function(e) {
198
    var msg = e.data;
199
    if (msg.event && sender) {
200
        sender._signal(msg.event, msg.data);
201
    }
202
    else if (msg.command) {
203
        if (main[msg.command])
204
            main[msg.command].apply(main, msg.args);
205
        else if (window[msg.command])
206
            window[msg.command].apply(window, msg.args);
207
        else
208
            throw new Error("Unknown command:" + msg.command);
209
    }
210
    else if (msg.init) {
211
        window.initBaseUrls(msg.tlns);
212
        require("ace/lib/es5-shim");
213
        sender = window.sender = window.initSender();
214
        var clazz = require(msg.module)[msg.classname];
215
        main = window.main = new clazz(sender);
216
    }
217
};
218
})(this);
219

    
220
ace.define("ace/lib/oop",[], function(require, exports, module) {
221
"use strict";
222

    
223
exports.inherits = function(ctor, superCtor) {
224
    ctor.super_ = superCtor;
225
    ctor.prototype = Object.create(superCtor.prototype, {
226
        constructor: {
227
            value: ctor,
228
            enumerable: false,
229
            writable: true,
230
            configurable: true
231
        }
232
    });
233
};
234

    
235
exports.mixin = function(obj, mixin) {
236
    for (var key in mixin) {
237
        obj[key] = mixin[key];
238
    }
239
    return obj;
240
};
241

    
242
exports.implement = function(proto, mixin) {
243
    exports.mixin(proto, mixin);
244
};
245

    
246
});
247

    
248
ace.define("ace/range",[], function(require, exports, module) {
249
"use strict";
250
var comparePoints = function(p1, p2) {
251
    return p1.row - p2.row || p1.column - p2.column;
252
};
253
var Range = function(startRow, startColumn, endRow, endColumn) {
254
    this.start = {
255
        row: startRow,
256
        column: startColumn
257
    };
258

    
259
    this.end = {
260
        row: endRow,
261
        column: endColumn
262
    };
263
};
264

    
265
(function() {
266
    this.isEqual = function(range) {
267
        return this.start.row === range.start.row &&
268
            this.end.row === range.end.row &&
269
            this.start.column === range.start.column &&
270
            this.end.column === range.end.column;
271
    };
272
    this.toString = function() {
273
        return ("Range: [" + this.start.row + "/" + this.start.column +
274
            "] -> [" + this.end.row + "/" + this.end.column + "]");
275
    };
276

    
277
    this.contains = function(row, column) {
278
        return this.compare(row, column) == 0;
279
    };
280
    this.compareRange = function(range) {
281
        var cmp,
282
            end = range.end,
283
            start = range.start;
284

    
285
        cmp = this.compare(end.row, end.column);
286
        if (cmp == 1) {
287
            cmp = this.compare(start.row, start.column);
288
            if (cmp == 1) {
289
                return 2;
290
            } else if (cmp == 0) {
291
                return 1;
292
            } else {
293
                return 0;
294
            }
295
        } else if (cmp == -1) {
296
            return -2;
297
        } else {
298
            cmp = this.compare(start.row, start.column);
299
            if (cmp == -1) {
300
                return -1;
301
            } else if (cmp == 1) {
302
                return 42;
303
            } else {
304
                return 0;
305
            }
306
        }
307
    };
308
    this.comparePoint = function(p) {
309
        return this.compare(p.row, p.column);
310
    };
311
    this.containsRange = function(range) {
312
        return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
313
    };
314
    this.intersects = function(range) {
315
        var cmp = this.compareRange(range);
316
        return (cmp == -1 || cmp == 0 || cmp == 1);
317
    };
318
    this.isEnd = function(row, column) {
319
        return this.end.row == row && this.end.column == column;
320
    };
321
    this.isStart = function(row, column) {
322
        return this.start.row == row && this.start.column == column;
323
    };
324
    this.setStart = function(row, column) {
325
        if (typeof row == "object") {
326
            this.start.column = row.column;
327
            this.start.row = row.row;
328
        } else {
329
            this.start.row = row;
330
            this.start.column = column;
331
        }
332
    };
333
    this.setEnd = function(row, column) {
334
        if (typeof row == "object") {
335
            this.end.column = row.column;
336
            this.end.row = row.row;
337
        } else {
338
            this.end.row = row;
339
            this.end.column = column;
340
        }
341
    };
342
    this.inside = function(row, column) {
343
        if (this.compare(row, column) == 0) {
344
            if (this.isEnd(row, column) || this.isStart(row, column)) {
345
                return false;
346
            } else {
347
                return true;
348
            }
349
        }
350
        return false;
351
    };
352
    this.insideStart = function(row, column) {
353
        if (this.compare(row, column) == 0) {
354
            if (this.isEnd(row, column)) {
355
                return false;
356
            } else {
357
                return true;
358
            }
359
        }
360
        return false;
361
    };
362
    this.insideEnd = function(row, column) {
363
        if (this.compare(row, column) == 0) {
364
            if (this.isStart(row, column)) {
365
                return false;
366
            } else {
367
                return true;
368
            }
369
        }
370
        return false;
371
    };
372
    this.compare = function(row, column) {
373
        if (!this.isMultiLine()) {
374
            if (row === this.start.row) {
375
                return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
376
            }
377
        }
378

    
379
        if (row < this.start.row)
380
            return -1;
381

    
382
        if (row > this.end.row)
383
            return 1;
384

    
385
        if (this.start.row === row)
386
            return column >= this.start.column ? 0 : -1;
387

    
388
        if (this.end.row === row)
389
            return column <= this.end.column ? 0 : 1;
390

    
391
        return 0;
392
    };
393
    this.compareStart = function(row, column) {
394
        if (this.start.row == row && this.start.column == column) {
395
            return -1;
396
        } else {
397
            return this.compare(row, column);
398
        }
399
    };
400
    this.compareEnd = function(row, column) {
401
        if (this.end.row == row && this.end.column == column) {
402
            return 1;
403
        } else {
404
            return this.compare(row, column);
405
        }
406
    };
407
    this.compareInside = function(row, column) {
408
        if (this.end.row == row && this.end.column == column) {
409
            return 1;
410
        } else if (this.start.row == row && this.start.column == column) {
411
            return -1;
412
        } else {
413
            return this.compare(row, column);
414
        }
415
    };
416
    this.clipRows = function(firstRow, lastRow) {
417
        if (this.end.row > lastRow)
418
            var end = {row: lastRow + 1, column: 0};
419
        else if (this.end.row < firstRow)
420
            var end = {row: firstRow, column: 0};
421

    
422
        if (this.start.row > lastRow)
423
            var start = {row: lastRow + 1, column: 0};
424
        else if (this.start.row < firstRow)
425
            var start = {row: firstRow, column: 0};
426

    
427
        return Range.fromPoints(start || this.start, end || this.end);
428
    };
429
    this.extend = function(row, column) {
430
        var cmp = this.compare(row, column);
431

    
432
        if (cmp == 0)
433
            return this;
434
        else if (cmp == -1)
435
            var start = {row: row, column: column};
436
        else
437
            var end = {row: row, column: column};
438

    
439
        return Range.fromPoints(start || this.start, end || this.end);
440
    };
441

    
442
    this.isEmpty = function() {
443
        return (this.start.row === this.end.row && this.start.column === this.end.column);
444
    };
445
    this.isMultiLine = function() {
446
        return (this.start.row !== this.end.row);
447
    };
448
    this.clone = function() {
449
        return Range.fromPoints(this.start, this.end);
450
    };
451
    this.collapseRows = function() {
452
        if (this.end.column == 0)
453
            return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);
454
        else
455
            return new Range(this.start.row, 0, this.end.row, 0);
456
    };
457
    this.toScreenRange = function(session) {
458
        var screenPosStart = session.documentToScreenPosition(this.start);
459
        var screenPosEnd = session.documentToScreenPosition(this.end);
460

    
461
        return new Range(
462
            screenPosStart.row, screenPosStart.column,
463
            screenPosEnd.row, screenPosEnd.column
464
        );
465
    };
466
    this.moveBy = function(row, column) {
467
        this.start.row += row;
468
        this.start.column += column;
469
        this.end.row += row;
470
        this.end.column += column;
471
    };
472

    
473
}).call(Range.prototype);
474
Range.fromPoints = function(start, end) {
475
    return new Range(start.row, start.column, end.row, end.column);
476
};
477
Range.comparePoints = comparePoints;
478

    
479
Range.comparePoints = function(p1, p2) {
480
    return p1.row - p2.row || p1.column - p2.column;
481
};
482

    
483

    
484
exports.Range = Range;
485
});
486

    
487
ace.define("ace/apply_delta",[], function(require, exports, module) {
488
"use strict";
489

    
490
function throwDeltaError(delta, errorText){
491
    console.log("Invalid Delta:", delta);
492
    throw "Invalid Delta: " + errorText;
493
}
494

    
495
function positionInDocument(docLines, position) {
496
    return position.row    >= 0 && position.row    <  docLines.length &&
497
           position.column >= 0 && position.column <= docLines[position.row].length;
498
}
499

    
500
function validateDelta(docLines, delta) {
501
    if (delta.action != "insert" && delta.action != "remove")
502
        throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
503
    if (!(delta.lines instanceof Array))
504
        throwDeltaError(delta, "delta.lines must be an Array");
505
    if (!delta.start || !delta.end)
506
       throwDeltaError(delta, "delta.start/end must be an present");
507
    var start = delta.start;
508
    if (!positionInDocument(docLines, delta.start))
509
        throwDeltaError(delta, "delta.start must be contained in document");
510
    var end = delta.end;
511
    if (delta.action == "remove" && !positionInDocument(docLines, end))
512
        throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
513
    var numRangeRows = end.row - start.row;
514
    var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
515
    if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
516
        throwDeltaError(delta, "delta.range must match delta lines");
517
}
518

    
519
exports.applyDelta = function(docLines, delta, doNotValidate) {
520
    
521
    var row = delta.start.row;
522
    var startColumn = delta.start.column;
523
    var line = docLines[row] || "";
524
    switch (delta.action) {
525
        case "insert":
526
            var lines = delta.lines;
527
            if (lines.length === 1) {
528
                docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
529
            } else {
530
                var args = [row, 1].concat(delta.lines);
531
                docLines.splice.apply(docLines, args);
532
                docLines[row] = line.substring(0, startColumn) + docLines[row];
533
                docLines[row + delta.lines.length - 1] += line.substring(startColumn);
534
            }
535
            break;
536
        case "remove":
537
            var endColumn = delta.end.column;
538
            var endRow = delta.end.row;
539
            if (row === endRow) {
540
                docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
541
            } else {
542
                docLines.splice(
543
                    row, endRow - row + 1,
544
                    line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
545
                );
546
            }
547
            break;
548
    }
549
};
550
});
551

    
552
ace.define("ace/lib/event_emitter",[], function(require, exports, module) {
553
"use strict";
554

    
555
var EventEmitter = {};
556
var stopPropagation = function() { this.propagationStopped = true; };
557
var preventDefault = function() { this.defaultPrevented = true; };
558

    
559
EventEmitter._emit =
560
EventEmitter._dispatchEvent = function(eventName, e) {
561
    this._eventRegistry || (this._eventRegistry = {});
562
    this._defaultHandlers || (this._defaultHandlers = {});
563

    
564
    var listeners = this._eventRegistry[eventName] || [];
565
    var defaultHandler = this._defaultHandlers[eventName];
566
    if (!listeners.length && !defaultHandler)
567
        return;
568

    
569
    if (typeof e != "object" || !e)
570
        e = {};
571

    
572
    if (!e.type)
573
        e.type = eventName;
574
    if (!e.stopPropagation)
575
        e.stopPropagation = stopPropagation;
576
    if (!e.preventDefault)
577
        e.preventDefault = preventDefault;
578

    
579
    listeners = listeners.slice();
580
    for (var i=0; i<listeners.length; i++) {
581
        listeners[i](e, this);
582
        if (e.propagationStopped)
583
            break;
584
    }
585
    
586
    if (defaultHandler && !e.defaultPrevented)
587
        return defaultHandler(e, this);
588
};
589

    
590

    
591
EventEmitter._signal = function(eventName, e) {
592
    var listeners = (this._eventRegistry || {})[eventName];
593
    if (!listeners)
594
        return;
595
    listeners = listeners.slice();
596
    for (var i=0; i<listeners.length; i++)
597
        listeners[i](e, this);
598
};
599

    
600
EventEmitter.once = function(eventName, callback) {
601
    var _self = this;
602
    this.on(eventName, function newCallback() {
603
        _self.off(eventName, newCallback);
604
        callback.apply(null, arguments);
605
    });
606
    if (!callback) {
607
        return new Promise(function(resolve) {
608
            callback = resolve;
609
        });
610
    }
611
};
612

    
613

    
614
EventEmitter.setDefaultHandler = function(eventName, callback) {
615
    var handlers = this._defaultHandlers;
616
    if (!handlers)
617
        handlers = this._defaultHandlers = {_disabled_: {}};
618
    
619
    if (handlers[eventName]) {
620
        var old = handlers[eventName];
621
        var disabled = handlers._disabled_[eventName];
622
        if (!disabled)
623
            handlers._disabled_[eventName] = disabled = [];
624
        disabled.push(old);
625
        var i = disabled.indexOf(callback);
626
        if (i != -1) 
627
            disabled.splice(i, 1);
628
    }
629
    handlers[eventName] = callback;
630
};
631
EventEmitter.removeDefaultHandler = function(eventName, callback) {
632
    var handlers = this._defaultHandlers;
633
    if (!handlers)
634
        return;
635
    var disabled = handlers._disabled_[eventName];
636
    
637
    if (handlers[eventName] == callback) {
638
        if (disabled)
639
            this.setDefaultHandler(eventName, disabled.pop());
640
    } else if (disabled) {
641
        var i = disabled.indexOf(callback);
642
        if (i != -1)
643
            disabled.splice(i, 1);
644
    }
645
};
646

    
647
EventEmitter.on =
648
EventEmitter.addEventListener = function(eventName, callback, capturing) {
649
    this._eventRegistry = this._eventRegistry || {};
650

    
651
    var listeners = this._eventRegistry[eventName];
652
    if (!listeners)
653
        listeners = this._eventRegistry[eventName] = [];
654

    
655
    if (listeners.indexOf(callback) == -1)
656
        listeners[capturing ? "unshift" : "push"](callback);
657
    return callback;
658
};
659

    
660
EventEmitter.off =
661
EventEmitter.removeListener =
662
EventEmitter.removeEventListener = function(eventName, callback) {
663
    this._eventRegistry = this._eventRegistry || {};
664

    
665
    var listeners = this._eventRegistry[eventName];
666
    if (!listeners)
667
        return;
668

    
669
    var index = listeners.indexOf(callback);
670
    if (index !== -1)
671
        listeners.splice(index, 1);
672
};
673

    
674
EventEmitter.removeAllListeners = function(eventName) {
675
    if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
676
    if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
677
    if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
678
};
679

    
680
exports.EventEmitter = EventEmitter;
681

    
682
});
683

    
684
ace.define("ace/anchor",[], function(require, exports, module) {
685
"use strict";
686

    
687
var oop = require("./lib/oop");
688
var EventEmitter = require("./lib/event_emitter").EventEmitter;
689

    
690
var Anchor = exports.Anchor = function(doc, row, column) {
691
    this.$onChange = this.onChange.bind(this);
692
    this.attach(doc);
693
    
694
    if (typeof column == "undefined")
695
        this.setPosition(row.row, row.column);
696
    else
697
        this.setPosition(row, column);
698
};
699

    
700
(function() {
701

    
702
    oop.implement(this, EventEmitter);
703
    this.getPosition = function() {
704
        return this.$clipPositionToDocument(this.row, this.column);
705
    };
706
    this.getDocument = function() {
707
        return this.document;
708
    };
709
    this.$insertRight = false;
710
    this.onChange = function(delta) {
711
        if (delta.start.row == delta.end.row && delta.start.row != this.row)
712
            return;
713

    
714
        if (delta.start.row > this.row)
715
            return;
716
            
717
        var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
718
        this.setPosition(point.row, point.column, true);
719
    };
720
    
721
    function $pointsInOrder(point1, point2, equalPointsInOrder) {
722
        var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
723
        return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
724
    }
725
            
726
    function $getTransformedPoint(delta, point, moveIfEqual) {
727
        var deltaIsInsert = delta.action == "insert";
728
        var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row    - delta.start.row);
729
        var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
730
        var deltaStart = delta.start;
731
        var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
732
        if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
733
            return {
734
                row: point.row,
735
                column: point.column
736
            };
737
        }
738
        if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
739
            return {
740
                row: point.row + deltaRowShift,
741
                column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
742
            };
743
        }
744
        
745
        return {
746
            row: deltaStart.row,
747
            column: deltaStart.column
748
        };
749
    }
750
    this.setPosition = function(row, column, noClip) {
751
        var pos;
752
        if (noClip) {
753
            pos = {
754
                row: row,
755
                column: column
756
            };
757
        } else {
758
            pos = this.$clipPositionToDocument(row, column);
759
        }
760

    
761
        if (this.row == pos.row && this.column == pos.column)
762
            return;
763

    
764
        var old = {
765
            row: this.row,
766
            column: this.column
767
        };
768

    
769
        this.row = pos.row;
770
        this.column = pos.column;
771
        this._signal("change", {
772
            old: old,
773
            value: pos
774
        });
775
    };
776
    this.detach = function() {
777
        this.document.off("change", this.$onChange);
778
    };
779
    this.attach = function(doc) {
780
        this.document = doc || this.document;
781
        this.document.on("change", this.$onChange);
782
    };
783
    this.$clipPositionToDocument = function(row, column) {
784
        var pos = {};
785

    
786
        if (row >= this.document.getLength()) {
787
            pos.row = Math.max(0, this.document.getLength() - 1);
788
            pos.column = this.document.getLine(pos.row).length;
789
        }
790
        else if (row < 0) {
791
            pos.row = 0;
792
            pos.column = 0;
793
        }
794
        else {
795
            pos.row = row;
796
            pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
797
        }
798

    
799
        if (column < 0)
800
            pos.column = 0;
801

    
802
        return pos;
803
    };
804

    
805
}).call(Anchor.prototype);
806

    
807
});
808

    
809
ace.define("ace/document",[], function(require, exports, module) {
810
"use strict";
811

    
812
var oop = require("./lib/oop");
813
var applyDelta = require("./apply_delta").applyDelta;
814
var EventEmitter = require("./lib/event_emitter").EventEmitter;
815
var Range = require("./range").Range;
816
var Anchor = require("./anchor").Anchor;
817

    
818
var Document = function(textOrLines) {
819
    this.$lines = [""];
820
    if (textOrLines.length === 0) {
821
        this.$lines = [""];
822
    } else if (Array.isArray(textOrLines)) {
823
        this.insertMergedLines({row: 0, column: 0}, textOrLines);
824
    } else {
825
        this.insert({row: 0, column:0}, textOrLines);
826
    }
827
};
828

    
829
(function() {
830

    
831
    oop.implement(this, EventEmitter);
832
    this.setValue = function(text) {
833
        var len = this.getLength() - 1;
834
        this.remove(new Range(0, 0, len, this.getLine(len).length));
835
        this.insert({row: 0, column: 0}, text);
836
    };
837
    this.getValue = function() {
838
        return this.getAllLines().join(this.getNewLineCharacter());
839
    };
840
    this.createAnchor = function(row, column) {
841
        return new Anchor(this, row, column);
842
    };
843
    if ("aaa".split(/a/).length === 0) {
844
        this.$split = function(text) {
845
            return text.replace(/\r\n|\r/g, "\n").split("\n");
846
        };
847
    } else {
848
        this.$split = function(text) {
849
            return text.split(/\r\n|\r|\n/);
850
        };
851
    }
852

    
853

    
854
    this.$detectNewLine = function(text) {
855
        var match = text.match(/^.*?(\r\n|\r|\n)/m);
856
        this.$autoNewLine = match ? match[1] : "\n";
857
        this._signal("changeNewLineMode");
858
    };
859
    this.getNewLineCharacter = function() {
860
        switch (this.$newLineMode) {
861
          case "windows":
862
            return "\r\n";
863
          case "unix":
864
            return "\n";
865
          default:
866
            return this.$autoNewLine || "\n";
867
        }
868
    };
869

    
870
    this.$autoNewLine = "";
871
    this.$newLineMode = "auto";
872
    this.setNewLineMode = function(newLineMode) {
873
        if (this.$newLineMode === newLineMode)
874
            return;
875

    
876
        this.$newLineMode = newLineMode;
877
        this._signal("changeNewLineMode");
878
    };
879
    this.getNewLineMode = function() {
880
        return this.$newLineMode;
881
    };
882
    this.isNewLine = function(text) {
883
        return (text == "\r\n" || text == "\r" || text == "\n");
884
    };
885
    this.getLine = function(row) {
886
        return this.$lines[row] || "";
887
    };
888
    this.getLines = function(firstRow, lastRow) {
889
        return this.$lines.slice(firstRow, lastRow + 1);
890
    };
891
    this.getAllLines = function() {
892
        return this.getLines(0, this.getLength());
893
    };
894
    this.getLength = function() {
895
        return this.$lines.length;
896
    };
897
    this.getTextRange = function(range) {
898
        return this.getLinesForRange(range).join(this.getNewLineCharacter());
899
    };
900
    this.getLinesForRange = function(range) {
901
        var lines;
902
        if (range.start.row === range.end.row) {
903
            lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
904
        } else {
905
            lines = this.getLines(range.start.row, range.end.row);
906
            lines[0] = (lines[0] || "").substring(range.start.column);
907
            var l = lines.length - 1;
908
            if (range.end.row - range.start.row == l)
909
                lines[l] = lines[l].substring(0, range.end.column);
910
        }
911
        return lines;
912
    };
913
    this.insertLines = function(row, lines) {
914
        console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
915
        return this.insertFullLines(row, lines);
916
    };
917
    this.removeLines = function(firstRow, lastRow) {
918
        console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
919
        return this.removeFullLines(firstRow, lastRow);
920
    };
921
    this.insertNewLine = function(position) {
922
        console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
923
        return this.insertMergedLines(position, ["", ""]);
924
    };
925
    this.insert = function(position, text) {
926
        if (this.getLength() <= 1)
927
            this.$detectNewLine(text);
928
        
929
        return this.insertMergedLines(position, this.$split(text));
930
    };
931
    this.insertInLine = function(position, text) {
932
        var start = this.clippedPos(position.row, position.column);
933
        var end = this.pos(position.row, position.column + text.length);
934
        
935
        this.applyDelta({
936
            start: start,
937
            end: end,
938
            action: "insert",
939
            lines: [text]
940
        }, true);
941
        
942
        return this.clonePos(end);
943
    };
944
    
945
    this.clippedPos = function(row, column) {
946
        var length = this.getLength();
947
        if (row === undefined) {
948
            row = length;
949
        } else if (row < 0) {
950
            row = 0;
951
        } else if (row >= length) {
952
            row = length - 1;
953
            column = undefined;
954
        }
955
        var line = this.getLine(row);
956
        if (column == undefined)
957
            column = line.length;
958
        column = Math.min(Math.max(column, 0), line.length);
959
        return {row: row, column: column};
960
    };
961
    
962
    this.clonePos = function(pos) {
963
        return {row: pos.row, column: pos.column};
964
    };
965
    
966
    this.pos = function(row, column) {
967
        return {row: row, column: column};
968
    };
969
    
970
    this.$clipPosition = function(position) {
971
        var length = this.getLength();
972
        if (position.row >= length) {
973
            position.row = Math.max(0, length - 1);
974
            position.column = this.getLine(length - 1).length;
975
        } else {
976
            position.row = Math.max(0, position.row);
977
            position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
978
        }
979
        return position;
980
    };
981
    this.insertFullLines = function(row, lines) {
982
        row = Math.min(Math.max(row, 0), this.getLength());
983
        var column = 0;
984
        if (row < this.getLength()) {
985
            lines = lines.concat([""]);
986
            column = 0;
987
        } else {
988
            lines = [""].concat(lines);
989
            row--;
990
            column = this.$lines[row].length;
991
        }
992
        this.insertMergedLines({row: row, column: column}, lines);
993
    };    
994
    this.insertMergedLines = function(position, lines) {
995
        var start = this.clippedPos(position.row, position.column);
996
        var end = {
997
            row: start.row + lines.length - 1,
998
            column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
999
        };
1000
        
1001
        this.applyDelta({
1002
            start: start,
1003
            end: end,
1004
            action: "insert",
1005
            lines: lines
1006
        });
1007
        
1008
        return this.clonePos(end);
1009
    };
1010
    this.remove = function(range) {
1011
        var start = this.clippedPos(range.start.row, range.start.column);
1012
        var end = this.clippedPos(range.end.row, range.end.column);
1013
        this.applyDelta({
1014
            start: start,
1015
            end: end,
1016
            action: "remove",
1017
            lines: this.getLinesForRange({start: start, end: end})
1018
        });
1019
        return this.clonePos(start);
1020
    };
1021
    this.removeInLine = function(row, startColumn, endColumn) {
1022
        var start = this.clippedPos(row, startColumn);
1023
        var end = this.clippedPos(row, endColumn);
1024
        
1025
        this.applyDelta({
1026
            start: start,
1027
            end: end,
1028
            action: "remove",
1029
            lines: this.getLinesForRange({start: start, end: end})
1030
        }, true);
1031
        
1032
        return this.clonePos(start);
1033
    };
1034
    this.removeFullLines = function(firstRow, lastRow) {
1035
        firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
1036
        lastRow  = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
1037
        var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
1038
        var deleteLastNewLine  = lastRow  < this.getLength() - 1;
1039
        var startRow = ( deleteFirstNewLine ? firstRow - 1                  : firstRow                    );
1040
        var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0                           );
1041
        var endRow   = ( deleteLastNewLine  ? lastRow + 1                   : lastRow                     );
1042
        var endCol   = ( deleteLastNewLine  ? 0                             : this.getLine(endRow).length ); 
1043
        var range = new Range(startRow, startCol, endRow, endCol);
1044
        var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
1045
        
1046
        this.applyDelta({
1047
            start: range.start,
1048
            end: range.end,
1049
            action: "remove",
1050
            lines: this.getLinesForRange(range)
1051
        });
1052
        return deletedLines;
1053
    };
1054
    this.removeNewLine = function(row) {
1055
        if (row < this.getLength() - 1 && row >= 0) {
1056
            this.applyDelta({
1057
                start: this.pos(row, this.getLine(row).length),
1058
                end: this.pos(row + 1, 0),
1059
                action: "remove",
1060
                lines: ["", ""]
1061
            });
1062
        }
1063
    };
1064
    this.replace = function(range, text) {
1065
        if (!(range instanceof Range))
1066
            range = Range.fromPoints(range.start, range.end);
1067
        if (text.length === 0 && range.isEmpty())
1068
            return range.start;
1069
        if (text == this.getTextRange(range))
1070
            return range.end;
1071

    
1072
        this.remove(range);
1073
        var end;
1074
        if (text) {
1075
            end = this.insert(range.start, text);
1076
        }
1077
        else {
1078
            end = range.start;
1079
        }
1080
        
1081
        return end;
1082
    };
1083
    this.applyDeltas = function(deltas) {
1084
        for (var i=0; i<deltas.length; i++) {
1085
            this.applyDelta(deltas[i]);
1086
        }
1087
    };
1088
    this.revertDeltas = function(deltas) {
1089
        for (var i=deltas.length-1; i>=0; i--) {
1090
            this.revertDelta(deltas[i]);
1091
        }
1092
    };
1093
    this.applyDelta = function(delta, doNotValidate) {
1094
        var isInsert = delta.action == "insert";
1095
        if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
1096
            : !Range.comparePoints(delta.start, delta.end)) {
1097
            return;
1098
        }
1099
        
1100
        if (isInsert && delta.lines.length > 20000) {
1101
            this.$splitAndapplyLargeDelta(delta, 20000);
1102
        }
1103
        else {
1104
            applyDelta(this.$lines, delta, doNotValidate);
1105
            this._signal("change", delta);
1106
        }
1107
    };
1108
    
1109
    this.$safeApplyDelta = function(delta) {
1110
        var docLength = this.$lines.length;
1111
        if (
1112
            delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
1113
            || delta.action == "insert" && delta.start.row <= docLength
1114
        ) {
1115
            this.applyDelta(delta);
1116
        }
1117
    };
1118
    
1119
    this.$splitAndapplyLargeDelta = function(delta, MAX) {
1120
        var lines = delta.lines;
1121
        var l = lines.length - MAX + 1;
1122
        var row = delta.start.row; 
1123
        var column = delta.start.column;
1124
        for (var from = 0, to = 0; from < l; from = to) {
1125
            to += MAX - 1;
1126
            var chunk = lines.slice(from, to);
1127
            chunk.push("");
1128
            this.applyDelta({
1129
                start: this.pos(row + from, column),
1130
                end: this.pos(row + to, column = 0),
1131
                action: delta.action,
1132
                lines: chunk
1133
            }, true);
1134
        }
1135
        delta.lines = lines.slice(from);
1136
        delta.start.row = row + from;
1137
        delta.start.column = column;
1138
        this.applyDelta(delta, true);
1139
    };
1140
    this.revertDelta = function(delta) {
1141
        this.$safeApplyDelta({
1142
            start: this.clonePos(delta.start),
1143
            end: this.clonePos(delta.end),
1144
            action: (delta.action == "insert" ? "remove" : "insert"),
1145
            lines: delta.lines.slice()
1146
        });
1147
    };
1148
    this.indexToPosition = function(index, startRow) {
1149
        var lines = this.$lines || this.getAllLines();
1150
        var newlineLength = this.getNewLineCharacter().length;
1151
        for (var i = startRow || 0, l = lines.length; i < l; i++) {
1152
            index -= lines[i].length + newlineLength;
1153
            if (index < 0)
1154
                return {row: i, column: index + lines[i].length + newlineLength};
1155
        }
1156
        return {row: l-1, column: index + lines[l-1].length + newlineLength};
1157
    };
1158
    this.positionToIndex = function(pos, startRow) {
1159
        var lines = this.$lines || this.getAllLines();
1160
        var newlineLength = this.getNewLineCharacter().length;
1161
        var index = 0;
1162
        var row = Math.min(pos.row, lines.length);
1163
        for (var i = startRow || 0; i < row; ++i)
1164
            index += lines[i].length + newlineLength;
1165

    
1166
        return index + pos.column;
1167
    };
1168

    
1169
}).call(Document.prototype);
1170

    
1171
exports.Document = Document;
1172
});
1173

    
1174
ace.define("ace/lib/lang",[], function(require, exports, module) {
1175
"use strict";
1176

    
1177
exports.last = function(a) {
1178
    return a[a.length - 1];
1179
};
1180

    
1181
exports.stringReverse = function(string) {
1182
    return string.split("").reverse().join("");
1183
};
1184

    
1185
exports.stringRepeat = function (string, count) {
1186
    var result = '';
1187
    while (count > 0) {
1188
        if (count & 1)
1189
            result += string;
1190

    
1191
        if (count >>= 1)
1192
            string += string;
1193
    }
1194
    return result;
1195
};
1196

    
1197
var trimBeginRegexp = /^\s\s*/;
1198
var trimEndRegexp = /\s\s*$/;
1199

    
1200
exports.stringTrimLeft = function (string) {
1201
    return string.replace(trimBeginRegexp, '');
1202
};
1203

    
1204
exports.stringTrimRight = function (string) {
1205
    return string.replace(trimEndRegexp, '');
1206
};
1207

    
1208
exports.copyObject = function(obj) {
1209
    var copy = {};
1210
    for (var key in obj) {
1211
        copy[key] = obj[key];
1212
    }
1213
    return copy;
1214
};
1215

    
1216
exports.copyArray = function(array){
1217
    var copy = [];
1218
    for (var i=0, l=array.length; i<l; i++) {
1219
        if (array[i] && typeof array[i] == "object")
1220
            copy[i] = this.copyObject(array[i]);
1221
        else 
1222
            copy[i] = array[i];
1223
    }
1224
    return copy;
1225
};
1226

    
1227
exports.deepCopy = function deepCopy(obj) {
1228
    if (typeof obj !== "object" || !obj)
1229
        return obj;
1230
    var copy;
1231
    if (Array.isArray(obj)) {
1232
        copy = [];
1233
        for (var key = 0; key < obj.length; key++) {
1234
            copy[key] = deepCopy(obj[key]);
1235
        }
1236
        return copy;
1237
    }
1238
    if (Object.prototype.toString.call(obj) !== "[object Object]")
1239
        return obj;
1240
    
1241
    copy = {};
1242
    for (var key in obj)
1243
        copy[key] = deepCopy(obj[key]);
1244
    return copy;
1245
};
1246

    
1247
exports.arrayToMap = function(arr) {
1248
    var map = {};
1249
    for (var i=0; i<arr.length; i++) {
1250
        map[arr[i]] = 1;
1251
    }
1252
    return map;
1253

    
1254
};
1255

    
1256
exports.createMap = function(props) {
1257
    var map = Object.create(null);
1258
    for (var i in props) {
1259
        map[i] = props[i];
1260
    }
1261
    return map;
1262
};
1263
exports.arrayRemove = function(array, value) {
1264
  for (var i = 0; i <= array.length; i++) {
1265
    if (value === array[i]) {
1266
      array.splice(i, 1);
1267
    }
1268
  }
1269
};
1270

    
1271
exports.escapeRegExp = function(str) {
1272
    return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1273
};
1274

    
1275
exports.escapeHTML = function(str) {
1276
    return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1277
};
1278

    
1279
exports.getMatchOffsets = function(string, regExp) {
1280
    var matches = [];
1281

    
1282
    string.replace(regExp, function(str) {
1283
        matches.push({
1284
            offset: arguments[arguments.length-2],
1285
            length: str.length
1286
        });
1287
    });
1288

    
1289
    return matches;
1290
};
1291
exports.deferredCall = function(fcn) {
1292
    var timer = null;
1293
    var callback = function() {
1294
        timer = null;
1295
        fcn();
1296
    };
1297

    
1298
    var deferred = function(timeout) {
1299
        deferred.cancel();
1300
        timer = setTimeout(callback, timeout || 0);
1301
        return deferred;
1302
    };
1303

    
1304
    deferred.schedule = deferred;
1305

    
1306
    deferred.call = function() {
1307
        this.cancel();
1308
        fcn();
1309
        return deferred;
1310
    };
1311

    
1312
    deferred.cancel = function() {
1313
        clearTimeout(timer);
1314
        timer = null;
1315
        return deferred;
1316
    };
1317
    
1318
    deferred.isPending = function() {
1319
        return timer;
1320
    };
1321

    
1322
    return deferred;
1323
};
1324

    
1325

    
1326
exports.delayedCall = function(fcn, defaultTimeout) {
1327
    var timer = null;
1328
    var callback = function() {
1329
        timer = null;
1330
        fcn();
1331
    };
1332

    
1333
    var _self = function(timeout) {
1334
        if (timer == null)
1335
            timer = setTimeout(callback, timeout || defaultTimeout);
1336
    };
1337

    
1338
    _self.delay = function(timeout) {
1339
        timer && clearTimeout(timer);
1340
        timer = setTimeout(callback, timeout || defaultTimeout);
1341
    };
1342
    _self.schedule = _self;
1343

    
1344
    _self.call = function() {
1345
        this.cancel();
1346
        fcn();
1347
    };
1348

    
1349
    _self.cancel = function() {
1350
        timer && clearTimeout(timer);
1351
        timer = null;
1352
    };
1353

    
1354
    _self.isPending = function() {
1355
        return timer;
1356
    };
1357

    
1358
    return _self;
1359
};
1360
});
1361

    
1362
ace.define("ace/worker/mirror",[], function(require, exports, module) {
1363
"use strict";
1364

    
1365
var Range = require("../range").Range;
1366
var Document = require("../document").Document;
1367
var lang = require("../lib/lang");
1368
    
1369
var Mirror = exports.Mirror = function(sender) {
1370
    this.sender = sender;
1371
    var doc = this.doc = new Document("");
1372
    
1373
    var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1374
    
1375
    var _self = this;
1376
    sender.on("change", function(e) {
1377
        var data = e.data;
1378
        if (data[0].start) {
1379
            doc.applyDeltas(data);
1380
        } else {
1381
            for (var i = 0; i < data.length; i += 2) {
1382
                if (Array.isArray(data[i+1])) {
1383
                    var d = {action: "insert", start: data[i], lines: data[i+1]};
1384
                } else {
1385
                    var d = {action: "remove", start: data[i], end: data[i+1]};
1386
                }
1387
                doc.applyDelta(d, true);
1388
            }
1389
        }
1390
        if (_self.$timeout)
1391
            return deferredUpdate.schedule(_self.$timeout);
1392
        _self.onUpdate();
1393
    });
1394
};
1395

    
1396
(function() {
1397
    
1398
    this.$timeout = 500;
1399
    
1400
    this.setTimeout = function(timeout) {
1401
        this.$timeout = timeout;
1402
    };
1403
    
1404
    this.setValue = function(value) {
1405
        this.doc.setValue(value);
1406
        this.deferredUpdate.schedule(this.$timeout);
1407
    };
1408
    
1409
    this.getValue = function(callbackId) {
1410
        this.sender.callback(this.doc.getValue(), callbackId);
1411
    };
1412
    
1413
    this.onUpdate = function() {
1414
    };
1415
    
1416
    this.isPending = function() {
1417
        return this.deferredUpdate.isPending();
1418
    };
1419
    
1420
}).call(Mirror.prototype);
1421

    
1422
});
1423

    
1424
ace.define("ace/mode/php/php",[], function(require, exports, module) {
1425

    
1426
var PHP = {Constants:{}};
1427

    
1428
PHP.Constants.T_INCLUDE = 257;
1429
PHP.Constants.T_INCLUDE_ONCE = 258;
1430
PHP.Constants.T_EVAL = 259;
1431
PHP.Constants.T_REQUIRE = 260;
1432
PHP.Constants.T_REQUIRE_ONCE = 261;
1433
PHP.Constants.T_LOGICAL_OR = 262;
1434
PHP.Constants.T_LOGICAL_XOR = 263;
1435
PHP.Constants.T_LOGICAL_AND = 264;
1436
PHP.Constants.T_PRINT = 265;
1437
PHP.Constants.T_YIELD = 266;
1438
PHP.Constants.T_DOUBLE_ARROW = 267;
1439
PHP.Constants.T_YIELD_FROM = 268;
1440
PHP.Constants.T_PLUS_EQUAL = 269;
1441
PHP.Constants.T_MINUS_EQUAL = 270;
1442
PHP.Constants.T_MUL_EQUAL = 271;
1443
PHP.Constants.T_DIV_EQUAL = 272;
1444
PHP.Constants.T_CONCAT_EQUAL = 273;
1445
PHP.Constants.T_MOD_EQUAL = 274;
1446
PHP.Constants.T_AND_EQUAL = 275;
1447
PHP.Constants.T_OR_EQUAL = 276;
1448
PHP.Constants.T_XOR_EQUAL = 277;
1449
PHP.Constants.T_SL_EQUAL = 278;
1450
PHP.Constants.T_SR_EQUAL = 279;
1451
PHP.Constants.T_POW_EQUAL = 280;
1452
PHP.Constants.T_COALESCE = 281;
1453
PHP.Constants.T_BOOLEAN_OR = 282;
1454
PHP.Constants.T_BOOLEAN_AND = 283;
1455
PHP.Constants.T_IS_EQUAL = 284;
1456
PHP.Constants.T_IS_NOT_EQUAL = 285;
1457
PHP.Constants.T_IS_IDENTICAL = 286;
1458
PHP.Constants.T_IS_NOT_IDENTICAL = 287;
1459
PHP.Constants.T_SPACESHIP = 288;
1460
PHP.Constants.T_IS_SMALLER_OR_EQUAL = 289;
1461
PHP.Constants.T_IS_GREATER_OR_EQUAL = 290;
1462
PHP.Constants.T_SL = 291;
1463
PHP.Constants.T_SR = 292;
1464
PHP.Constants.T_INSTANCEOF = 293;
1465
PHP.Constants.T_INC = 294;
1466
PHP.Constants.T_DEC = 295;
1467
PHP.Constants.T_INT_CAST = 296;
1468
PHP.Constants.T_DOUBLE_CAST = 297;
1469
PHP.Constants.T_STRING_CAST = 298;
1470
PHP.Constants.T_ARRAY_CAST = 299;
1471
PHP.Constants.T_OBJECT_CAST = 300;
1472
PHP.Constants.T_BOOL_CAST = 301;
1473
PHP.Constants.T_UNSET_CAST = 302;
1474
PHP.Constants.T_POW = 303;
1475
PHP.Constants.T_NEW = 304;
1476
PHP.Constants.T_CLONE = 305;
1477
PHP.Constants.T_EXIT = 306;
1478
PHP.Constants.T_IF = 307;
1479
PHP.Constants.T_ELSEIF = 308;
1480
PHP.Constants.T_ELSE = 309;
1481
PHP.Constants.T_ENDIF = 310;
1482
PHP.Constants.T_LNUMBER = 311;
1483
PHP.Constants.T_DNUMBER = 312;
1484
PHP.Constants.T_STRING = 313;
1485
PHP.Constants.T_STRING_VARNAME = 314;
1486
PHP.Constants.T_VARIABLE = 315;
1487
PHP.Constants.T_NUM_STRING = 316;
1488
PHP.Constants.T_INLINE_HTML = 317;
1489
PHP.Constants.T_CHARACTER = 318;
1490
PHP.Constants.T_BAD_CHARACTER = 319;
1491
PHP.Constants.T_ENCAPSED_AND_WHITESPACE = 320;
1492
PHP.Constants.T_CONSTANT_ENCAPSED_STRING = 321;
1493
PHP.Constants.T_ECHO = 322;
1494
PHP.Constants.T_DO = 323;
1495
PHP.Constants.T_WHILE = 324;
1496
PHP.Constants.T_ENDWHILE = 325;
1497
PHP.Constants.T_FOR = 326;
1498
PHP.Constants.T_ENDFOR = 327;
1499
PHP.Constants.T_FOREACH = 328;
1500
PHP.Constants.T_ENDFOREACH = 329;
1501
PHP.Constants.T_DECLARE = 330;
1502
PHP.Constants.T_ENDDECLARE = 331;
1503
PHP.Constants.T_AS = 332;
1504
PHP.Constants.T_SWITCH = 333;
1505
PHP.Constants.T_ENDSWITCH = 334;
1506
PHP.Constants.T_CASE = 335;
1507
PHP.Constants.T_DEFAULT = 336;
1508
PHP.Constants.T_BREAK = 337;
1509
PHP.Constants.T_CONTINUE = 338;
1510
PHP.Constants.T_GOTO = 339;
1511
PHP.Constants.T_FUNCTION = 340;
1512
PHP.Constants.T_CONST = 341;
1513
PHP.Constants.T_RETURN = 342;
1514
PHP.Constants.T_TRY = 343;
1515
PHP.Constants.T_CATCH = 344;
1516
PHP.Constants.T_FINALLY = 345;
1517
PHP.Constants.T_THROW = 346;
1518
PHP.Constants.T_USE = 347;
1519
PHP.Constants.T_INSTEADOF = 348;
1520
PHP.Constants.T_GLOBAL = 349;
1521
PHP.Constants.T_STATIC = 350;
1522
PHP.Constants.T_ABSTRACT = 351;
1523
PHP.Constants.T_FINAL = 352;
1524
PHP.Constants.T_PRIVATE = 353;
1525
PHP.Constants.T_PROTECTED = 354;
1526
PHP.Constants.T_PUBLIC = 355;
1527
PHP.Constants.T_VAR = 356;
1528
PHP.Constants.T_UNSET = 357;
1529
PHP.Constants.T_ISSET = 358;
1530
PHP.Constants.T_EMPTY = 359;
1531
PHP.Constants.T_HALT_COMPILER = 360;
1532
PHP.Constants.T_CLASS = 361;
1533
PHP.Constants.T_TRAIT = 362;
1534
PHP.Constants.T_INTERFACE = 363;
1535
PHP.Constants.T_EXTENDS = 364;
1536
PHP.Constants.T_IMPLEMENTS = 365;
1537
PHP.Constants.T_OBJECT_OPERATOR = 366;
1538
PHP.Constants.T_LIST = 367;
1539
PHP.Constants.T_ARRAY = 368;
1540
PHP.Constants.T_CALLABLE = 369;
1541
PHP.Constants.T_CLASS_C = 370;
1542
PHP.Constants.T_TRAIT_C = 371;
1543
PHP.Constants.T_METHOD_C = 372;
1544
PHP.Constants.T_FUNC_C = 373;
1545
PHP.Constants.T_LINE = 374;
1546
PHP.Constants.T_FILE = 375;
1547
PHP.Constants.T_COMMENT = 376;
1548
PHP.Constants.T_DOC_COMMENT = 377;
1549
PHP.Constants.T_OPEN_TAG = 378;
1550
PHP.Constants.T_OPEN_TAG_WITH_ECHO = 379;
1551
PHP.Constants.T_CLOSE_TAG = 380;
1552
PHP.Constants.T_WHITESPACE = 381;
1553
PHP.Constants.T_START_HEREDOC = 382;
1554
PHP.Constants.T_END_HEREDOC = 383;
1555
PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES = 384;
1556
PHP.Constants.T_CURLY_OPEN = 385;
1557
PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM = 386;
1558
PHP.Constants.T_NAMESPACE = 387;
1559
PHP.Constants.T_NS_C = 388;
1560
PHP.Constants.T_DIR = 389;
1561
PHP.Constants.T_NS_SEPARATOR = 390;
1562
PHP.Constants.T_ELLIPSIS = 391;
1563

    
1564
PHP.Lexer = function(src, ini) {
1565
    var heredoc, heredocEndAllowed,
1566

    
1567
    stateStack = ['INITIAL'], stackPos = 0,
1568
    swapState = function(state) {
1569
        stateStack[stackPos] = state;
1570
    },
1571
    pushState = function(state) {
1572
        stateStack[++stackPos] = state;
1573
    },
1574
    popState = function() {
1575
        --stackPos;
1576
    },
1577

    
1578
    shortOpenTag = ini === undefined || /^(on|true|1)$/i.test(ini.short_open_tag),
1579
    openTag = shortOpenTag
1580
        ? /^(\<\?php(?:\r\n|[ \t\r\n])|<\?|\<script language\=('|")?php('|")?\>)/i
1581
        : /^(\<\?php(?:\r\n|[ \t\r\n])|\<script language\=('|")?php('|")?\>)/i,
1582
    inlineHtml = shortOpenTag
1583
        ? /[^<]*(?:<(?!\?|script language\=('|")?php('|")?\>)[^<]*)*/i
1584
        : /[^<]*(?:<(?!\?=|\?php[ \t\r\n]|script language\=('|")?php('|")?\>)[^<]*)*/i,
1585
    labelRegexPart = '[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*',
1586
    stringRegexPart = function(quote) {
1587
        return '[^' + quote + '\\\\${]*(?:(?:\\\\[\\s\\S]|\\$(?!\\{|[a-zA-Z_\\x7f-\\uffff])|\\{(?!\\$))[^' + quote + '\\\\${]*)*';
1588
    },
1589

    
1590
    sharedStringTokens = [
1591
        {
1592
            value: PHP.Constants.T_VARIABLE,
1593
            re: new RegExp('^\\$' + labelRegexPart + '(?=\\[)'),
1594
            func: function() {
1595
                pushState('VAR_OFFSET');
1596
            }
1597
        },
1598
        {
1599
            value: PHP.Constants.T_VARIABLE,
1600
            re: new RegExp('^\\$' + labelRegexPart + '(?=->' + labelRegexPart + ')'),
1601
            func: function() {
1602
                pushState('LOOKING_FOR_PROPERTY');
1603
            }
1604
        },
1605
        {
1606
            value: PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES,
1607
            re: new RegExp('^\\$\\{(?=' + labelRegexPart + '[\\[}])'),
1608
            func: function() {
1609
                pushState('LOOKING_FOR_VARNAME');
1610
            }
1611
        },
1612
        {
1613
            value: PHP.Constants.T_VARIABLE,
1614
            re: new RegExp('^\\$' + labelRegexPart)
1615
        },
1616
        {
1617
            value: PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES,
1618
            re: /^\$\{/,
1619
            func: function() {
1620
                pushState('IN_SCRIPTING');
1621
            }
1622
        },
1623
        {
1624
            value: PHP.Constants.T_CURLY_OPEN,
1625
            re: /^\{(?=\$)/,
1626
            func: function() {
1627
                pushState('IN_SCRIPTING');
1628
            }
1629
        }
1630
    ],
1631
    data = {
1632
        'INITIAL': [
1633
            {
1634
                value: PHP.Constants.T_OPEN_TAG_WITH_ECHO,
1635
                re: /^<\?=/i,
1636
                func: function() {
1637
                    swapState('IN_SCRIPTING');
1638
                }
1639
            },
1640
            {
1641
                value: PHP.Constants.T_OPEN_TAG,
1642
                re: openTag,
1643
                func: function() {
1644
                    swapState('IN_SCRIPTING');
1645
                }
1646
            },
1647
            {
1648
                value: PHP.Constants.T_INLINE_HTML,
1649
                re: inlineHtml
1650
            },
1651
        ],
1652
        'IN_SCRIPTING': [
1653
            {
1654
                value: PHP.Constants.T_WHITESPACE,
1655
                re: /^[ \n\r\t]+/
1656
            },
1657
            {
1658
                value: PHP.Constants.T_ABSTRACT,
1659
                re: /^abstract\b/i
1660
            },
1661
            {
1662
                value: PHP.Constants.T_LOGICAL_AND,
1663
                re: /^and\b/i
1664
            },
1665
            {
1666
                value: PHP.Constants.T_ARRAY,
1667
                re: /^array\b/i
1668
            },
1669
            {
1670
                value: PHP.Constants.T_AS,
1671
                re: /^as\b/i
1672
            },
1673
            {
1674
                value: PHP.Constants.T_BREAK,
1675
                re: /^break\b/i
1676
            },
1677
            {
1678
                value: PHP.Constants.T_CALLABLE,
1679
                re: /^callable\b/i
1680
            },
1681
            {
1682
                value: PHP.Constants.T_CASE,
1683
                re: /^case\b/i
1684
            },
1685
            {
1686
                value: PHP.Constants.T_CATCH,
1687
                re: /^catch\b/i
1688
            },
1689
            {
1690
                value: PHP.Constants.T_CLASS,
1691
                re: /^class\b/i,
1692
            },
1693
            {
1694
                value: PHP.Constants.T_CLONE,
1695
                re: /^clone\b/i
1696
            },
1697
            {
1698
                value: PHP.Constants.T_CONST,
1699
                re: /^const\b/i
1700
            },
1701
            {
1702
                value: PHP.Constants.T_CONTINUE,
1703
                re: /^continue\b/i
1704
            },
1705
            {
1706
                value: PHP.Constants.T_DECLARE,
1707
                re: /^declare\b/i
1708
            },
1709
            {
1710
                value: PHP.Constants.T_DEFAULT,
1711
                re: /^default\b/i
1712
            },
1713
            {
1714
                value: PHP.Constants.T_DO,
1715
                re: /^do\b/i
1716
            },
1717
            {
1718
                value: PHP.Constants.T_ECHO,
1719
                re: /^echo\b/i
1720
            },
1721
            {
1722
                value: PHP.Constants.T_ELSE,
1723
                re: /^else\b/i
1724
            },
1725
            {
1726
                value: PHP.Constants.T_ELSEIF,
1727
                re: /^elseif\b/i
1728
            },
1729
            {
1730
                value: PHP.Constants.T_ENDDECLARE,
1731
                re: /^enddeclare\b/i
1732
            },
1733
            {
1734
                value: PHP.Constants.T_ENDFOR,
1735
                re: /^endfor\b/i
1736
            },
1737
            {
1738
                value: PHP.Constants.T_ENDFOREACH,
1739
                re: /^endforeach\b/i
1740
            },
1741
            {
1742
                value: PHP.Constants.T_ENDIF,
1743
                re: /^endif\b/i
1744
            },
1745
            {
1746
                value: PHP.Constants.T_ENDSWITCH,
1747
                re: /^endswitch\b/i
1748
            },
1749
            {
1750
                value: PHP.Constants.T_ENDWHILE,
1751
                re: /^endwhile\b/i
1752
            },
1753
            {
1754
                value: PHP.Constants.T_EMPTY,
1755
                re: /^empty\b/i
1756
            },
1757
            {
1758
                value: PHP.Constants.T_EVAL,
1759
                re: /^eval\b/i
1760
            },
1761
            {
1762
                value: PHP.Constants.T_EXIT,
1763
                re: /^(?:exit|die)\b/i
1764
            },
1765
            {
1766
                value: PHP.Constants.T_EXTENDS,
1767
                re: /^extends\b/i
1768
            },
1769
            {
1770
                value: PHP.Constants.T_FINAL,
1771
                re: /^final\b/i
1772
            },
1773
            {
1774
                value: PHP.Constants.T_FINALLY,
1775
                re: /^finally\b/i
1776
            },
1777
            {
1778
                value: PHP.Constants.T_FOR,
1779
                re: /^for\b/i
1780
            },
1781
            {
1782
                value: PHP.Constants.T_FOREACH,
1783
                re: /^foreach\b/i
1784
            },
1785
            {
1786
                value: PHP.Constants.T_FUNCTION,
1787
                re: /^function\b/i
1788
            },
1789
            {
1790
                value: PHP.Constants.T_GLOBAL,
1791
                re: /^global\b/i
1792
            },
1793
            {
1794
                value: PHP.Constants.T_GOTO,
1795
                re: /^goto\b/i
1796
            },
1797
            {
1798
                value: PHP.Constants.T_IF,
1799
                re: /^if\b/i
1800
            },
1801
            {
1802
                value: PHP.Constants.T_IMPLEMENTS,
1803
                re: /^implements\b/i
1804
            },
1805
            {
1806
                value: PHP.Constants.T_INCLUDE,
1807
                re: /^include\b/i
1808
            },
1809
            {
1810
                value: PHP.Constants.T_INCLUDE_ONCE,
1811
                re: /^include_once\b/i
1812
            },
1813
            {
1814
                value: PHP.Constants.T_INSTANCEOF,
1815
                re: /^instanceof\b/i
1816
            },
1817
            {
1818
                value: PHP.Constants.T_INSTEADOF,
1819
                re: /^insteadof\b/i
1820
            },
1821
            {
1822
                value: PHP.Constants.T_INTERFACE,
1823
                re: /^interface\b/i
1824
            },
1825
            {
1826
                value: PHP.Constants.T_ISSET,
1827
                re: /^isset\b/i
1828
            },
1829
            {
1830
                value: PHP.Constants.T_LIST,
1831
                re: /^list\b/i
1832
            },
1833
            {
1834
                value: PHP.Constants.T_NAMESPACE,
1835
                re: /^namespace\b/i
1836
            },
1837
            {
1838
                value: PHP.Constants.T_NEW,
1839
                re: /^new\b/i
1840
            },
1841
            {
1842
                value: PHP.Constants.T_LOGICAL_OR,
1843
                re: /^or\b/i
1844
            },
1845
            {
1846
                value: PHP.Constants.T_PRINT,
1847
                re: /^print\b/i
1848
            },
1849
            {
1850
                value: PHP.Constants.T_PRIVATE,
1851
                re: /^private\b/i
1852
            },
1853
            {
1854
                value: PHP.Constants.T_PROTECTED,
1855
                re: /^protected\b/i
1856
            },
1857
            {
1858
                value: PHP.Constants.T_PUBLIC,
1859
                re: /^public\b/i
1860
            },
1861
            {
1862
                value: PHP.Constants.T_REQUIRE,
1863
                re: /^require\b/i
1864
            },
1865
            {
1866
                value: PHP.Constants.T_REQUIRE_ONCE,
1867
                re: /^require_once\b/i
1868
            },
1869
            {
1870
                value: PHP.Constants.T_STATIC,
1871
                re: /^static\b/i
1872
            },
1873
            {
1874
                value: PHP.Constants.T_SWITCH,
1875
                re: /^switch\b/i
1876
            },
1877
            {
1878
                value: PHP.Constants.T_THROW,
1879
                re: /^throw\b/i
1880
            },
1881
            {
1882
                value: PHP.Constants.T_TRAIT,
1883
                re: /^trait\b/i,
1884
            },
1885
            {
1886
                value: PHP.Constants.T_TRY,
1887
                re: /^try\b/i
1888
            },
1889
            {
1890
                value: PHP.Constants.T_UNSET,
1891
                re: /^unset\b/i
1892
            },
1893
            {
1894
                value: PHP.Constants.T_USE,
1895
                re: /^use\b/i
1896
            },
1897
            {
1898
                value: PHP.Constants.T_VAR,
1899
                re: /^var\b/i
1900
            },
1901
            {
1902
                value: PHP.Constants.T_WHILE,
1903
                re: /^while\b/i
1904
            },
1905
            {
1906
                value: PHP.Constants.T_LOGICAL_XOR,
1907
                re: /^xor\b/i
1908
            },
1909
            {
1910
                value: PHP.Constants.T_YIELD_FROM,
1911
                re: /^yield\s+from\b/i
1912
            },
1913
            {
1914
                value: PHP.Constants.T_YIELD,
1915
                re: /^yield\b/i
1916
            },
1917
            {
1918
                value: PHP.Constants.T_RETURN,
1919
                re: /^return\b/i
1920
            },
1921
            {
1922
                value: PHP.Constants.T_METHOD_C,
1923
                re: /^__METHOD__\b/i
1924
            },
1925
            {
1926
                value: PHP.Constants.T_LINE,
1927
                re: /^__LINE__\b/i
1928
            },
1929
            {
1930
                value: PHP.Constants.T_FILE,
1931
                re: /^__FILE__\b/i
1932
            },
1933
            {
1934
                value: PHP.Constants.T_FUNC_C,
1935
                re: /^__FUNCTION__\b/i
1936
            },
1937
            {
1938
                value: PHP.Constants.T_NS_C,
1939
                re: /^__NAMESPACE__\b/i
1940
            },
1941
            {
1942
                value: PHP.Constants.T_TRAIT_C,
1943
                re: /^__TRAIT__\b/i
1944
            },
1945
            {
1946
                value: PHP.Constants.T_DIR,
1947
                re: /^__DIR__\b/i
1948
            },
1949
            {
1950
                value: PHP.Constants.T_CLASS_C,
1951
                re: /^__CLASS__\b/i
1952
            },
1953
            {
1954
                value: PHP.Constants.T_AND_EQUAL,
1955
                re: /^&=/
1956
            },
1957
            {
1958
                value: PHP.Constants.T_ARRAY_CAST,
1959
                re: /^\([ \t]*array[ \t]*\)/i
1960
            },
1961
            {
1962
                value: PHP.Constants.T_BOOL_CAST,
1963
                re: /^\([ \t]*(?:bool|boolean)[ \t]*\)/i
1964
            },
1965
            {
1966
                value: PHP.Constants.T_DOUBLE_CAST,
1967
                re: /^\([ \t]*(?:real|float|double)[ \t]*\)/i
1968
            },
1969
            {
1970
                value: PHP.Constants.T_INT_CAST,
1971
                re: /^\([ \t]*(?:int|integer)[ \t]*\)/i
1972
            },
1973
            {
1974
                value: PHP.Constants.T_OBJECT_CAST,
1975
                re: /^\([ \t]*object[ \t]*\)/i
1976
            },
1977
            {
1978
                value: PHP.Constants.T_STRING_CAST,
1979
                re: /^\([ \t]*(?:binary|string)[ \t]*\)/i
1980
            },
1981
            {
1982
                value: PHP.Constants.T_UNSET_CAST,
1983
                re: /^\([ \t]*unset[ \t]*\)/i
1984
            },
1985
            {
1986
                value: PHP.Constants.T_BOOLEAN_AND,
1987
                re: /^&&/
1988
            },
1989
            {
1990
                value: PHP.Constants.T_BOOLEAN_OR,
1991
                re: /^\|\|/
1992
            },
1993
            {
1994
                value: PHP.Constants.T_CLOSE_TAG,
1995
                re: /^(?:\?>|<\/script>)(\r\n|\r|\n)?/i,
1996
                func: function() {
1997
                    swapState('INITIAL');
1998
                }
1999
            },
2000
            {
2001
                value: PHP.Constants.T_DOUBLE_ARROW,
2002
                re: /^=>/
2003
            },
2004
            {
2005
                value: PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM,
2006
                re: /^::/
2007
            },
2008
            {
2009
                value: PHP.Constants.T_INC,
2010
                re: /^\+\+/
2011
            },
2012
            {
2013
                value: PHP.Constants.T_DEC,
2014
                re: /^--/
2015
            },
2016
            {
2017
                value: PHP.Constants.T_CONCAT_EQUAL,
2018
                re: /^\.=/
2019
            },
2020
            {
2021
                value: PHP.Constants.T_DIV_EQUAL,
2022
                re: /^\/=/
2023
            },
2024
            {
2025
                value: PHP.Constants.T_XOR_EQUAL,
2026
                re: /^\^=/
2027
            },
2028
            {
2029
                value: PHP.Constants.T_MUL_EQUAL,
2030
                re: /^\*=/
2031
            },
2032
            {
2033
                value: PHP.Constants.T_MOD_EQUAL,
2034
                re: /^%=/
2035
            },
2036
            {
2037
                value: PHP.Constants.T_SL_EQUAL,
2038
                re: /^<<=/
2039
            },
2040
            {
2041
                value: PHP.Constants.T_START_HEREDOC,
2042
                re: new RegExp('^[bB]?<<<[ \\t]*\'(' + labelRegexPart + ')\'(?:\\r\\n|\\r|\\n)'),
2043
                func: function(result) {
2044
                    heredoc = result[1];
2045
                    swapState('NOWDOC');
2046
                }
2047
            },
2048
            {
2049
                value: PHP.Constants.T_START_HEREDOC,
2050
                re: new RegExp('^[bB]?<<<[ \\t]*("?)(' + labelRegexPart + ')\\1(?:\\r\\n|\\r|\\n)'),
2051
                func: function(result) {
2052
                    heredoc = result[2];
2053
                    heredocEndAllowed = true;
2054
                    swapState('HEREDOC');
2055
                }
2056
            },
2057
            {
2058
                value: PHP.Constants.T_SL,
2059
                re: /^<</
2060
            },
2061
            {
2062
                value: PHP.Constants.T_SPACESHIP,
2063
                re: /^<=>/
2064
            },
2065
            {
2066
                value: PHP.Constants.T_IS_SMALLER_OR_EQUAL,
2067
                re: /^<=/
2068
            },
2069
            {
2070
                value: PHP.Constants.T_SR_EQUAL,
2071
                re: /^>>=/
2072
            },
2073
            {
2074
                value: PHP.Constants.T_SR,
2075
                re: /^>>/
2076
            },
2077
            {
2078
                value: PHP.Constants.T_IS_GREATER_OR_EQUAL,
2079
                re: /^>=/
2080
            },
2081
            {
2082
                value: PHP.Constants.T_OR_EQUAL,
2083
                re: /^\|=/
2084
            },
2085
            {
2086
                value: PHP.Constants.T_PLUS_EQUAL,
2087
                re: /^\+=/
2088
            },
2089
            {
2090
                value: PHP.Constants.T_MINUS_EQUAL,
2091
                re: /^-=/
2092
            },
2093
            {
2094
                value: PHP.Constants.T_OBJECT_OPERATOR,
2095
                re: new RegExp('^->(?=[ \n\r\t]*' + labelRegexPart + ')'),
2096
                func: function() {
2097
                    pushState('LOOKING_FOR_PROPERTY');
2098
                }
2099
            },
2100
            {
2101
                value: PHP.Constants.T_OBJECT_OPERATOR,
2102
                re: /^->/i
2103
            },
2104
            {
2105
                value: PHP.Constants.T_ELLIPSIS,
2106
                re: /^\.\.\./
2107
            },
2108
            {
2109
                value: PHP.Constants.T_POW_EQUAL,
2110
                re: /^\*\*=/
2111
            },
2112
            {
2113
                value: PHP.Constants.T_POW,
2114
                re: /^\*\*/
2115
            },
2116
            {
2117
                value: PHP.Constants.T_COALESCE,
2118
                re: /^\?\?/
2119
            },
2120
            {
2121
                value: PHP.Constants.T_COMMENT,
2122
                re: /^\/\*([\S\s]*?)(?:\*\/|$)/
2123
            },
2124
            {
2125
                value: PHP.Constants.T_COMMENT,
2126
                re: /^(?:\/\/|#)[^\r\n?]*(?:\?(?!>)[^\r\n?]*)*(?:\r\n|\r|\n)?/
2127
            },
2128
            {
2129
                value: PHP.Constants.T_IS_IDENTICAL,
2130
                re: /^===/
2131
            },
2132
            {
2133
                value: PHP.Constants.T_IS_EQUAL,
2134
                re: /^==/
2135
            },
2136
            {
2137
                value: PHP.Constants.T_IS_NOT_IDENTICAL,
2138
                re: /^!==/
2139
            },
2140
            {
2141
                value: PHP.Constants.T_IS_NOT_EQUAL,
2142
                re: /^(!=|<>)/
2143
            },
2144
            {
2145
                value: PHP.Constants.T_DNUMBER,
2146
                re: /^(?:[0-9]+\.[0-9]*|\.[0-9]+)(?:[eE][+-]?[0-9]+)?/
2147
            },
2148
            {
2149
                value: PHP.Constants.T_DNUMBER,
2150
                re: /^[0-9]+[eE][+-]?[0-9]+/
2151
            },
2152
            {
2153
                value: PHP.Constants.T_LNUMBER,
2154
                re: /^(?:0x[0-9A-F]+|0b[01]+|[0-9]+)/i
2155
            },
2156
            {
2157
                value: PHP.Constants.T_VARIABLE,
2158
                re: new RegExp('^\\$' + labelRegexPart)
2159
            },
2160
            {
2161
                value: PHP.Constants.T_CONSTANT_ENCAPSED_STRING,
2162
                re: /^[bB]?'[^'\\]*(?:\\[\s\S][^'\\]*)*'/,
2163
            },
2164
            {
2165
                value: PHP.Constants.T_CONSTANT_ENCAPSED_STRING,
2166
                re: new RegExp('^[bB]?"' + stringRegexPart('"') + '"')
2167
            },
2168
            {
2169
                value: -1,
2170
                re: /^[bB]?"/,
2171
                func: function() {
2172
                    swapState('DOUBLE_QUOTES');
2173
                }
2174
            },
2175
            {
2176
                value: -1,
2177
                re: /^`/,
2178
                func: function() {
2179
                    swapState('BACKTICKS');
2180
                }
2181
            },
2182
            {
2183
                value: PHP.Constants.T_NS_SEPARATOR,
2184
                re: /^\\/
2185
            },
2186
            {
2187
                value: PHP.Constants.T_STRING,
2188
                re: /^[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/
2189
            },
2190
            {
2191
                value: -1,
2192
                re: /^\{/,
2193
                func: function() {
2194
                    pushState('IN_SCRIPTING');
2195
                }
2196
            },
2197
            {
2198
                value: -1,
2199
                re: /^\}/,
2200
                func: function() {
2201
                    if (stackPos > 0) {
2202
                        popState();
2203
                    }
2204
                }
2205
            },
2206
            {
2207
                value: -1,
2208
                re: /^[\[\];:?()!.,><=+-/*|&@^%"'$~]/
2209
            }
2210
        ],
2211
        'DOUBLE_QUOTES': sharedStringTokens.concat([
2212
            {
2213
                value: -1,
2214
                re: /^"/,
2215
                func: function() {
2216
                    swapState('IN_SCRIPTING');
2217
                }
2218
            },
2219
            {
2220
                value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
2221
                re: new RegExp('^' + stringRegexPart('"'))
2222
            }
2223
        ]),
2224
        'BACKTICKS': sharedStringTokens.concat([
2225
            {
2226
                value: -1,
2227
                re: /^`/,
2228
                func: function() {
2229
                    swapState('IN_SCRIPTING');
2230
                }
2231
            },
2232
            {
2233
                value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
2234
                re: new RegExp('^' + stringRegexPart('`'))
2235
            }
2236
        ]),
2237
        'VAR_OFFSET': [
2238
            {
2239
                value: -1,
2240
                re: /^\]/,
2241
                func: function() {
2242
                    popState();
2243
                }
2244
            },
2245
            {
2246
                value: PHP.Constants.T_NUM_STRING,
2247
                re: /^(?:0x[0-9A-F]+|0b[01]+|[0-9]+)/i
2248
            },
2249
            {
2250
                value: PHP.Constants.T_VARIABLE,
2251
                re: new RegExp('^\\$' + labelRegexPart)
2252
            },
2253
            {
2254
                value: PHP.Constants.T_STRING,
2255
                re: new RegExp('^' + labelRegexPart)
2256
            },
2257
            {
2258
                value: -1,
2259
                re: /^[;:,.\[()|^&+-/*=%!~$<>?@{}"`]/
2260
            }
2261
        ],
2262
        'LOOKING_FOR_PROPERTY': [
2263
            {
2264
                value: PHP.Constants.T_OBJECT_OPERATOR,
2265
                re: /^->/
2266
            },
2267
            {
2268
                value: PHP.Constants.T_STRING,
2269
                re: new RegExp('^' + labelRegexPart),
2270
                func: function() {
2271
                    popState();
2272
                }
2273
            },
2274
            {
2275
                value: PHP.Constants.T_WHITESPACE,
2276
                re: /^[ \n\r\t]+/
2277
            }
2278
        ],
2279
        'LOOKING_FOR_VARNAME': [
2280
            {
2281
                value: PHP.Constants.T_STRING_VARNAME,
2282
                re: new RegExp('^' + labelRegexPart + '(?=[\\[}])'),
2283
                func: function() {
2284
                    swapState('IN_SCRIPTING');
2285
                }
2286
            }
2287
        ],
2288
        'NOWDOC': [
2289
            {
2290
                value: PHP.Constants.T_END_HEREDOC,
2291
                matchFunc: function(src) {
2292
                    var re = new RegExp('^' + heredoc + '(?=;?[\\r\\n])');
2293
                    if (src.match(re)) {
2294
                        return [src.substr(0, heredoc.length)];
2295
                    } else {
2296
                        return null;
2297
                    }
2298
                },
2299
                func: function() {
2300
                    swapState('IN_SCRIPTING');
2301
                }
2302
            },
2303
            {
2304
                value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
2305
                matchFunc: function(src) {
2306
                    var re = new RegExp('[\\r\\n]' + heredoc + '(?=;?[\\r\\n])');
2307
                    var result = re.exec(src);
2308
                    var end = result ? result.index + 1 : src.length;
2309
                    return [src.substring(0, end)];
2310
                }
2311
            }
2312
        ],
2313
        'HEREDOC': sharedStringTokens.concat([
2314
            {
2315
                value: PHP.Constants.T_END_HEREDOC,
2316
                matchFunc: function(src) {
2317
                    if (!heredocEndAllowed) {
2318
                        return null;
2319
                    }
2320
                    var re = new RegExp('^' + heredoc + '(?=;?[\\r\\n])');
2321
                    if (src.match(re)) {
2322
                        return [src.substr(0, heredoc.length)];
2323
                    } else {
2324
                        return null;
2325
                    }
2326
                },
2327
                func: function() {
2328
                    swapState('IN_SCRIPTING');
2329
                }
2330
            },
2331
            {
2332
                value: PHP.Constants.T_ENCAPSED_AND_WHITESPACE,
2333
                matchFunc: function(src) {
2334
                    var end = src.length;
2335
                    var re = new RegExp('^' + stringRegexPart(''));
2336
                    var result = re.exec(src);
2337
                    if (result) {
2338
                        end = result[0].length;
2339
                    }
2340
                    re = new RegExp('([\\r\\n])' + heredoc + '(?=;?[\\r\\n])');
2341
                    result = re.exec(src.substring(0, end));
2342
                    if (result) {
2343
                        end = result.index + 1;
2344
                        heredocEndAllowed = true;
2345
                    } else {
2346
                        heredocEndAllowed = false;
2347
                    }
2348
                    if (end == 0) {
2349
                        return null;
2350
                    }
2351
                    return [src.substring(0, end)];
2352
                }
2353
            }
2354
        ])
2355
    };
2356

    
2357
    var results = [],
2358
    line = 1,
2359
    cancel = true;
2360

    
2361
    if (src === null) {
2362
        return results;
2363
    }
2364

    
2365
    if (typeof src !== "string") {
2366
        src = src.toString();
2367
    }
2368

    
2369
    while (src.length > 0 && cancel === true) {
2370
        var state = stateStack[stackPos];
2371
        var tokens = data[state];
2372
        cancel = tokens.some(function(token){
2373
            var result = token.matchFunc !== undefined
2374
                ? token.matchFunc(src)
2375
                : src.match(token.re);
2376
            if (result !== null) {
2377
                if (result[0].length == 0) {
2378
                    throw new Error("empty match");
2379
                }
2380

    
2381
                if (token.func !== undefined) {
2382
                    token.func(result);
2383
                }
2384

    
2385
                if (token.value === -1) {
2386
                    results.push(result[0]);
2387
                } else {
2388
                    var resultString = result[0];
2389
                    results.push([
2390
                        parseInt(token.value, 10),
2391
                        resultString,
2392
                        line
2393
                        ]);
2394
                    line += resultString.split('\n').length - 1;
2395
                }
2396

    
2397
                src = src.substring(result[0].length);
2398

    
2399
                return true;
2400
            }
2401
            return false;
2402
        });
2403
    }
2404

    
2405
    return results;
2406
};
2407

    
2408

    
2409
PHP.Parser = function ( preprocessedTokens, evaluate ) {
2410

    
2411
    var yybase = this.yybase,
2412
    yydefault = this.yydefault,
2413
    yycheck = this.yycheck,
2414
    yyaction = this.yyaction,
2415
    yylen = this.yylen,
2416
    yygbase = this.yygbase,
2417
    yygcheck = this.yygcheck,
2418
    yyp = this.yyp,
2419
    yygoto = this.yygoto,
2420
    yylhs = this.yylhs,
2421
    terminals = this.terminals,
2422
    translate = this.translate,
2423
    yygdefault = this.yygdefault;
2424

    
2425

    
2426
    this.pos = -1;
2427
    this.line = 1;
2428

    
2429
    this.tokenMap = this.createTokenMap( );
2430

    
2431
    this.dropTokens = {};
2432
    this.dropTokens[ PHP.Constants.T_WHITESPACE ] = 1;
2433
    this.dropTokens[ PHP.Constants.T_OPEN_TAG ] = 1;
2434
    var tokens = [];
2435
    preprocessedTokens.forEach( function( token, index ) {
2436
        if ( typeof token === "object" && token[ 0 ] === PHP.Constants.T_OPEN_TAG_WITH_ECHO) {
2437
            tokens.push([
2438
                PHP.Constants.T_OPEN_TAG,
2439
                token[ 1 ],
2440
                token[ 2 ]
2441
                ]);
2442
            tokens.push([
2443
                PHP.Constants.T_ECHO,
2444
                token[ 1 ],
2445
                token[ 2 ]
2446
                ]);
2447
        } else {
2448
            tokens.push( token );
2449
        }
2450
    });
2451
    this.tokens = tokens;
2452
    var tokenId = this.TOKEN_NONE;
2453
    this.startAttributes = {
2454
        'startLine': 1
2455
    };
2456

    
2457
    this.endAttributes = {};
2458
    var attributeStack = [ this.startAttributes ];
2459
    var state = 0;
2460
    var stateStack = [ state ];
2461
    this.yyastk = [];
2462
    this.stackPos  = 0;
2463

    
2464
    var yyn;
2465

    
2466
    var origTokenId;
2467

    
2468

    
2469
    for (;;) {
2470

    
2471
        if ( yybase[ state ] === 0 ) {
2472
            yyn = yydefault[ state ];
2473
        } else {
2474
            if (tokenId === this.TOKEN_NONE ) {
2475
                origTokenId = this.getNextToken( );
2476
                tokenId = (origTokenId >= 0 && origTokenId < this.TOKEN_MAP_SIZE) ? translate[ origTokenId ] : this.TOKEN_INVALID;
2477

    
2478
                attributeStack[ this.stackPos ] = this.startAttributes;
2479
            }
2480

    
2481
            if (((yyn = yybase[ state ] + tokenId) >= 0
2482
                && yyn < this.YYLAST && yycheck[ yyn ] === tokenId
2483
                || (state < this.YY2TBLSTATE
2484
                    && (yyn = yybase[state + this.YYNLSTATES] + tokenId) >= 0
2485
                    && yyn < this.YYLAST
2486
                    && yycheck[ yyn ] === tokenId))
2487
            && (yyn = yyaction[ yyn ]) !== this.YYDEFAULT ) {
2488
                if (yyn > 0) {
2489
                    ++this.stackPos;
2490

    
2491
                    stateStack[ this.stackPos ] = state = yyn;
2492
                    this.yyastk[ this.stackPos ] = this.tokenValue;
2493
                    attributeStack[ this.stackPos ] = this.startAttributes;
2494
                    tokenId = this.TOKEN_NONE;
2495

    
2496
                    if (yyn < this.YYNLSTATES)
2497
                        continue;
2498
                    yyn -= this.YYNLSTATES;
2499
                } else {
2500
                    yyn = -yyn;
2501
                }
2502
            } else {
2503
                yyn = yydefault[ state ];
2504
            }
2505
        }
2506

    
2507
        for (;;) {
2508

    
2509
            if ( yyn === 0 ) {
2510
                return this.yyval;
2511
            } else if (yyn !== this.YYUNEXPECTED ) {
2512
                for (var attr in this.endAttributes) {
2513
                    attributeStack[ this.stackPos - yylen[ yyn ] ][ attr ] = this.endAttributes[ attr ];
2514
                }
2515
                this.stackPos -= yylen[ yyn ];
2516
                yyn = yylhs[ yyn ];
2517
                if ((yyp = yygbase[ yyn ] + stateStack[ this.stackPos ]) >= 0
2518
                    && yyp < this.YYGLAST
2519
                    && yygcheck[ yyp ] === yyn) {
2520
                    state = yygoto[ yyp ];
2521
                } else {
2522
                    state = yygdefault[ yyn ];
2523
                }
2524

    
2525
                ++this.stackPos;
2526

    
2527
                stateStack[ this.stackPos ] = state;
2528
                this.yyastk[ this.stackPos ] = this.yyval;
2529
                attributeStack[ this.stackPos ] = this.startAttributes;
2530
            } else {
2531
                if (evaluate !== true) {
2532

    
2533
                    var expected = [];
2534

    
2535
                    for (var i = 0; i < this.TOKEN_MAP_SIZE; ++i) {
2536
                        if ((yyn = yybase[ state ] + i) >= 0 && yyn < this.YYLAST && yycheck[ yyn ] == i
2537
                         || state < this.YY2TBLSTATE
2538
                            && (yyn = yybase[ state + this.YYNLSTATES] + i)
2539
                            && yyn < this.YYLAST && yycheck[ yyn ] == i
2540
                        ) {
2541
                            if (yyaction[ yyn ] != this.YYUNEXPECTED) {
2542
                                if (expected.length == 4) {
2543
                                    expected = [];
2544
                                    break;
2545
                                }
2546

    
2547
                                expected.push( this.terminals[ i ] );
2548
                            }
2549
                        }
2550
                    }
2551

    
2552
                    var expectedString = '';
2553
                    if (expected.length) {
2554
                        expectedString = ', expecting ' + expected.join(' or ');
2555
                    }
2556
                    throw new PHP.ParseError('syntax error, unexpected ' + terminals[ tokenId ] + expectedString, this.startAttributes['startLine']);
2557
                } else {
2558
                    return this.startAttributes['startLine'];
2559
                }
2560

    
2561
            }
2562

    
2563
            if (state < this.YYNLSTATES)
2564
                break;
2565
            yyn = state - this.YYNLSTATES;
2566
        }
2567
    }
2568
};
2569

    
2570
PHP.ParseError = function( msg, line ) {
2571
    this.message = msg;
2572
    this.line = line;
2573
};
2574

    
2575
PHP.Parser.prototype.getNextToken = function( ) {
2576

    
2577
    this.startAttributes = {};
2578
    this.endAttributes = {};
2579

    
2580
    var token,
2581
    tmp;
2582

    
2583
    while (this.tokens[++this.pos] !== undefined) {
2584
        token = this.tokens[this.pos];
2585

    
2586
        if (typeof token === "string") {
2587
            this.startAttributes['startLine'] = this.line;
2588
            this.endAttributes['endLine'] = this.line;
2589
            if ('b"' === token) {
2590
                this.tokenValue = 'b"';
2591
                return '"'.charCodeAt(0);
2592
            } else {
2593
                this.tokenValue = token;
2594
                return token.charCodeAt(0);
2595
            }
2596
        } else {
2597

    
2598

    
2599

    
2600
            this.line += ((tmp = token[ 1 ].match(/\n/g)) === null) ? 0 : tmp.length;
2601

    
2602
            if (PHP.Constants.T_COMMENT === token[0]) {
2603

    
2604
                if (!Array.isArray(this.startAttributes['comments'])) {
2605
                    this.startAttributes['comments'] = [];
2606
                }
2607

    
2608
                this.startAttributes['comments'].push( {
2609
                    type: "comment",
2610
                    comment: token[1],
2611
                    line: token[2]
2612
                });
2613

    
2614
            } else if (PHP.Constants.T_DOC_COMMENT === token[0]) {
2615
                this.startAttributes['comments'].push( new PHPParser_Comment_Doc(token[1], token[2]) );
2616
            } else if (this.dropTokens[token[0]] === undefined) {
2617
                this.tokenValue = token[1];
2618
                this.startAttributes['startLine'] = token[2];
2619
                this.endAttributes['endLine'] = this.line;
2620

    
2621
                return this.tokenMap[token[0]];
2622
            }
2623
        }
2624
    }
2625

    
2626
    this.startAttributes['startLine'] = this.line;
2627
    return 0;
2628
};
2629

    
2630
PHP.Parser.prototype.tokenName = function( token ) {
2631
    var constants = ["T_INCLUDE","T_INCLUDE_ONCE","T_EVAL","T_REQUIRE","T_REQUIRE_ONCE","T_LOGICAL_OR","T_LOGICAL_XOR","T_LOGICAL_AND","T_PRINT","T_YIELD","T_DOUBLE_ARROW","T_YIELD_FROM","T_PLUS_EQUAL","T_MINUS_EQUAL","T_MUL_EQUAL","T_DIV_EQUAL","T_CONCAT_EQUAL","T_MOD_EQUAL","T_AND_EQUAL","T_OR_EQUAL","T_XOR_EQUAL","T_SL_EQUAL","T_SR_EQUAL","T_POW_EQUAL","T_COALESCE","T_BOOLEAN_OR","T_BOOLEAN_AND","T_IS_EQUAL","T_IS_NOT_EQUAL","T_IS_IDENTICAL","T_IS_NOT_IDENTICAL","T_SPACESHIP","T_IS_SMALLER_OR_EQUAL","T_IS_GREATER_OR_EQUAL","T_SL","T_SR","T_INSTANCEOF","T_INC","T_DEC","T_INT_CAST","T_DOUBLE_CAST","T_STRING_CAST","T_ARRAY_CAST","T_OBJECT_CAST","T_BOOL_CAST","T_UNSET_CAST","T_POW","T_NEW","T_CLONE","T_EXIT","T_IF","T_ELSEIF","T_ELSE","T_ENDIF","T_LNUMBER","T_DNUMBER","T_STRING","T_STRING_VARNAME","T_VARIABLE","T_NUM_STRING","T_INLINE_HTML","T_CHARACTER","T_BAD_CHARACTER","T_ENCAPSED_AND_WHITESPACE","T_CONSTANT_ENCAPSED_STRING","T_ECHO","T_DO","T_WHILE","T_ENDWHILE","T_FOR","T_ENDFOR","T_FOREACH","T_ENDFOREACH","T_DECLARE","T_ENDDECLARE","T_AS","T_SWITCH","T_ENDSWITCH","T_CASE","T_DEFAULT","T_BREAK","T_CONTINUE","T_GOTO","T_FUNCTION","T_CONST","T_RETURN","T_TRY","T_CATCH","T_FINALLY","T_THROW","T_USE","T_INSTEADOF","T_GLOBAL","T_STATIC","T_ABSTRACT","T_FINAL","T_PRIVATE","T_PROTECTED","T_PUBLIC","T_VAR","T_UNSET","T_ISSET","T_EMPTY","T_HALT_COMPILER","T_CLASS","T_TRAIT","T_INTERFACE","T_EXTENDS","T_IMPLEMENTS","T_OBJECT_OPERATOR","T_DOUBLE_ARROW","T_LIST","T_ARRAY","T_CALLABLE","T_CLASS_C","T_TRAIT_C","T_METHOD_C","T_FUNC_C","T_LINE","T_FILE","T_COMMENT","T_DOC_COMMENT","T_OPEN_TAG","T_OPEN_TAG_WITH_ECHO","T_CLOSE_TAG","T_WHITESPACE","T_START_HEREDOC","T_END_HEREDOC","T_DOLLAR_OPEN_CURLY_BRACES","T_CURLY_OPEN","T_PAAMAYIM_NEKUDOTAYIM","T_NAMESPACE","T_NS_C","T_DIR","T_NS_SEPARATOR","T_ELLIPSIS"];
2632
    var current = "UNKNOWN";
2633
    constants.some(function( constant ) {
2634
        if (PHP.Constants[ constant ] === token) {
2635
            current = constant;
2636
            return true;
2637
        } else {
2638
            return false;
2639
        }
2640
    });
2641

    
2642
    return current;
2643
};
2644

    
2645
PHP.Parser.prototype.createTokenMap = function() {
2646
    var tokenMap = {},
2647
    name,
2648
    i;
2649
    for ( i = 256; i < 1000; ++i ) {
2650
        if( PHP.Constants.T_OPEN_TAG_WITH_ECHO === i ) {
2651
            tokenMap[ i ] = PHP.Constants.T_ECHO;
2652
        } else if( PHP.Constants.T_CLOSE_TAG === i ) {
2653
            tokenMap[ i ] = 59;
2654
        } else if ( 'UNKNOWN' !== (name = this.tokenName( i ) ) ) { 
2655
            tokenMap[ i ] =  this[name];
2656
        }
2657
    }
2658
    return tokenMap;
2659
};
2660

    
2661
PHP.Parser.prototype.TOKEN_NONE    = -1;
2662
PHP.Parser.prototype.TOKEN_INVALID = 157;
2663

    
2664
PHP.Parser.prototype.TOKEN_MAP_SIZE = 392;
2665

    
2666
PHP.Parser.prototype.YYLAST       = 889;
2667
PHP.Parser.prototype.YY2TBLSTATE  = 337;
2668
PHP.Parser.prototype.YYGLAST      = 410;
2669
PHP.Parser.prototype.YYNLSTATES   = 564;
2670
PHP.Parser.prototype.YYUNEXPECTED = 32767;
2671
PHP.Parser.prototype.YYDEFAULT    = -32766;
2672
PHP.Parser.prototype.YYERRTOK = 256;
2673
PHP.Parser.prototype.T_INCLUDE = 257;
2674
PHP.Parser.prototype.T_INCLUDE_ONCE = 258;
2675
PHP.Parser.prototype.T_EVAL = 259;
2676
PHP.Parser.prototype.T_REQUIRE = 260;
2677
PHP.Parser.prototype.T_REQUIRE_ONCE = 261;
2678
PHP.Parser.prototype.T_LOGICAL_OR = 262;
2679
PHP.Parser.prototype.T_LOGICAL_XOR = 263;
2680
PHP.Parser.prototype.T_LOGICAL_AND = 264;
2681
PHP.Parser.prototype.T_PRINT = 265;
2682
PHP.Parser.prototype.T_YIELD = 266;
2683
PHP.Parser.prototype.T_DOUBLE_ARROW = 267;
2684
PHP.Parser.prototype.T_YIELD_FROM = 268;
2685
PHP.Parser.prototype.T_PLUS_EQUAL = 269;
2686
PHP.Parser.prototype.T_MINUS_EQUAL = 270;
2687
PHP.Parser.prototype.T_MUL_EQUAL = 271;
2688
PHP.Parser.prototype.T_DIV_EQUAL = 272;
2689
PHP.Parser.prototype.T_CONCAT_EQUAL = 273;
2690
PHP.Parser.prototype.T_MOD_EQUAL = 274;
2691
PHP.Parser.prototype.T_AND_EQUAL = 275;
2692
PHP.Parser.prototype.T_OR_EQUAL = 276;
2693
PHP.Parser.prototype.T_XOR_EQUAL = 277;
2694
PHP.Parser.prototype.T_SL_EQUAL = 278;
2695
PHP.Parser.prototype.T_SR_EQUAL = 279;
2696
PHP.Parser.prototype.T_POW_EQUAL = 280;
2697
PHP.Parser.prototype.T_COALESCE = 281;
2698
PHP.Parser.prototype.T_BOOLEAN_OR = 282;
2699
PHP.Parser.prototype.T_BOOLEAN_AND = 283;
2700
PHP.Parser.prototype.T_IS_EQUAL = 284;
2701
PHP.Parser.prototype.T_IS_NOT_EQUAL = 285;
2702
PHP.Parser.prototype.T_IS_IDENTICAL = 286;
2703
PHP.Parser.prototype.T_IS_NOT_IDENTICAL = 287;
2704
PHP.Parser.prototype.T_SPACESHIP = 288;
2705
PHP.Parser.prototype.T_IS_SMALLER_OR_EQUAL = 289;
2706
PHP.Parser.prototype.T_IS_GREATER_OR_EQUAL = 290;
2707
PHP.Parser.prototype.T_SL = 291;
2708
PHP.Parser.prototype.T_SR = 292;
2709
PHP.Parser.prototype.T_INSTANCEOF = 293;
2710
PHP.Parser.prototype.T_INC = 294;
2711
PHP.Parser.prototype.T_DEC = 295;
2712
PHP.Parser.prototype.T_INT_CAST = 296;
2713
PHP.Parser.prototype.T_DOUBLE_CAST = 297;
2714
PHP.Parser.prototype.T_STRING_CAST = 298;
2715
PHP.Parser.prototype.T_ARRAY_CAST = 299;
2716
PHP.Parser.prototype.T_OBJECT_CAST = 300;
2717
PHP.Parser.prototype.T_BOOL_CAST = 301;
2718
PHP.Parser.prototype.T_UNSET_CAST = 302;
2719
PHP.Parser.prototype.T_POW = 303;
2720
PHP.Parser.prototype.T_NEW = 304;
2721
PHP.Parser.prototype.T_CLONE = 305;
2722
PHP.Parser.prototype.T_EXIT = 306;
2723
PHP.Parser.prototype.T_IF = 307;
2724
PHP.Parser.prototype.T_ELSEIF = 308;
2725
PHP.Parser.prototype.T_ELSE = 309;
2726
PHP.Parser.prototype.T_ENDIF = 310;
2727
PHP.Parser.prototype.T_LNUMBER = 311;
2728
PHP.Parser.prototype.T_DNUMBER = 312;
2729
PHP.Parser.prototype.T_STRING = 313;
2730
PHP.Parser.prototype.T_STRING_VARNAME = 314;
2731
PHP.Parser.prototype.T_VARIABLE = 315;
2732
PHP.Parser.prototype.T_NUM_STRING = 316;
2733
PHP.Parser.prototype.T_INLINE_HTML = 317;
2734
PHP.Parser.prototype.T_CHARACTER = 318;
2735
PHP.Parser.prototype.T_BAD_CHARACTER = 319;
2736
PHP.Parser.prototype.T_ENCAPSED_AND_WHITESPACE = 320;
2737
PHP.Parser.prototype.T_CONSTANT_ENCAPSED_STRING = 321;
2738
PHP.Parser.prototype.T_ECHO = 322;
2739
PHP.Parser.prototype.T_DO = 323;
2740
PHP.Parser.prototype.T_WHILE = 324;
2741
PHP.Parser.prototype.T_ENDWHILE = 325;
2742
PHP.Parser.prototype.T_FOR = 326;
2743
PHP.Parser.prototype.T_ENDFOR = 327;
2744
PHP.Parser.prototype.T_FOREACH = 328;
2745
PHP.Parser.prototype.T_ENDFOREACH = 329;
2746
PHP.Parser.prototype.T_DECLARE = 330;
2747
PHP.Parser.prototype.T_ENDDECLARE = 331;
2748
PHP.Parser.prototype.T_AS = 332;
2749
PHP.Parser.prototype.T_SWITCH = 333;
2750
PHP.Parser.prototype.T_ENDSWITCH = 334;
2751
PHP.Parser.prototype.T_CASE = 335;
2752
PHP.Parser.prototype.T_DEFAULT = 336;
2753
PHP.Parser.prototype.T_BREAK = 337;
2754
PHP.Parser.prototype.T_CONTINUE = 338;
2755
PHP.Parser.prototype.T_GOTO = 339;
2756
PHP.Parser.prototype.T_FUNCTION = 340;
2757
PHP.Parser.prototype.T_CONST = 341;
2758
PHP.Parser.prototype.T_RETURN = 342;
2759
PHP.Parser.prototype.T_TRY = 343;
2760
PHP.Parser.prototype.T_CATCH = 344;
2761
PHP.Parser.prototype.T_FINALLY = 345;
2762
PHP.Parser.prototype.T_THROW = 346;
2763
PHP.Parser.prototype.T_USE = 347;
2764
PHP.Parser.prototype.T_INSTEADOF = 348;
2765
PHP.Parser.prototype.T_GLOBAL = 349;
2766
PHP.Parser.prototype.T_STATIC = 350;
2767
PHP.Parser.prototype.T_ABSTRACT = 351;
2768
PHP.Parser.prototype.T_FINAL = 352;
2769
PHP.Parser.prototype.T_PRIVATE = 353;
2770
PHP.Parser.prototype.T_PROTECTED = 354;
2771
PHP.Parser.prototype.T_PUBLIC = 355;
2772
PHP.Parser.prototype.T_VAR = 356;
2773
PHP.Parser.prototype.T_UNSET = 357;
2774
PHP.Parser.prototype.T_ISSET = 358;
2775
PHP.Parser.prototype.T_EMPTY = 359;
2776
PHP.Parser.prototype.T_HALT_COMPILER = 360;
2777
PHP.Parser.prototype.T_CLASS = 361;
2778
PHP.Parser.prototype.T_TRAIT = 362;
2779
PHP.Parser.prototype.T_INTERFACE = 363;
2780
PHP.Parser.prototype.T_EXTENDS = 364;
2781
PHP.Parser.prototype.T_IMPLEMENTS = 365;
2782
PHP.Parser.prototype.T_OBJECT_OPERATOR = 366;
2783
PHP.Parser.prototype.T_LIST = 367;
2784
PHP.Parser.prototype.T_ARRAY = 368;
2785
PHP.Parser.prototype.T_CALLABLE = 369;
2786
PHP.Parser.prototype.T_CLASS_C = 370;
2787
PHP.Parser.prototype.T_TRAIT_C = 371;
2788
PHP.Parser.prototype.T_METHOD_C = 372;
2789
PHP.Parser.prototype.T_FUNC_C = 373;
2790
PHP.Parser.prototype.T_LINE = 374;
2791
PHP.Parser.prototype.T_FILE = 375;
2792
PHP.Parser.prototype.T_COMMENT = 376;
2793
PHP.Parser.prototype.T_DOC_COMMENT = 377;
2794
PHP.Parser.prototype.T_OPEN_TAG = 378;
2795
PHP.Parser.prototype.T_OPEN_TAG_WITH_ECHO = 379;
2796
PHP.Parser.prototype.T_CLOSE_TAG = 380;
2797
PHP.Parser.prototype.T_WHITESPACE = 381;
2798
PHP.Parser.prototype.T_START_HEREDOC = 382;
2799
PHP.Parser.prototype.T_END_HEREDOC = 383;
2800
PHP.Parser.prototype.T_DOLLAR_OPEN_CURLY_BRACES = 384;
2801
PHP.Parser.prototype.T_CURLY_OPEN = 385;
2802
PHP.Parser.prototype.T_PAAMAYIM_NEKUDOTAYIM = 386;
2803
PHP.Parser.prototype.T_NAMESPACE = 387;
2804
PHP.Parser.prototype.T_NS_C = 388;
2805
PHP.Parser.prototype.T_DIR = 389;
2806
PHP.Parser.prototype.T_NS_SEPARATOR = 390;
2807
PHP.Parser.prototype.T_ELLIPSIS = 391;
2808
PHP.Parser.prototype.terminals = [
2809
    "$EOF",
2810
    "error",
2811
    "T_INCLUDE",
2812
    "T_INCLUDE_ONCE",
2813
    "T_EVAL",
2814
    "T_REQUIRE",
2815
    "T_REQUIRE_ONCE",
2816
    "','",
2817
    "T_LOGICAL_OR",
2818
    "T_LOGICAL_XOR",
2819
    "T_LOGICAL_AND",
2820
    "T_PRINT",
2821
    "T_YIELD",
2822
    "T_DOUBLE_ARROW",
2823
    "T_YIELD_FROM",
2824
    "'='",
2825
    "T_PLUS_EQUAL",
2826
    "T_MINUS_EQUAL",
2827
    "T_MUL_EQUAL",
2828
    "T_DIV_EQUAL",
2829
    "T_CONCAT_EQUAL",
2830
    "T_MOD_EQUAL",
2831
    "T_AND_EQUAL",
2832
    "T_OR_EQUAL",
2833
    "T_XOR_EQUAL",
2834
    "T_SL_EQUAL",
2835
    "T_SR_EQUAL",
2836
    "T_POW_EQUAL",
2837
    "'?'",
2838
    "':'",
2839
    "T_COALESCE",
2840
    "T_BOOLEAN_OR",
2841
    "T_BOOLEAN_AND",
2842
    "'|'",
2843
    "'^'",
2844
    "'&'",
2845
    "T_IS_EQUAL",
2846
    "T_IS_NOT_EQUAL",
2847
    "T_IS_IDENTICAL",
2848
    "T_IS_NOT_IDENTICAL",
2849
    "T_SPACESHIP",
2850
    "'<'",
2851
    "T_IS_SMALLER_OR_EQUAL",
2852
    "'>'",
2853
    "T_IS_GREATER_OR_EQUAL",
2854
    "T_SL",
2855
    "T_SR",
2856
    "'+'",
2857
    "'-'",
2858
    "'.'",
2859
    "'*'",
2860
    "'/'",
2861
    "'%'",
2862
    "'!'",
2863
    "T_INSTANCEOF",
2864
    "'~'",
2865
    "T_INC",
2866
    "T_DEC",
2867
    "T_INT_CAST",
2868
    "T_DOUBLE_CAST",
2869
    "T_STRING_CAST",
2870
    "T_ARRAY_CAST",
2871
    "T_OBJECT_CAST",
2872
    "T_BOOL_CAST",
2873
    "T_UNSET_CAST",
2874
    "'@'",
2875
    "T_POW",
2876
    "'['",
2877
    "T_NEW",
2878
    "T_CLONE",
2879
    "T_EXIT",
2880
    "T_IF",
2881
    "T_ELSEIF",
2882
    "T_ELSE",
2883
    "T_ENDIF",
2884
    "T_LNUMBER",
2885
    "T_DNUMBER",
2886
    "T_STRING",
2887
    "T_STRING_VARNAME",
2888
    "T_VARIABLE",
2889
    "T_NUM_STRING",
2890
    "T_INLINE_HTML",
2891
    "T_ENCAPSED_AND_WHITESPACE",
2892
    "T_CONSTANT_ENCAPSED_STRING",
2893
    "T_ECHO",
2894
    "T_DO",
2895
    "T_WHILE",
2896
    "T_ENDWHILE",
2897
    "T_FOR",
2898
    "T_ENDFOR",
2899
    "T_FOREACH",
2900
    "T_ENDFOREACH",
2901
    "T_DECLARE",
2902
    "T_ENDDECLARE",
2903
    "T_AS",
2904
    "T_SWITCH",
2905
    "T_ENDSWITCH",
2906
    "T_CASE",
2907
    "T_DEFAULT",
2908
    "T_BREAK",
2909
    "T_CONTINUE",
2910
    "T_GOTO",
2911
    "T_FUNCTION",
2912
    "T_CONST",
2913
    "T_RETURN",
2914
    "T_TRY",
2915
    "T_CATCH",
2916
    "T_FINALLY",
2917
    "T_THROW",
2918
    "T_USE",
2919
    "T_INSTEADOF",
2920
    "T_GLOBAL",
2921
    "T_STATIC",
2922
    "T_ABSTRACT",
2923
    "T_FINAL",
2924
    "T_PRIVATE",
2925
    "T_PROTECTED",
2926
    "T_PUBLIC",
2927
    "T_VAR",
2928
    "T_UNSET",
2929
    "T_ISSET",
2930
    "T_EMPTY",
2931
    "T_HALT_COMPILER",
2932
    "T_CLASS",
2933
    "T_TRAIT",
2934
    "T_INTERFACE",
2935
    "T_EXTENDS",
2936
    "T_IMPLEMENTS",
2937
    "T_OBJECT_OPERATOR",
2938
    "T_LIST",
2939
    "T_ARRAY",
2940
    "T_CALLABLE",
2941
    "T_CLASS_C",
2942
    "T_TRAIT_C",
2943
    "T_METHOD_C",
2944
    "T_FUNC_C",
2945
    "T_LINE",
2946
    "T_FILE",
2947
    "T_START_HEREDOC",
2948
    "T_END_HEREDOC",
2949
    "T_DOLLAR_OPEN_CURLY_BRACES",
2950
    "T_CURLY_OPEN",
2951
    "T_PAAMAYIM_NEKUDOTAYIM",
2952
    "T_NAMESPACE",
2953
    "T_NS_C",
2954
    "T_DIR",
2955
    "T_NS_SEPARATOR",
2956
    "T_ELLIPSIS",
2957
    "';'",
2958
    "'{'",
2959
    "'}'",
2960
    "'('",
2961
    "')'",
2962
    "'`'",
2963
    "']'",
2964
    "'\"'",
2965
    "'$'"
2966
    , "???"
2967
];
2968
PHP.Parser.prototype.translate = [
2969
        0,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2970
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2971
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2972
      157,  157,  157,   53,  155,  157,  156,   52,   35,  157,
2973
      151,  152,   50,   47,    7,   48,   49,   51,  157,  157,
2974
      157,  157,  157,  157,  157,  157,  157,  157,   29,  148,
2975
       41,   15,   43,   28,   65,  157,  157,  157,  157,  157,
2976
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2977
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2978
      157,   67,  157,  154,   34,  157,  153,  157,  157,  157,
2979
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2980
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2981
      157,  157,  157,  149,   33,  150,   55,  157,  157,  157,
2982
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2983
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2984
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2985
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2986
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2987
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2988
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2989
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2990
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2991
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2992
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2993
      157,  157,  157,  157,  157,  157,  157,  157,  157,  157,
2994
      157,  157,  157,  157,  157,  157,    1,    2,    3,    4,
2995
        5,    6,    8,    9,   10,   11,   12,   13,   14,   16,
2996
       17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
2997
       27,   30,   31,   32,   36,   37,   38,   39,   40,   42,
2998
       44,   45,   46,   54,   56,   57,   58,   59,   60,   61,
2999
       62,   63,   64,   66,   68,   69,   70,   71,   72,   73,
3000
       74,   75,   76,   77,   78,   79,   80,   81,  157,  157,
3001
       82,   83,   84,   85,   86,   87,   88,   89,   90,   91,
3002
       92,   93,   94,   95,   96,   97,   98,   99,  100,  101,
3003
      102,  103,  104,  105,  106,  107,  108,  109,  110,  111,
3004
      112,  113,  114,  115,  116,  117,  118,  119,  120,  121,
3005
      122,  123,  124,  125,  126,  127,  128,  129,  130,  131,
3006
      132,  133,  134,  135,  136,  137,  157,  157,  157,  157,
3007
      157,  157,  138,  139,  140,  141,  142,  143,  144,  145,
3008
      146,  147
3009
];
3010

    
3011
PHP.Parser.prototype.yyaction = [
3012
      569,  570,  571,  572,  573,  215,  574,  575,  576,  612,
3013
      613,    0,   27,   99,  100,  101,  102,  103,  104,  105,
3014
      106,  107,  108,  109,  110,-32766,-32766,-32766,   95,   96,
3015
       97,   24,  240,  226, -267,-32766,-32766,-32766,-32766,-32766,
3016
    -32766,  530,  344,  114,   98,-32766,  286,-32766,-32766,-32766,
3017
    -32766,-32766,  577,  870,  872,-32766,-32766,-32766,-32766,-32766,
3018
    -32766,-32766,-32766,  224,-32766,  714,  578,  579,  580,  581,
3019
      582,  583,  584,-32766,  264,  644,  840,  841,  842,  839,
3020
      838,  837,  585,  586,  587,  588,  589,  590,  591,  592,
3021
      593,  594,  595,  615,  616,  617,  618,  619,  607,  608,
3022
      609,  610,  611,  596,  597,  598,  599,  600,  601,  602,
3023
      638,  639,  640,  641,  642,  643,  603,  604,  605,  606,
3024
      636,  627,  625,  626,  622,  623,  116,  614,  620,  621,
3025
      628,  629,  631,  630,  632,  633,   42,   43,  381,   44,
3026
       45,  624,  635,  634, -214,   46,   47,  289,   48,-32767,
3027
    -32767,-32767,-32767,   90,   91,   92,   93,   94,  267,  241,
3028
       22,  840,  841,  842,  839,  838,  837,  832,-32766,-32766,
3029
    -32766,  306, 1000, 1000, 1037,  120,  966,  436, -423,  244,
3030
      797,   49,   50,  660,  661,  272,  362,   51,-32766,   52,
3031
      219,  220,   53,   54,   55,   56,   57,   58,   59,   60,
3032
     1016,   22,  238,   61,  351,  945,-32766,-32766,-32766,  967,
3033
      968,  646,  705, 1000,   28, -456,  125,  966,-32766,-32766,
3034
    -32766,  715,  398,  399,  216, 1000,-32766,  339,-32766,-32766,
3035
    -32766,-32766,   25,  222,  980,  552,  355,  378,-32766, -423,
3036
    -32766,-32766,-32766,  121,   65, 1045,  408, 1047, 1046,  274,
3037
      274,  131,  244, -423,  394,  395,  358,  519,  945,  537,
3038
     -423,  111, -426,  398,  399,  130,  972,  973,  974,  975,
3039
      969,  970,  243,  128, -422, -421, 1013,  409,  976,  971,
3040
      353,  791,  792,    7, -162,   63,  124,  255,  701,  256,
3041
      274,  382, -122, -122, -122,   -4,  715,  383,  646, 1042,
3042
     -421,  704,  274, -219,   33,   17,  384, -122,  385, -122,
3043
      386, -122,  387, -122,  369,  388, -122, -122, -122,   34,
3044
       35,  389,  352,  520,   36,  390,  353,  702,   62,  112,
3045
      818,  287,  288,  391,  392, -422, -421, -161,  350,  393,
3046
       40,   38,  690,  735,  396,  397,  361,   22,  122, -422,
3047
     -421,-32766,-32766,-32766,  791,  792, -422, -421, -425, 1000,
3048
     -456, -421, -238,  966,  409,   41,  382,  353,  717,  535,
3049
     -122,-32766,  383,-32766,-32766, -421,  704,   21,  813,   33,
3050
       17,  384, -421,  385, -466,  386,  224,  387, -467,  273,
3051
      388,  367,  945, -458,   34,   35,  389,  352,  345,   36,
3052
      390,  248,  247,   62,  254,  715,  287,  288,  391,  392,
3053
      399,-32766,-32766,-32766,  393,  295, 1000,  652,  735,  396,
3054
      397,  117,  115,  113,  814,  119,   72,   73,   74, -162,
3055
      764,   65,  240,  541,  370,  518,  274,  118,  270,   92,
3056
       93,   94,  242,  717,  535,   -4,   26, 1000,   75,   76,
3057
       77,   78,   79,   80,   81,   82,   83,   84,   85,   86,
3058
       87,   88,   89,   90,   91,   92,   93,   94,   95,   96,
3059
       97,  547,  240,  713,  715,  382,  276,-32766,-32766,  126,
3060
      945,  383, -161,  938,   98,  704,  225,  659,   33,   17,
3061
      384,  346,  385,  274,  386,  728,  387,  221,  120,  388,
3062
      505,  506,  540,   34,   35,  389,  715, -238,   36,  390,
3063
     1017,  223,   62,  494,   18,  287,  288,  127,  297,  376,
3064
        6,   98,  798,  393,  274,  660,  661,  490,  491, -466,
3065
       39, -466,  514, -467,  539, -467,   16,  458, -458,  315,
3066
      791,  792,  829,  553,  382,  817,  563,  653,  538,  765,
3067
      383,  449,  751,  535,  704,  448,  435,   33,   17,  384,
3068
      430,  385,  646,  386,  359,  387,  357,  647,  388,  673,
3069
      429, 1040,   34,   35,  389,  715,  382,   36,  390,  941,
3070
      492,   62,  383,  503,  287,  288,  704,  434,  440,   33,
3071
       17,  384,  393,  385,-32766,  386,  445,  387,  495,  509,
3072
      388,   10,  529,  542,   34,   35,  389,  715,  515,   36,
3073
      390,  499,  500,   62,  214,  -80,  287,  288,  452,  269,
3074
      736,  717,  535,  488,  393,  356,  266,  979,  265,  730,
3075
      982,  722,  358,  338,  493,  548,    0,  294,  737,    0,
3076
        3,    0,  309,    0,    0,  382,    0,    0,  271,    0,
3077
        0,  383,    0,  717,  535,  704,  227,    0,   33,   17,
3078
      384,    9,  385,    0,  386,    0,  387, -382,    0,  388,
3079
        0,    0,  325,   34,   35,  389,  715,  382,   36,  390,
3080
      321,  341,   62,  383,  340,  287,  288,  704,   22,  320,
3081
       33,   17,  384,  393,  385,  442,  386,  337,  387,  562,
3082
     1000,  388,   32,   31,  966,   34,   35,  389,  823,  657,
3083
       36,  390,  656,  821,   62,  703,  711,  287,  288,  561,
3084
      822,  825,  717,  535,  695,  393,  747,  749,  693,  759,
3085
      758,  752,  767,  945,  824,  706,  700,  712,  699,  698,
3086
      658,    0,  263,  262,  559,  558,  382,  556,  554,  551,
3087
      398,  399,  383,  550,  717,  535,  704,  546,  545,   33,
3088
       17,  384,  543,  385,  536,  386,   71,  387,  933,  932,
3089
      388,   30,   65,  731,   34,   35,  389,  274,  724,   36,
3090
      390,  830,  734,   62,  663,  662,  287,  288,-32766,-32766,
3091
    -32766,  733,  732,  934,  393,  665,  664,  756,  555,  691,
3092
     1041, 1001,  994, 1006, 1011, 1014,  757, 1043,-32766,  654,
3093
    -32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767,
3094
    -32767,  655, 1044,  717,  535, -446,  926,  348,  343,  268,
3095
      237,  236,  235,  234,  218,  217,  132,  129, -426, -425,
3096
     -424,  123,   20,   23,   70,   69,   29,   37,   64,   68,
3097
       66,   67, -448,    0,   15,   19,  250,  910,  296, -217,
3098
      467,  484,  909,  472,  528,  913,   11,  964,  955, -215,
3099
      525,  379,  375,  373,  371,   14,   13,   12, -214,    0,
3100
     -393,    0, 1005, 1039,  992,  993,  963,    0,  981
3101
];
3102

    
3103
PHP.Parser.prototype.yycheck = [
3104
        2,    3,    4,    5,    6,   13,    8,    9,   10,   11,
3105
       12,    0,   15,   16,   17,   18,   19,   20,   21,   22,
3106
       23,   24,   25,   26,   27,    8,    9,   10,   50,   51,
3107
       52,    7,   54,    7,   79,    8,    9,   10,    8,    9,
3108
       10,   77,    7,   13,   66,   28,    7,   30,   31,   32,
3109
       33,   34,   54,   56,   57,   28,    8,   30,   31,   32,
3110
       33,   34,   35,   35,  109,    1,   68,   69,   70,   71,
3111
       72,   73,   74,  118,    7,   77,  112,  113,  114,  115,
3112
      116,  117,   84,   85,   86,   87,   88,   89,   90,   91,
3113
       92,   93,   94,   95,   96,   97,   98,   99,  100,  101,
3114
      102,  103,  104,  105,  106,  107,  108,  109,  110,  111,
3115
      112,  113,  114,  115,  116,  117,  118,  119,  120,  121,
3116
      122,  123,  124,  125,  126,  127,    7,  129,  130,  131,
3117
      132,  133,  134,  135,  136,  137,    2,    3,    4,    5,
3118
        6,  143,  144,  145,  152,   11,   12,    7,   14,   41,
3119
       42,   43,   44,   45,   46,   47,   48,   49,  109,    7,
3120
       67,  112,  113,  114,  115,  116,  117,  118,    8,    9,
3121
       10,   79,   79,   79,   82,  147,   83,   82,   67,   28,
3122
      152,   47,   48,  102,  103,    7,    7,   53,   28,   55,
3123
       56,   57,   58,   59,   60,   61,   62,   63,   64,   65,
3124
        1,   67,   68,   69,   70,  112,    8,    9,   10,   75,
3125
       76,   77,  148,   79,   13,    7,   67,   83,    8,    9,
3126
       10,    1,  129,  130,   13,   79,   28,  146,   30,   31,
3127
       32,   33,  140,  141,  139,   29,  102,    7,   28,  128,
3128
       30,   31,   32,  149,  151,   77,  112,   79,   80,  156,
3129
      156,   15,   28,  142,  120,  121,  146,   77,  112,  149,
3130
      149,   15,  151,  129,  130,   15,  132,  133,  134,  135,
3131
      136,  137,  138,   15,   67,   67,   77,  143,  144,  145,
3132
      146,  130,  131,    7,    7,  151,   15,  153,  148,  155,
3133
      156,   71,   72,   73,   74,    0,    1,   77,   77,  150,
3134
       67,   81,  156,  152,   84,   85,   86,   87,   88,   89,
3135
       90,   91,   92,   93,   29,   95,   96,   97,   98,   99,
3136
      100,  101,  102,  143,  104,  105,  146,  148,  108,   15,
3137
      150,  111,  112,  113,  114,  128,  128,    7,    7,  119,
3138
       67,   67,  122,  123,  124,  125,    7,   67,  149,  142,
3139
      142,    8,    9,   10,  130,  131,  149,  149,  151,   79,
3140
      152,  128,    7,   83,  143,    7,   71,  146,  148,  149,
3141
      150,   28,   77,   30,   31,  142,   81,    7,  148,   84,
3142
       85,   86,  149,   88,    7,   90,   35,   92,    7,   33,
3143
       95,    7,  112,    7,   99,  100,  101,  102,  103,  104,
3144
      105,  128,  128,  108,  109,    1,  111,  112,  113,  114,
3145
      130,    8,    9,   10,  119,  142,   79,  122,  123,  124,
3146
      125,   15,  149,  149,  148,   29,    8,    9,   10,  152,
3147
       29,  151,   54,   29,  149,   79,  156,   15,  143,   47,
3148
       48,   49,   29,  148,  149,  150,   28,   79,   30,   31,
3149
       32,   33,   34,   35,   36,   37,   38,   39,   40,   41,
3150
       42,   43,   44,   45,   46,   47,   48,   49,   50,   51,
3151
       52,   29,   54,   29,    1,   71,   67,    8,    9,   29,
3152
      112,   77,  152,  152,   66,   81,   35,  148,   84,   85,
3153
       86,  123,   88,  156,   90,   35,   92,   35,  147,   95,
3154
       72,   73,   29,   99,  100,  101,    1,  152,  104,  105,
3155
      152,   35,  108,   72,   73,  111,  112,   97,   98,  102,
3156
      103,   66,  152,  119,  156,  102,  103,  106,  107,  152,
3157
       67,  154,   74,  152,   29,  154,  152,  128,  152,   78,
3158
      130,  131,  148,  149,   71,  148,  149,  148,  149,  148,
3159
       77,   77,  148,  149,   81,   77,   77,   84,   85,   86,
3160
       77,   88,   77,   90,   77,   92,   77,   77,   95,   77,
3161
       77,   77,   99,  100,  101,    1,   71,  104,  105,   79,
3162
       79,  108,   77,   79,  111,  112,   81,   79,   82,   84,
3163
       85,   86,  119,   88,   82,   90,   86,   92,   87,   96,
3164
       95,   94,   89,   29,   99,  100,  101,    1,   91,  104,
3165
      105,   93,   96,  108,   94,   94,  111,  112,   94,  110,
3166
      123,  148,  149,  109,  119,  102,  127,  139,  126,  147,
3167
      139,  150,  146,  149,  154,   29,   -1,  142,  123,   -1,
3168
      142,   -1,  146,   -1,   -1,   71,   -1,   -1,  126,   -1,
3169
       -1,   77,   -1,  148,  149,   81,   35,   -1,   84,   85,
3170
       86,  142,   88,   -1,   90,   -1,   92,  142,   -1,   95,
3171
       -1,   -1,  146,   99,  100,  101,    1,   71,  104,  105,
3172
      146,  146,  108,   77,  146,  111,  112,   81,   67,  146,
3173
       84,   85,   86,  119,   88,  146,   90,  149,   92,  148,
3174
       79,   95,  148,  148,   83,   99,  100,  101,  148,  148,
3175
      104,  105,  148,  148,  108,  148,  148,  111,  112,  148,
3176
      148,  148,  148,  149,  148,  119,  148,  148,  148,  148,
3177
      148,  148,  148,  112,  148,  148,  148,  148,  148,  148,
3178
      148,   -1,  149,  149,  149,  149,   71,  149,  149,  149,
3179
      129,  130,   77,  149,  148,  149,   81,  149,  149,   84,
3180
       85,   86,  149,   88,  149,   90,  149,   92,  150,  150,
3181
       95,  151,  151,  150,   99,  100,  101,  156,  150,  104,
3182
      105,  150,  150,  108,  150,  150,  111,  112,    8,    9,
3183
       10,  150,  150,  150,  119,  150,  150,  150,  150,  150,
3184
      150,  150,  150,  150,  150,  150,  150,  150,   28,  150,
3185
       30,   31,   32,   33,   34,   35,   36,   37,   38,   39,
3186
       40,  150,  150,  148,  149,  151,  153,  151,  151,  151,
3187
      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
3188
      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
3189
      151,  151,  151,   -1,  152,  152,  152,  152,  152,  152,
3190
      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,
3191
      152,  152,  152,  152,  152,  152,  152,  152,  152,   -1,
3192
      153,   -1,  154,  154,  154,  154,  154,   -1,  155
3193
];
3194

    
3195
PHP.Parser.prototype.yybase = [
3196
        0,  220,  295,   94,  180,  560,   -2,   -2,   -2,   -2,
3197
      -36,  473,  574,  606,  574,  505,  404,  675,  675,  675,
3198
       28,  351,  462,  462,  462,  461,  396,  476,  451,  134,
3199
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3200
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3201
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3202
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3203
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3204
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3205
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3206
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3207
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3208
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3209
      134,  134,  134,  401,   64,  201,  568,  704,  713,  708,
3210
      702,  714,  520,  706,  705,  211,  650,  651,  450,  652,
3211
      653,  654,  655,  709,  480,  703,  712,  418,  418,  418,
3212
      418,  418,  418,  418,  418,  418,  418,  418,  418,  418,
3213
      418,  418,  418,   48,   30,  469,  403,  403,  403,  403,
3214
      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
3215
      403,  403,  403,  403,  403,  160,  160,  160,  343,  210,
3216
      208,  198,   17,  233,   27,  780,  780,  780,  780,  780,
3217
      108,  108,  108,  108,  621,  621,   93,  280,  280,  280,
3218
      280,  280,  280,  280,  280,  280,  280,  280,  632,  641,
3219
      642,  643,  392,  392,  151,  151,  151,  151,  368,  -45,
3220
      146,  224,  224,   95,  410,  491,  733,  199,  199,  111,
3221
      207,  -22,  -22,  -22,   81,  506,   92,   92,  233,  233,
3222
      273,  233,  423,  423,  423,  221,  221,  221,  221,  221,
3223
      110,  221,  221,  221,  617,  512,  168,  516,  647,  397,
3224
      503,  656,  274,  381,  377,  538,  535,  337,  523,  337,
3225
      421,  441,  428,  525,  337,  337,  285,  401,  394,  378,
3226
      567,  474,  339,  564,  140,  179,  409,  399,  384,  594,
3227
      561,  711,  330,  710,  358,  149,  378,  378,  378,  370,
3228
      593,  548,  355,   -8,  646,  484,  277,  417,  386,  645,
3229
      635,  230,  634,  276,  331,  356,  565,  485,  485,  485,
3230
      485,  485,  485,  460,  485,  483,  691,  691,  478,  501,
3231
      460,  696,  460,  485,  691,  460,  460,  502,  485,  522,
3232
      522,  483,  508,  499,  691,  691,  499,  478,  460,  571,
3233
      551,  514,  482,  413,  413,  514,  460,  413,  501,  413,
3234
       11,  697,  699,  444,  700,  695,  698,  676,  694,  493,
3235
      615,  497,  515,  684,  683,  693,  479,  489,  620,  692,
3236
      549,  592,  487,  246,  314,  498,  463,  689,  523,  486,
3237
      455,  455,  455,  463,  687,  455,  455,  455,  455,  455,
3238
      455,  455,  455,  732,   24,  495,  510,  591,  590,  589,
3239
      406,  588,  496,  524,  422,  599,  488,  549,  549,  649,
3240
      727,  673,  490,  682,  716,  690,  555,  119,  271,  681,
3241
      648,  543,  492,  534,  680,  598,  246,  715,  494,  672,
3242
      549,  671,  455,  674,  701,  730,  731,  688,  728,  722,
3243
      152,  526,  587,  178,  729,  659,  596,  595,  554,  725,
3244
      707,  721,  720,  178,  576,  511,  717,  518,  677,  504,
3245
      678,  613,  258,  657,  686,  584,  724,  723,  726,  583,
3246
      582,  609,  608,  250,  236,  685,  442,  458,  517,  581,
3247
      500,  628,  604,  679,  580,  579,  623,  619,  718,  521,
3248
      486,  519,  509,  507,  513,  600,  618,  719,  206,  578,
3249
      586,  573,  481,  572,  631,    0,    0,    0,    0,    0,
3250
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3251
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3252
        0,    0,    0,    0,    0,  134,  134,   -2,   -2,   -2,
3253
        0,    0,    0,    0,   -2,  134,  134,  134,  134,  134,
3254
      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
3255
      134,  134,  134,    0,    0,    0,    0,    0,    0,    0,
3256
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3257
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3258
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3259
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3260
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3261
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3262
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3263
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3264
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3265
        0,    0,    0,    0,    0,    0,    0,  418,  418,  418,
3266
      418,  418,  418,  418,  418,  418,  418,  418,  418,  418,
3267
      418,  418,  418,  418,  418,  418,  418,  418,  418,  418,
3268
      418,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3269
        0,    0,    0,    0,    0,    0,    0,  418,  418,  418,
3270
      418,  418,  418,  418,  418,  418,  418,  418,  418,  418,
3271
      418,  418,  418,  418,  418,  418,  418,  418,  418,  418,
3272
      418,  418,  418,  418,   -3,  418,  418,   -3,  418,  418,
3273
      418,  418,  418,  418,  -22,  -22,  -22,  -22,  221,  221,
3274
      221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
3275
      221,  221,   49,   49,   49,   49,  -22,  -22,  221,  221,
3276
      221,  221,  221,   49,  221,  221,  221,   92,  221,   92,
3277
       92,  337,  337,    0,    0,    0,    0,    0,  485,   92,
3278
        0,    0,    0,    0,    0,    0,  485,  485,  485,    0,
3279
        0,    0,    0,    0,  485,    0,    0,    0,  337,   92,
3280
        0,  420,  420,  178,  420,  420,    0,    0,    0,  485,
3281
      485,    0,  508,    0,    0,    0,    0,  691,    0,    0,
3282
        0,    0,    0,  455,  119,  682,    0,   39,    0,    0,
3283
        0,    0,    0,  490,   39,   26,    0,   26,    0,    0,
3284
      455,  455,  455,    0,  490,  490,    0,    0,   67,  490,
3285
        0,    0,    0,   67,   35,    0,   35,    0,    0,    0,
3286
      178
3287
];
3288

    
3289
PHP.Parser.prototype.yydefault = [
3290
        3,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3291
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3292
    32767,32767,  468,  468,  468,32767,32767,32767,32767,  285,
3293
      460,  285,  285,32767,  419,  419,  419,  419,  419,  419,
3294
      419,  460,32767,32767,32767,32767,32767,  364,32767,32767,
3295
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3296
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3297
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3298
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3299
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3300
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3301
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3302
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3303
    32767,32767,32767,32767,32767,  465,32767,32767,32767,32767,
3304
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3305
    32767,32767,32767,32767,32767,32767,32767,  347,  348,  350,
3306
      351,  284,  420,  237,  464,  283,  116,  246,  239,  191,
3307
      282,  223,  119,  312,  365,  314,  363,  367,  313,  290,
3308
      294,  295,  296,  297,  298,  299,  300,  301,  302,  303,
3309
      304,  305,  288,  289,  366,  344,  343,  342,  310,  311,
3310
      287,  315,  317,  287,  316,  333,  334,  331,  332,  335,
3311
      336,  337,  338,  339,32767,32767,32767,32767,32767,32767,
3312
    32767,32767,32767,32767,32767,32767,32767,32767,  269,  269,
3313
      269,  269,  324,  325,  229,  229,  229,  229,32767,  270,
3314
    32767,  229,32767,32767,32767,32767,32767,32767,32767,  413,
3315
      341,  319,  320,  318,32767,  392,32767,  394,  307,  309,
3316
      387,  291,32767,32767,32767,32767,32767,32767,32767,32767,
3317
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3318
    32767,32767,  389,  421,  421,32767,32767,32767,  381,32767,
3319
      159,  210,  212,  397,32767,32767,32767,32767,32767,  329,
3320
    32767,32767,32767,32767,32767,32767,  474,32767,32767,32767,
3321
    32767,32767,  421,32767,32767,32767,  321,  322,  323,32767,
3322
    32767,32767,  421,  421,32767,32767,  421,32767,  421,32767,
3323
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3324
    32767,32767,32767,  163,32767,32767,  395,  395,32767,32767,
3325
      163,  390,  163,32767,32767,  163,  163,  176,32767,  174,
3326
      174,32767,32767,  178,32767,  435,  178,32767,  163,  196,
3327
      196,  373,  165,  231,  231,  373,  163,  231,32767,  231,
3328
    32767,32767,32767,   82,32767,32767,32767,32767,32767,32767,
3329
    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3330
      383,32767,32767,32767,  401,32767,  414,  433,  381,32767,
3331
      327,  328,  330,32767,  423,  352,  353,  354,  355,  356,
3332
      357,  358,  360,32767,  461,  386,32767,32767,32767,32767,
3333
    32767,32767,   84,  108,  245,32767,  473,   84,  384,32767,
3334
      473,32767,32767,32767,32767,32767,32767,  286,32767,32767,
3335
    32767,   84,32767,   84,32767,32767,  457,32767,32767,  421,
3336
      385,32767,  326,  398,  439,32767,32767,  422,32767,32767,
3337
      218,   84,32767,  177,32767,32767,32767,32767,32767,32767,
3338
      401,32767,32767,  179,32767,32767,  421,32767,32767,32767,
3339
    32767,32767,  281,32767,32767,32767,32767,32767,  421,32767,
3340
    32767,32767,32767,  222,32767,32767,32767,32767,32767,32767,
3341
    32767,32767,32767,32767,32767,32767,32767,32767,32767,   82,
3342
       60,32767,  263,32767,32767,32767,32767,32767,32767,32767,
3343
    32767,32767,32767,32767,32767,  121,  121,    3,    3,  121,
3344
      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
3345
      121,  121,  121,  121,  248,  154,  248,  204,  248,  248,
3346
      207,  196,  196,  255
3347
];
3348

    
3349
PHP.Parser.prototype.yygoto = [
3350
      163,  163,  135,  135,  135,  146,  148,  179,  164,  161,
3351
      145,  161,  161,  161,  162,  162,  162,  162,  162,  162,
3352
      162,  145,  157,  158,  159,  160,  176,  174,  177,  410,
3353
      411,  299,  412,  415,  416,  417,  418,  419,  420,  421,
3354
      422,  857,  136,  137,  138,  139,  140,  141,  142,  143,
3355
      144,  147,  173,  175,  178,  195,  198,  199,  201,  202,
3356
      204,  205,  206,  207,  208,  209,  210,  211,  212,  213,
3357
      232,  233,  251,  252,  253,  316,  317,  318,  462,  180,
3358
      181,  182,  183,  184,  185,  186,  187,  188,  189,  190,
3359
      191,  192,  193,  149,  194,  150,  165,  166,  167,  196,
3360
      168,  151,  152,  153,  169,  154,  197,  133,  170,  155,
3361
      171,  172,  156,  521,  200,  257,  246,  464,  432,  687,
3362
      649,  278,  481,  482,  527,  200,  437,  437,  437,  766,
3363
        5,  746,  650,  557,  437,  426,  775,  770,  428,  431,
3364
      444,  465,  466,  468,  483,  279,  651,  336,  450,  453,
3365
      437,  560,  485,  487,  508,  511,  763,  516,  517,  777,
3366
      524,  762,  526,  532,  773,  534,  480,  480,  965,  965,
3367
      965,  965,  965,  965,  965,  965,  965,  965,  965,  965,
3368
      413,  413,  413,  413,  413,  413,  413,  413,  413,  413,
3369
      413,  413,  413,  413,  942,  502,  478,  496,  512,  456,
3370
      298,  437,  437,  451,  471,  437,  437,  674,  437,  229,
3371
      456,  230,  231,  463,  828,  533,  681,  438,  513,  826,
3372
      461,  475,  460,  414,  414,  414,  414,  414,  414,  414,
3373
      414,  414,  414,  414,  414,  414,  414,  301,  674,  674,
3374
      443,  454, 1033, 1033, 1034, 1034,  425,  531,  425,  708,
3375
      750,  800,  457,  372, 1033,  943, 1034, 1026,  300, 1018,
3376
      497,    8,  313,  904,  796,  944,  996,  785,  789, 1007,
3377
      285,  670, 1036,  329,  307,  310,  804,  668,  544,  332,
3378
      935,  940,  366,  807,  678,  477,  377,  754,  844,    0,
3379
      667,  667,  675,  675,  675,  677,    0,  666,  323,  498,
3380
      328,  312,  312,  258,  259,  283,  459,  261,  322,  284,
3381
      326,  486,  280,  281,    0,    0,    0,    0,    0,    0,
3382
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3383
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3384
        0,    0,    0,  790,  790,  790,  790,  946,    0,  946,
3385
      790,  790, 1004,  790, 1004,    0,    0,    0,    0,  836,
3386
        0, 1015, 1015,    0,    0,    0,    0,    0,    0,    0,
3387
        0,    0,    0,    0,  744,  744,  744,  720,  744,    0,
3388
      739,  745,  721,  780,  780, 1023,    0,    0, 1002,    0,
3389
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
3390
        0,  806,    0,  806,    0,    0,    0,    0, 1008, 1009
3391
];
3392

    
3393
PHP.Parser.prototype.yygcheck = [
3394
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3395
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3396
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3397
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3398
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3399
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3400
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3401
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3402
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3403
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3404
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3405
       23,   23,   23,   52,   45,  112,  112,   80,    8,   10,
3406
       10,   64,   55,   55,   55,   45,    8,    8,    8,   10,
3407
       92,   10,   11,   10,    8,   10,   10,   10,   38,   38,
3408
       38,   38,   38,   38,   62,   62,   12,   62,   28,    8,
3409
        8,   28,   28,   28,   28,   28,   28,   28,   28,   28,
3410
       28,   28,   28,   28,   28,   28,   70,   70,   70,   70,
3411
       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
3412
      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,
3413
      113,  113,  113,  113,   76,   56,   35,   35,   56,   69,
3414
       56,    8,    8,    8,    8,    8,    8,   19,    8,   60,
3415
       69,   60,   60,    7,    7,    7,   25,    8,    7,    7,
3416
        2,    2,    8,  115,  115,  115,  115,  115,  115,  115,
3417
      115,  115,  115,  115,  115,  115,  115,   53,   19,   19,
3418
       53,   53,  123,  123,  124,  124,  109,    5,  109,   44,
3419
       29,   78,  114,   53,  123,   76,  124,  122,   41,  120,
3420
       43,   53,   42,   96,   74,   76,   76,   72,   75,  117,
3421
       14,   21,  123,   18,    9,   13,   79,   20,   66,   17,
3422
      102,  104,   58,   81,   22,   59,  100,   63,   94,   -1,
3423
       19,   19,   19,   19,   19,   19,   -1,   19,   45,   45,
3424
       45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
3425
       45,   45,   64,   64,   -1,   -1,   -1,   -1,   -1,   -1,
3426
       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
3427
       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
3428
       -1,   -1,   -1,   52,   52,   52,   52,   52,   -1,   52,
3429
       52,   52,   80,   52,   80,   -1,   -1,   -1,   -1,   92,
3430
       -1,   80,   80,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
3431
       -1,   -1,   -1,   -1,   52,   52,   52,   52,   52,   -1,
3432
       52,   52,   52,   69,   69,   69,   -1,   -1,   80,   -1,
3433
       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
3434
       -1,   80,   -1,   80,   -1,   -1,   -1,   -1,   80,   80
3435
];
3436

    
3437
PHP.Parser.prototype.yygbase = [
3438
        0,    0, -317,    0,    0,  237,    0,  210, -136,    4,
3439
      118,  130,  144,  -10,   16,    0,    0,  -59,   10,  -47,
3440
       -9,    7,  -77,  -20,    0,  209,    0,    0, -388,  234,
3441
        0,    0,    0,    0,    0,  165,    0,    0,  103,    0,
3442
        0,  225,   44,   45,  235,   84,    0,    0,    0,    0,
3443
        0,    0,  109, -115,    0, -113, -179,    0,  -78,  -81,
3444
     -347,    0, -122,  -80, -249,    0,  -19,    0,    0,  169,
3445
      -48,    0,   26,    0,   22,   24,  -99,    0,  230,  -13,
3446
      114,  -79,    0,    0,    0,    0,    0,    0,    0,    0,
3447
        0,    0,  120,    0,  -90,    0,   23,    0,    0,    0,
3448
      -89,    0,  -67,    0,  -69,    0,    0,    0,    0,    8,
3449
        0,    0, -140,  -34,  229,    9,    0,   21,    0,    0,
3450
      218,    0,  233,   -3,   -1,    0
3451
];
3452

    
3453
PHP.Parser.prototype.yygdefault = [
3454
    -32768,  380,  565,    2,  566,  637,  645,  504,  400,  433,
3455
      748,  688,  689,  303,  342,  401,  302,  330,  324,  676,
3456
      669,  671,  679,  134,  333,  682,    1,  684,  439,  716,
3457
      291,  692,  292,  507,  694,  446,  696,  697,  427,  304,
3458
      305,  447,  311,  479,  707,  203,  308,  709,  290,  710,
3459
      719,  335,  293,  510,  489,  469,  501,  402,  363,  476,
3460
      228,  455,  473,  753,  277,  761,  549,  769,  772,  403,
3461
      404,  470,  784,  368,  794,  788,  960,  319,  799,  805,
3462
      991,  808,  811,  349,  331,  327,  815,  816,    4,  820,
3463
      522,  523,  835,  239,  843,  856,  347,  923,  925,  441,
3464
      374,  936,  360,  334,  939,  995,  354,  405,  364,  952,
3465
      260,  282,  245,  406,  423,  249,  407,  365,  998,  314,
3466
     1019,  424, 1027, 1035,  275,  474
3467
];
3468

    
3469
PHP.Parser.prototype.yylhs = [
3470
        0,    1,    3,    3,    2,    5,    5,    5,    5,    5,
3471
        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
3472
        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
3473
        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
3474
        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
3475
        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
3476
        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
3477
        5,    5,    5,    6,    6,    6,    6,    6,    6,    6,
3478
        7,    7,    8,    8,    9,    4,    4,    4,    4,    4,
3479
        4,    4,    4,    4,    4,    4,   14,   14,   15,   15,
3480
       15,   15,   17,   17,   13,   13,   18,   18,   19,   19,
3481
       20,   20,   21,   21,   16,   16,   22,   24,   24,   25,
3482
       26,   26,   28,   27,   27,   27,   27,   29,   29,   29,
3483
       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
3484
       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
3485
       29,   29,   10,   10,   48,   48,   51,   51,   50,   49,
3486
       49,   42,   42,   53,   53,   54,   54,   11,   12,   12,
3487
       12,   57,   57,   57,   58,   58,   61,   61,   59,   59,
3488
       62,   62,   36,   36,   44,   44,   47,   47,   47,   46,
3489
       46,   63,   37,   37,   37,   37,   64,   64,   65,   65,
3490
       66,   66,   34,   34,   30,   30,   67,   32,   32,   68,
3491
       31,   31,   33,   33,   43,   43,   43,   43,   55,   55,
3492
       71,   71,   72,   72,   74,   74,   75,   75,   75,   73,
3493
       73,   56,   56,   76,   76,   77,   77,   78,   78,   78,
3494
       39,   39,   79,   40,   40,   81,   81,   60,   60,   82,
3495
       82,   82,   82,   87,   87,   88,   88,   89,   89,   89,
3496
       89,   89,   90,   91,   91,   86,   86,   83,   83,   85,
3497
       85,   93,   93,   92,   92,   92,   92,   92,   92,   84,
3498
       84,   94,   94,   41,   41,   35,   35,   23,   23,   23,
3499
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3500
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3501
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3502
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3503
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3504
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3505
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3506
       23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
3507
      101,   95,   95,  100,  100,  103,  103,  104,  105,  105,
3508
      105,  109,  109,   52,   52,   52,   96,   96,  107,  107,
3509
       97,   97,   99,   99,   99,  102,  102,  113,  113,   70,
3510
      115,  115,  115,   98,   98,   98,   98,   98,   98,   98,
3511
       98,   98,   98,   98,   98,   98,   98,   98,   98,   38,
3512
       38,  111,  111,  111,  106,  106,  106,  116,  116,  116,
3513
      116,  116,  116,   45,   45,   45,   80,   80,   80,  118,
3514
      110,  110,  110,  110,  110,  110,  108,  108,  108,  117,
3515
      117,  117,  117,   69,  119,  119,  120,  120,  120,  120,
3516
      120,  114,  121,  121,  122,  122,  122,  122,  122,  112,
3517
      112,  112,  112,  124,  123,  123,  123,  123,  123,  123,
3518
      123,  125,  125,  125
3519
];
3520

    
3521
PHP.Parser.prototype.yylen = [
3522
        1,    1,    2,    0,    1,    1,    1,    1,    1,    1,
3523
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3524
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3525
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3526
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3527
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3528
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3529
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3530
        1,    1,    1,    3,    1,    1,    1,    1,    1,    3,
3531
        5,    4,    3,    4,    2,    3,    1,    1,    7,    8,
3532
        6,    7,    3,    1,    3,    1,    3,    1,    1,    3,
3533
        1,    2,    1,    2,    3,    1,    3,    3,    1,    3,
3534
        2,    0,    1,    1,    1,    1,    1,    3,    7,   10,
3535
        5,    7,    9,    5,    3,    3,    3,    3,    3,    3,
3536
        1,    2,    5,    7,    9,    5,    6,    3,    3,    2,
3537
        2,    1,    1,    1,    0,    2,    1,    3,    8,    0,
3538
        4,    1,    3,    0,    1,    0,    1,   10,    7,    6,
3539
        5,    1,    2,    2,    0,    2,    0,    2,    0,    2,
3540
        1,    3,    1,    4,    1,    4,    1,    1,    4,    1,
3541
        3,    3,    3,    4,    4,    5,    0,    2,    4,    3,
3542
        1,    1,    1,    4,    0,    2,    5,    0,    2,    6,
3543
        0,    2,    0,    3,    1,    2,    1,    1,    1,    0,
3544
        1,    3,    4,    6,    1,    2,    1,    1,    1,    0,
3545
        1,    0,    2,    2,    3,    1,    3,    1,    2,    2,
3546
        3,    1,    1,    3,    1,    1,    3,    2,    0,    3,
3547
        4,    9,    3,    1,    3,    0,    2,    4,    5,    4,
3548
        4,    4,    3,    1,    1,    1,    3,    1,    1,    0,
3549
        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
3550
        3,    1,    3,    3,    1,    0,    1,    1,    3,    3,
3551
        3,    4,    1,    2,    3,    3,    3,    3,    3,    3,
3552
        3,    3,    3,    3,    3,    3,    2,    2,    2,    2,
3553
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
3554
        3,    3,    3,    3,    3,    3,    3,    2,    2,    2,
3555
        2,    3,    3,    3,    3,    3,    3,    3,    3,    3,
3556
        3,    3,    5,    4,    3,    4,    4,    2,    2,    4,
3557
        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
3558
        2,    1,    3,    2,    1,    2,    4,    2,   10,   11,
3559
        7,    3,    2,    0,    4,    1,    3,    2,    2,    2,
3560
        4,    1,    1,    1,    2,    3,    1,    1,    1,    1,
3561
        0,    3,    0,    1,    1,    0,    1,    1,    3,    3,
3562
        4,    1,    1,    1,    1,    1,    1,    1,    1,    1,
3563
        1,    1,    1,    1,    1,    3,    2,    3,    3,    0,
3564
        1,    1,    3,    1,    1,    3,    1,    1,    4,    4,
3565
        4,    1,    4,    1,    1,    3,    1,    4,    2,    3,
3566
        1,    4,    4,    3,    3,    3,    1,    3,    1,    1,
3567
        3,    1,    1,    4,    3,    1,    1,    1,    3,    3,
3568
        0,    1,    3,    1,    3,    1,    4,    2,    0,    2,
3569
        2,    1,    2,    1,    1,    4,    3,    3,    3,    6,
3570
        3,    1,    1,    1
3571
];
3572

    
3573

    
3574

    
3575
exports.PHP = PHP;
3576
});
3577

    
3578
ace.define("ace/mode/php_worker",[], function(require, exports, module) {
3579
"use strict";
3580

    
3581
var oop = require("../lib/oop");
3582
var Mirror = require("../worker/mirror").Mirror;
3583
var PHP = require("./php/php").PHP;
3584

    
3585
var PhpWorker = exports.PhpWorker = function(sender) {
3586
    Mirror.call(this, sender);
3587
    this.setTimeout(500);
3588
};
3589

    
3590
oop.inherits(PhpWorker, Mirror);
3591

    
3592
(function() {
3593
    this.setOptions = function(opts) {
3594
        this.inlinePhp = opts && opts.inline;
3595
    };
3596
    
3597
    this.onUpdate = function() {
3598
        var value = this.doc.getValue();
3599
        var errors = [];
3600
        if (this.inlinePhp)
3601
            value = "<?" + value + "?>";
3602

    
3603
        var tokens = PHP.Lexer(value, {short_open_tag: 1});
3604
        try {
3605
            new PHP.Parser(tokens);
3606
        } catch(e) {
3607
            errors.push({
3608
                row: e.line - 1,
3609
                column: null,
3610
                text: e.message.charAt(0).toUpperCase() + e.message.substring(1),
3611
                type: "error"
3612
            });
3613
        }
3614

    
3615
        this.sender.emit("annotate", errors);
3616
    };
3617

    
3618
}).call(PhpWorker.prototype);
3619

    
3620
});
3621

    
3622
ace.define("ace/lib/es5-shim",[], function(require, exports, module) {
3623

    
3624
function Empty() {}
3625

    
3626
if (!Function.prototype.bind) {
3627
    Function.prototype.bind = function bind(that) { // .length is 1
3628
        var target = this;
3629
        if (typeof target != "function") {
3630
            throw new TypeError("Function.prototype.bind called on incompatible " + target);
3631
        }
3632
        var args = slice.call(arguments, 1); // for normal call
3633
        var bound = function () {
3634

    
3635
            if (this instanceof bound) {
3636

    
3637
                var result = target.apply(
3638
                    this,
3639
                    args.concat(slice.call(arguments))
3640
                );
3641
                if (Object(result) === result) {
3642
                    return result;
3643
                }
3644
                return this;
3645

    
3646
            } else {
3647
                return target.apply(
3648
                    that,
3649
                    args.concat(slice.call(arguments))
3650
                );
3651

    
3652
            }
3653

    
3654
        };
3655
        if(target.prototype) {
3656
            Empty.prototype = target.prototype;
3657
            bound.prototype = new Empty();
3658
            Empty.prototype = null;
3659
        }
3660
        return bound;
3661
    };
3662
}
3663
var call = Function.prototype.call;
3664
var prototypeOfArray = Array.prototype;
3665
var prototypeOfObject = Object.prototype;
3666
var slice = prototypeOfArray.slice;
3667
var _toString = call.bind(prototypeOfObject.toString);
3668
var owns = call.bind(prototypeOfObject.hasOwnProperty);
3669
var defineGetter;
3670
var defineSetter;
3671
var lookupGetter;
3672
var lookupSetter;
3673
var supportsAccessors;
3674
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
3675
    defineGetter = call.bind(prototypeOfObject.__defineGetter__);
3676
    defineSetter = call.bind(prototypeOfObject.__defineSetter__);
3677
    lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
3678
    lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
3679
}
3680
if ([1,2].splice(0).length != 2) {
3681
    if(function() { // test IE < 9 to splice bug - see issue #138
3682
        function makeArray(l) {
3683
            var a = new Array(l+2);
3684
            a[0] = a[1] = 0;
3685
            return a;
3686
        }
3687
        var array = [], lengthBefore;
3688
        
3689
        array.splice.apply(array, makeArray(20));
3690
        array.splice.apply(array, makeArray(26));
3691

    
3692
        lengthBefore = array.length; //46
3693
        array.splice(5, 0, "XXX"); // add one element
3694

    
3695
        lengthBefore + 1 == array.length
3696

    
3697
        if (lengthBefore + 1 == array.length) {
3698
            return true;// has right splice implementation without bugs
3699
        }
3700
    }()) {//IE 6/7
3701
        var array_splice = Array.prototype.splice;
3702
        Array.prototype.splice = function(start, deleteCount) {
3703
            if (!arguments.length) {
3704
                return [];
3705
            } else {
3706
                return array_splice.apply(this, [
3707
                    start === void 0 ? 0 : start,
3708
                    deleteCount === void 0 ? (this.length - start) : deleteCount
3709
                ].concat(slice.call(arguments, 2)))
3710
            }
3711
        };
3712
    } else {//IE8
3713
        Array.prototype.splice = function(pos, removeCount){
3714
            var length = this.length;
3715
            if (pos > 0) {
3716
                if (pos > length)
3717
                    pos = length;
3718
            } else if (pos == void 0) {
3719
                pos = 0;
3720
            } else if (pos < 0) {
3721
                pos = Math.max(length + pos, 0);
3722
            }
3723

    
3724
            if (!(pos+removeCount < length))
3725
                removeCount = length - pos;
3726

    
3727
            var removed = this.slice(pos, pos+removeCount);
3728
            var insert = slice.call(arguments, 2);
3729
            var add = insert.length;            
3730
            if (pos === length) {
3731
                if (add) {
3732
                    this.push.apply(this, insert);
3733
                }
3734
            } else {
3735
                var remove = Math.min(removeCount, length - pos);
3736
                var tailOldPos = pos + remove;
3737
                var tailNewPos = tailOldPos + add - remove;
3738
                var tailCount = length - tailOldPos;
3739
                var lengthAfterRemove = length - remove;
3740

    
3741
                if (tailNewPos < tailOldPos) { // case A
3742
                    for (var i = 0; i < tailCount; ++i) {
3743
                        this[tailNewPos+i] = this[tailOldPos+i];
3744
                    }
3745
                } else if (tailNewPos > tailOldPos) { // case B
3746
                    for (i = tailCount; i--; ) {
3747
                        this[tailNewPos+i] = this[tailOldPos+i];
3748
                    }
3749
                } // else, add == remove (nothing to do)
3750

    
3751
                if (add && pos === lengthAfterRemove) {
3752
                    this.length = lengthAfterRemove; // truncate array
3753
                    this.push.apply(this, insert);
3754
                } else {
3755
                    this.length = lengthAfterRemove + add; // reserves space
3756
                    for (i = 0; i < add; ++i) {
3757
                        this[pos+i] = insert[i];
3758
                    }
3759
                }
3760
            }
3761
            return removed;
3762
        };
3763
    }
3764
}
3765
if (!Array.isArray) {
3766
    Array.isArray = function isArray(obj) {
3767
        return _toString(obj) == "[object Array]";
3768
    };
3769
}
3770
var boxedString = Object("a"),
3771
    splitString = boxedString[0] != "a" || !(0 in boxedString);
3772

    
3773
if (!Array.prototype.forEach) {
3774
    Array.prototype.forEach = function forEach(fun /*, thisp*/) {
3775
        var object = toObject(this),
3776
            self = splitString && _toString(this) == "[object String]" ?
3777
                this.split("") :
3778
                object,
3779
            thisp = arguments[1],
3780
            i = -1,
3781
            length = self.length >>> 0;
3782
        if (_toString(fun) != "[object Function]") {
3783
            throw new TypeError(); // TODO message
3784
        }
3785

    
3786
        while (++i < length) {
3787
            if (i in self) {
3788
                fun.call(thisp, self[i], i, object);
3789
            }
3790
        }
3791
    };
3792
}
3793
if (!Array.prototype.map) {
3794
    Array.prototype.map = function map(fun /*, thisp*/) {
3795
        var object = toObject(this),
3796
            self = splitString && _toString(this) == "[object String]" ?
3797
                this.split("") :
3798
                object,
3799
            length = self.length >>> 0,
3800
            result = Array(length),
3801
            thisp = arguments[1];
3802
        if (_toString(fun) != "[object Function]") {
3803
            throw new TypeError(fun + " is not a function");
3804
        }
3805

    
3806
        for (var i = 0; i < length; i++) {
3807
            if (i in self)
3808
                result[i] = fun.call(thisp, self[i], i, object);
3809
        }
3810
        return result;
3811
    };
3812
}
3813
if (!Array.prototype.filter) {
3814
    Array.prototype.filter = function filter(fun /*, thisp */) {
3815
        var object = toObject(this),
3816
            self = splitString && _toString(this) == "[object String]" ?
3817
                this.split("") :
3818
                    object,
3819
            length = self.length >>> 0,
3820
            result = [],
3821
            value,
3822
            thisp = arguments[1];
3823
        if (_toString(fun) != "[object Function]") {
3824
            throw new TypeError(fun + " is not a function");
3825
        }
3826

    
3827
        for (var i = 0; i < length; i++) {
3828
            if (i in self) {
3829
                value = self[i];
3830
                if (fun.call(thisp, value, i, object)) {
3831
                    result.push(value);
3832
                }
3833
            }
3834
        }
3835
        return result;
3836
    };
3837
}
3838
if (!Array.prototype.every) {
3839
    Array.prototype.every = function every(fun /*, thisp */) {
3840
        var object = toObject(this),
3841
            self = splitString && _toString(this) == "[object String]" ?
3842
                this.split("") :
3843
                object,
3844
            length = self.length >>> 0,
3845
            thisp = arguments[1];
3846
        if (_toString(fun) != "[object Function]") {
3847
            throw new TypeError(fun + " is not a function");
3848
        }
3849

    
3850
        for (var i = 0; i < length; i++) {
3851
            if (i in self && !fun.call(thisp, self[i], i, object)) {
3852
                return false;
3853
            }
3854
        }
3855
        return true;
3856
    };
3857
}
3858
if (!Array.prototype.some) {
3859
    Array.prototype.some = function some(fun /*, thisp */) {
3860
        var object = toObject(this),
3861
            self = splitString && _toString(this) == "[object String]" ?
3862
                this.split("") :
3863
                object,
3864
            length = self.length >>> 0,
3865
            thisp = arguments[1];
3866
        if (_toString(fun) != "[object Function]") {
3867
            throw new TypeError(fun + " is not a function");
3868
        }
3869

    
3870
        for (var i = 0; i < length; i++) {
3871
            if (i in self && fun.call(thisp, self[i], i, object)) {
3872
                return true;
3873
            }
3874
        }
3875
        return false;
3876
    };
3877
}
3878
if (!Array.prototype.reduce) {
3879
    Array.prototype.reduce = function reduce(fun /*, initial*/) {
3880
        var object = toObject(this),
3881
            self = splitString && _toString(this) == "[object String]" ?
3882
                this.split("") :
3883
                object,
3884
            length = self.length >>> 0;
3885
        if (_toString(fun) != "[object Function]") {
3886
            throw new TypeError(fun + " is not a function");
3887
        }
3888
        if (!length && arguments.length == 1) {
3889
            throw new TypeError("reduce of empty array with no initial value");
3890
        }
3891

    
3892
        var i = 0;
3893
        var result;
3894
        if (arguments.length >= 2) {
3895
            result = arguments[1];
3896
        } else {
3897
            do {
3898
                if (i in self) {
3899
                    result = self[i++];
3900
                    break;
3901
                }
3902
                if (++i >= length) {
3903
                    throw new TypeError("reduce of empty array with no initial value");
3904
                }
3905
            } while (true);
3906
        }
3907

    
3908
        for (; i < length; i++) {
3909
            if (i in self) {
3910
                result = fun.call(void 0, result, self[i], i, object);
3911
            }
3912
        }
3913

    
3914
        return result;
3915
    };
3916
}
3917
if (!Array.prototype.reduceRight) {
3918
    Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
3919
        var object = toObject(this),
3920
            self = splitString && _toString(this) == "[object String]" ?
3921
                this.split("") :
3922
                object,
3923
            length = self.length >>> 0;
3924
        if (_toString(fun) != "[object Function]") {
3925
            throw new TypeError(fun + " is not a function");
3926
        }
3927
        if (!length && arguments.length == 1) {
3928
            throw new TypeError("reduceRight of empty array with no initial value");
3929
        }
3930

    
3931
        var result, i = length - 1;
3932
        if (arguments.length >= 2) {
3933
            result = arguments[1];
3934
        } else {
3935
            do {
3936
                if (i in self) {
3937
                    result = self[i--];
3938
                    break;
3939
                }
3940
                if (--i < 0) {
3941
                    throw new TypeError("reduceRight of empty array with no initial value");
3942
                }
3943
            } while (true);
3944
        }
3945

    
3946
        do {
3947
            if (i in this) {
3948
                result = fun.call(void 0, result, self[i], i, object);
3949
            }
3950
        } while (i--);
3951

    
3952
        return result;
3953
    };
3954
}
3955
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
3956
    Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
3957
        var self = splitString && _toString(this) == "[object String]" ?
3958
                this.split("") :
3959
                toObject(this),
3960
            length = self.length >>> 0;
3961

    
3962
        if (!length) {
3963
            return -1;
3964
        }
3965

    
3966
        var i = 0;
3967
        if (arguments.length > 1) {
3968
            i = toInteger(arguments[1]);
3969
        }
3970
        i = i >= 0 ? i : Math.max(0, length + i);
3971
        for (; i < length; i++) {
3972
            if (i in self && self[i] === sought) {
3973
                return i;
3974
            }
3975
        }
3976
        return -1;
3977
    };
3978
}
3979
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
3980
    Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
3981
        var self = splitString && _toString(this) == "[object String]" ?
3982
                this.split("") :
3983
                toObject(this),
3984
            length = self.length >>> 0;
3985

    
3986
        if (!length) {
3987
            return -1;
3988
        }
3989
        var i = length - 1;
3990
        if (arguments.length > 1) {
3991
            i = Math.min(i, toInteger(arguments[1]));
3992
        }
3993
        i = i >= 0 ? i : length - Math.abs(i);
3994
        for (; i >= 0; i--) {
3995
            if (i in self && sought === self[i]) {
3996
                return i;
3997
            }
3998
        }
3999
        return -1;
4000
    };
4001
}
4002
if (!Object.getPrototypeOf) {
4003
    Object.getPrototypeOf = function getPrototypeOf(object) {
4004
        return object.__proto__ || (
4005
            object.constructor ?
4006
            object.constructor.prototype :
4007
            prototypeOfObject
4008
        );
4009
    };
4010
}
4011
if (!Object.getOwnPropertyDescriptor) {
4012
    var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
4013
                         "non-object: ";
4014
    Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
4015
        if ((typeof object != "object" && typeof object != "function") || object === null)
4016
            throw new TypeError(ERR_NON_OBJECT + object);
4017
        if (!owns(object, property))
4018
            return;
4019

    
4020
        var descriptor, getter, setter;
4021
        descriptor =  { enumerable: true, configurable: true };
4022
        if (supportsAccessors) {
4023
            var prototype = object.__proto__;
4024
            object.__proto__ = prototypeOfObject;
4025

    
4026
            var getter = lookupGetter(object, property);
4027
            var setter = lookupSetter(object, property);
4028
            object.__proto__ = prototype;
4029

    
4030
            if (getter || setter) {
4031
                if (getter) descriptor.get = getter;
4032
                if (setter) descriptor.set = setter;
4033
                return descriptor;
4034
            }
4035
        }
4036
        descriptor.value = object[property];
4037
        return descriptor;
4038
    };
4039
}
4040
if (!Object.getOwnPropertyNames) {
4041
    Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
4042
        return Object.keys(object);
4043
    };
4044
}
4045
if (!Object.create) {
4046
    var createEmpty;
4047
    if (Object.prototype.__proto__ === null) {
4048
        createEmpty = function () {
4049
            return { "__proto__": null };
4050
        };
4051
    } else {
4052
        createEmpty = function () {
4053
            var empty = {};
4054
            for (var i in empty)
4055
                empty[i] = null;
4056
            empty.constructor =
4057
            empty.hasOwnProperty =
4058
            empty.propertyIsEnumerable =
4059
            empty.isPrototypeOf =
4060
            empty.toLocaleString =
4061
            empty.toString =
4062
            empty.valueOf =
4063
            empty.__proto__ = null;
4064
            return empty;
4065
        }
4066
    }
4067

    
4068
    Object.create = function create(prototype, properties) {
4069
        var object;
4070
        if (prototype === null) {
4071
            object = createEmpty();
4072
        } else {
4073
            if (typeof prototype != "object")
4074
                throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
4075
            var Type = function () {};
4076
            Type.prototype = prototype;
4077
            object = new Type();
4078
            object.__proto__ = prototype;
4079
        }
4080
        if (properties !== void 0)
4081
            Object.defineProperties(object, properties);
4082
        return object;
4083
    };
4084
}
4085

    
4086
function doesDefinePropertyWork(object) {
4087
    try {
4088
        Object.defineProperty(object, "sentinel", {});
4089
        return "sentinel" in object;
4090
    } catch (exception) {
4091
    }
4092
}
4093
if (Object.defineProperty) {
4094
    var definePropertyWorksOnObject = doesDefinePropertyWork({});
4095
    var definePropertyWorksOnDom = typeof document == "undefined" ||
4096
        doesDefinePropertyWork(document.createElement("div"));
4097
    if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
4098
        var definePropertyFallback = Object.defineProperty;
4099
    }
4100
}
4101

    
4102
if (!Object.defineProperty || definePropertyFallback) {
4103
    var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
4104
    var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
4105
    var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
4106
                                      "on this javascript engine";
4107

    
4108
    Object.defineProperty = function defineProperty(object, property, descriptor) {
4109
        if ((typeof object != "object" && typeof object != "function") || object === null)
4110
            throw new TypeError(ERR_NON_OBJECT_TARGET + object);
4111
        if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
4112
            throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
4113
        if (definePropertyFallback) {
4114
            try {
4115
                return definePropertyFallback.call(Object, object, property, descriptor);
4116
            } catch (exception) {
4117
            }
4118
        }
4119
        if (owns(descriptor, "value")) {
4120

    
4121
            if (supportsAccessors && (lookupGetter(object, property) ||
4122
                                      lookupSetter(object, property)))
4123
            {
4124
                var prototype = object.__proto__;
4125
                object.__proto__ = prototypeOfObject;
4126
                delete object[property];
4127
                object[property] = descriptor.value;
4128
                object.__proto__ = prototype;
4129
            } else {
4130
                object[property] = descriptor.value;
4131
            }
4132
        } else {
4133
            if (!supportsAccessors)
4134
                throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
4135
            if (owns(descriptor, "get"))
4136
                defineGetter(object, property, descriptor.get);
4137
            if (owns(descriptor, "set"))
4138
                defineSetter(object, property, descriptor.set);
4139
        }
4140

    
4141
        return object;
4142
    };
4143
}
4144
if (!Object.defineProperties) {
4145
    Object.defineProperties = function defineProperties(object, properties) {
4146
        for (var property in properties) {
4147
            if (owns(properties, property))
4148
                Object.defineProperty(object, property, properties[property]);
4149
        }
4150
        return object;
4151
    };
4152
}
4153
if (!Object.seal) {
4154
    Object.seal = function seal(object) {
4155
        return object;
4156
    };
4157
}
4158
if (!Object.freeze) {
4159
    Object.freeze = function freeze(object) {
4160
        return object;
4161
    };
4162
}
4163
try {
4164
    Object.freeze(function () {});
4165
} catch (exception) {
4166
    Object.freeze = (function freeze(freezeObject) {
4167
        return function freeze(object) {
4168
            if (typeof object == "function") {
4169
                return object;
4170
            } else {
4171
                return freezeObject(object);
4172
            }
4173
        };
4174
    })(Object.freeze);
4175
}
4176
if (!Object.preventExtensions) {
4177
    Object.preventExtensions = function preventExtensions(object) {
4178
        return object;
4179
    };
4180
}
4181
if (!Object.isSealed) {
4182
    Object.isSealed = function isSealed(object) {
4183
        return false;
4184
    };
4185
}
4186
if (!Object.isFrozen) {
4187
    Object.isFrozen = function isFrozen(object) {
4188
        return false;
4189
    };
4190
}
4191
if (!Object.isExtensible) {
4192
    Object.isExtensible = function isExtensible(object) {
4193
        if (Object(object) === object) {
4194
            throw new TypeError(); // TODO message
4195
        }
4196
        var name = '';
4197
        while (owns(object, name)) {
4198
            name += '?';
4199
        }
4200
        object[name] = true;
4201
        var returnValue = owns(object, name);
4202
        delete object[name];
4203
        return returnValue;
4204
    };
4205
}
4206
if (!Object.keys) {
4207
    var hasDontEnumBug = true,
4208
        dontEnums = [
4209
            "toString",
4210
            "toLocaleString",
4211
            "valueOf",
4212
            "hasOwnProperty",
4213
            "isPrototypeOf",
4214
            "propertyIsEnumerable",
4215
            "constructor"
4216
        ],
4217
        dontEnumsLength = dontEnums.length;
4218

    
4219
    for (var key in {"toString": null}) {
4220
        hasDontEnumBug = false;
4221
    }
4222

    
4223
    Object.keys = function keys(object) {
4224

    
4225
        if (
4226
            (typeof object != "object" && typeof object != "function") ||
4227
            object === null
4228
        ) {
4229
            throw new TypeError("Object.keys called on a non-object");
4230
        }
4231

    
4232
        var keys = [];
4233
        for (var name in object) {
4234
            if (owns(object, name)) {
4235
                keys.push(name);
4236
            }
4237
        }
4238

    
4239
        if (hasDontEnumBug) {
4240
            for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
4241
                var dontEnum = dontEnums[i];
4242
                if (owns(object, dontEnum)) {
4243
                    keys.push(dontEnum);
4244
                }
4245
            }
4246
        }
4247
        return keys;
4248
    };
4249

    
4250
}
4251
if (!Date.now) {
4252
    Date.now = function now() {
4253
        return new Date().getTime();
4254
    };
4255
}
4256
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
4257
    "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
4258
    "\u2029\uFEFF";
4259
if (!String.prototype.trim) {
4260
    ws = "[" + ws + "]";
4261
    var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
4262
        trimEndRegexp = new RegExp(ws + ws + "*$");
4263
    String.prototype.trim = function trim() {
4264
        return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
4265
    };
4266
}
4267

    
4268
function toInteger(n) {
4269
    n = +n;
4270
    if (n !== n) { // isNaN
4271
        n = 0;
4272
    } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
4273
        n = (n > 0 || -1) * Math.floor(Math.abs(n));
4274
    }
4275
    return n;
4276
}
4277

    
4278
function isPrimitive(input) {
4279
    var type = typeof input;
4280
    return (
4281
        input === null ||
4282
        type === "undefined" ||
4283
        type === "boolean" ||
4284
        type === "number" ||
4285
        type === "string"
4286
    );
4287
}
4288

    
4289
function toPrimitive(input) {
4290
    var val, valueOf, toString;
4291
    if (isPrimitive(input)) {
4292
        return input;
4293
    }
4294
    valueOf = input.valueOf;
4295
    if (typeof valueOf === "function") {
4296
        val = valueOf.call(input);
4297
        if (isPrimitive(val)) {
4298
            return val;
4299
        }
4300
    }
4301
    toString = input.toString;
4302
    if (typeof toString === "function") {
4303
        val = toString.call(input);
4304
        if (isPrimitive(val)) {
4305
            return val;
4306
        }
4307
    }
4308
    throw new TypeError();
4309
}
4310
var toObject = function (o) {
4311
    if (o == null) { // this matches both null and undefined
4312
        throw new TypeError("can't convert "+o+" to object");
4313
    }
4314
    return Object(o);
4315
};
4316

    
4317
});
(242-242/244)