: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
// Illegal: \01 \02 and so on
this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
if (ch === '\r' && this.source[this.index] === '\n') {
this.lineStart = this.index;
else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
if (ch === '\r' && this.source[this.index] === '\n') {
this.lineStart = this.index;
this.throwUnexpectedToken();
value: this.source.slice(start + 1, this.index - rawOffset),
lineNumber: this.lineNumber,
lineStart: this.lineStart,
// https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
Scanner.prototype.testRegExp = function (pattern, flags) {
// The BMP character to use as a replacement for astral symbols when
// translating an ES6 "u"-flagged pattern to an ES5-compatible
// Note: replacing with '\uFFFF' enables false positives in unlikely
// scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
// pattern that would not be detected by this substitution.
var astralSubstitute = '\uFFFF';
if (flags.indexOf('u') >= 0) {
.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
var codePoint = parseInt($1 || $2, 16);
if (codePoint > 0x10FFFF) {
self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
if (codePoint <= 0xFFFF) {
return String.fromCharCode(codePoint);
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute);
// First, detect invalid regular expressions.
this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
// Return a regular expression object for this pattern-flag pair, or
// `null` in case the current environment doesn't support the flags it
return new RegExp(pattern, flags);
/* istanbul ignore next */
Scanner.prototype.scanRegExpBody = function () {
var ch = this.source[this.index];
assert_1.assert(ch === '/', 'Regular expression literal must start with a slash');
var str = this.source[this.index++];
ch = this.source[this.index++];
ch = this.source[this.index++];
// https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
// Exclude leading and trailing slash.
return str.substr(1, str.length - 2);
Scanner.prototype.scanRegExpFlags = function () {
var ch = this.source[this.index];
if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
if (ch === '\\' && !this.eof()) {
ch = this.source[this.index];
var restore = this.index;
var char = this.scanHexEscape('u');
for (str += '\\u'; restore < this.index; ++restore) {
str += this.source[restore];
this.tolerateUnexpectedToken();
this.tolerateUnexpectedToken();
Scanner.prototype.scanRegExp = function () {
var pattern = this.scanRegExpBody();
var flags = this.scanRegExpFlags();
var value = this.testRegExp(pattern, flags);
type: 9 /* RegularExpression */,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
Scanner.prototype.lex = function () {
lineNumber: this.lineNumber,
lineStart: this.lineStart,
var cp = this.source.charCodeAt(this.index);
if (character_1.Character.isIdentifierStart(cp)) {
return this.scanIdentifier();
// Very common: ( and ) and ;
if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
return this.scanPunctuator();
// String literal starts with single quote (U+0027) or double quote (U+0022).
if (cp === 0x27 || cp === 0x22) {
return this.scanStringLiteral();
// Dot (.) U+002E can also start a floating-point number, hence the need
// to check the next character.
if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) {
return this.scanNumericLiteral();
return this.scanPunctuator();
if (character_1.Character.isDecimalDigit(cp)) {
return this.scanNumericLiteral();
// Template literals start with ` (U+0060) for template head
// or } (U+007D) for template middle or template tail.
if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) {
return this.scanTemplate();
// Possible identifier start in a surrogate pair.
if (cp >= 0xD800 && cp < 0xDFFF) {
if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) {
return this.scanIdentifier();
return this.scanPunctuator();
exports.Scanner = Scanner;
/***/ function(module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.TokenName[1 /* BooleanLiteral */] = 'Boolean';
exports.TokenName[2 /* EOF */] = '<end>';
exports.TokenName[3 /* Identifier */] = 'Identifier';
exports.TokenName[4 /* Keyword */] = 'Keyword';
exports.TokenName[5 /* NullLiteral */] = 'Null';
exports.TokenName[6 /* NumericLiteral */] = 'Numeric';
exports.TokenName[7 /* Punctuator */] = 'Punctuator';
exports.TokenName[8 /* StringLiteral */] = 'String';
exports.TokenName[9 /* RegularExpression */] = 'RegularExpression';
exports.TokenName[10 /* Template */] = 'Template';
/***/ function(module, exports) {
// Generated by generate-xhtml-entities.js. DO NOT MODIFY!
Object.defineProperty(exports, "__esModule", { value: true });
exports.XHTMLEntities = {