Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

meriyah

Package Overview
Dependencies
Maintainers
1
Versions
917
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meriyah - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

dist/common.d.ts

@@ -114,3 +114,3 @@ import { Token } from './token';

destructible: AssignmentKind | DestructuringKind;
currentCodePoint: number;
nextCP: number;
}

@@ -117,0 +117,0 @@ export declare function consumeSemicolon(parser: ParserState, context: Context): void;

@@ -0,1 +1,2 @@

import { ScannerState } from './';
import { Token } from '../token';

@@ -5,3 +6,3 @@ import { ParserState, Context } from '../common';

export declare function nextToken(parser: ParserState, context: Context): void;
export declare function scanSingleToken(parser: ParserState, context: Context): Token;
export declare function scanSingleToken(parser: ParserState, context: Context, state: ScannerState): Token;
//# sourceMappingURL=scan.d.ts.map

@@ -30,3 +30,3 @@ import { Token } from './token';

export declare function parseAsyncArrowOrAsyncFunctionDeclaration(parser: ParserState, context: Context, labels: any, allowFuncDecl: FunctionStatement, start: number): ESTree.ExpressionStatement | ESTree.LabeledStatement | ESTree.FunctionDeclaration;
export declare function parseDirective(parser: ParserState, context: Context, start: number): ESTree.Statement | ESTree.ExpressionStatement;
export declare function parseDirective(parser: ParserState, context: Context, expression: any, start: number, token: Token): ESTree.ExpressionStatement;
export declare function parseEmptyStatement(parser: ParserState, context: Context, start: number): ESTree.EmptyStatement;

@@ -33,0 +33,0 @@ export declare function parseThrowStatement(parser: ParserState, context: Context, start: number): ESTree.ThrowStatement;

{
"name": "meriyah",
"version": "0.2.1",
"version": "0.2.2",
"description": "A 100% compliant, self-hosted javascript parser with high focus on both performance and stability",

@@ -5,0 +5,0 @@ "main": "dist/meriyah.umd.js",

@@ -136,3 +136,3 @@ import { Token, KeywordDescTable } from './token';

destructible: AssignmentKind | DestructuringKind;
currentCodePoint: number;
nextCP: number;
}

@@ -139,0 +139,0 @@

import { nextCodePoint, CharTypes, CharFlags, ScannerState, Seek } from './';
import { Chars } from '../chars';
import { Token } from '../token';
import { ParserState, Flags } from '../common';

@@ -15,4 +14,4 @@ import { report, Errors } from '../errors';

if (index === parser.end) return;
if (parser.currentCodePoint === Chars.ByteOrderMark) {
parser.currentCodePoint = parser.source.charCodeAt(++index);
if (parser.nextCP === Chars.ByteOrderMark) {
parser.nextCP = parser.source.charCodeAt(++index);
parser.index = index;

@@ -25,3 +24,3 @@ }

parser.index = index + 1;
parser.currentCodePoint = parser.source.charCodeAt(parser.index);
parser.nextCP = parser.source.charCodeAt(parser.index);
skipSingleLineComment(parser, ScannerState.None);

@@ -41,10 +40,7 @@ } else {

while (parser.index < parser.end) {
if (
CharTypes[parser.currentCodePoint] & CharFlags.LineTerminator ||
(parser.currentCodePoint ^ Chars.LineSeparator) <= 1
) {
if (CharTypes[parser.nextCP] & CharFlags.LineTerminator || (parser.nextCP ^ Chars.LineSeparator) <= 1) {
parser.flags |= Flags.NewLine;
parser.column = 0;
parser.line++;
parser.currentCodePoint = parser.source.charCodeAt(++parser.index);
parser.nextCP = parser.source.charCodeAt(++parser.index);
return state;

@@ -64,3 +60,3 @@ }

while (parser.index < parser.end) {
while (CharTypes[parser.currentCodePoint] & CharFlags.Asterisk) {
while (CharTypes[parser.nextCP] & CharFlags.Asterisk) {
if (nextCodePoint(parser) === Chars.Slash) {

@@ -73,4 +69,4 @@ nextCodePoint(parser);

// ES 2020 11.3 Line Terminators
if (CharTypes[parser.currentCodePoint] & CharFlags.LineTerminator) {
if (CharTypes[parser.currentCodePoint] & CharFlags.CarriageReturn) {
if (CharTypes[parser.nextCP] & CharFlags.LineTerminator) {
if (CharTypes[parser.nextCP] & CharFlags.CarriageReturn) {
state |= ScannerState.NewLine | ScannerState.LastIsCR;

@@ -86,8 +82,8 @@ parser.column = 0;

}
parser.currentCodePoint = parser.source.charCodeAt(++parser.index);
parser.nextCP = parser.source.charCodeAt(++parser.index);
parser.flags |= Flags.NewLine;
} else if ((parser.currentCodePoint ^ Chars.LineSeparator) <= 1) {
} else if ((parser.nextCP ^ Chars.LineSeparator) <= 1) {
state = (state & ~ScannerState.LastIsCR) | ScannerState.NewLine;
parser.column = 0;
parser.currentCodePoint = parser.source.charCodeAt(++parser.index);
parser.nextCP = parser.source.charCodeAt(++parser.index);
parser.line++;

@@ -94,0 +90,0 @@ parser.flags |= Flags.NewLine;

@@ -24,3 +24,3 @@ import { Chars } from '../chars';

parser.column++;
return (parser.currentCodePoint = parser.source.charCodeAt(++parser.index));
return (parser.nextCP = parser.source.charCodeAt(++parser.index));
}

@@ -39,3 +39,3 @@

parser.column++;
parser.currentCodePoint = hi;
parser.nextCP = hi;
return true;

@@ -42,0 +42,0 @@ }

@@ -11,11 +11,11 @@ import { ParserState, Context } from '../common';

let hasEscape: 0 | 1 = 0;
let canBeKeyword: number = CharTypes[parser.currentCodePoint] & CharFlags.KeywordCandidate;
let canBeKeyword: number = CharTypes[parser.nextCP] & CharFlags.KeywordCandidate;
parser.tokenValue = '';
if (parser.currentCodePoint <= 0x7e) {
if ((CharTypes[parser.currentCodePoint] & CharFlags.BackSlash) === 0) {
if (parser.nextCP <= 0x7e) {
if ((CharTypes[parser.nextCP] & CharFlags.BackSlash) === 0) {
while ((CharTypes[nextCodePoint(parser)] & CharFlags.IdentifierPart) !== 0) {}
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
if (parser.currentCodePoint > 0x7e) return scanIdentifierSlowCase(parser, context, hasEscape, canBeKeyword);
if (parser.nextCP > 0x7e) return scanIdentifierSlowCase(parser, context, hasEscape, canBeKeyword);
if ((CharTypes[parser.currentCodePoint] & CharFlags.BackSlash) === 0) {
if ((CharTypes[parser.nextCP] & CharFlags.BackSlash) === 0) {
return descKeywordTable[parser.tokenValue] || Token.Identifier;

@@ -43,3 +43,3 @@ }

while (parser.index < parser.end) {
if (CharTypes[parser.currentCodePoint] & CharFlags.BackSlash) {
if (CharTypes[parser.nextCP] & CharFlags.BackSlash) {
parser.tokenValue += parser.source.slice(start, parser.index);

@@ -52,6 +52,3 @@ hasEscape = 1;

start = parser.index;
} else if (
isIdentifierPart(parser.currentCodePoint) ||
consumeMultiUnitCodePoint(parser, parser.currentCodePoint)
) {
} else if (isIdentifierPart(parser.nextCP) || consumeMultiUnitCodePoint(parser, parser.nextCP)) {
nextCodePoint(parser);

@@ -90,5 +87,5 @@ } else {

if (
(CharTypes[parser.currentCodePoint] & CharFlags.Decimal) !== 0 ||
((CharTypes[parser.currentCodePoint] & CharFlags.IdentifierStart) === 0 &&
((unicodeLookup[(parser.currentCodePoint >>> 5) + 0] >>> parser.currentCodePoint) & 31 & 1) === 0)
(CharTypes[parser.nextCP] & CharFlags.Decimal) !== 0 ||
((CharTypes[parser.nextCP] & CharFlags.IdentifierStart) === 0 &&
((unicodeLookup[(parser.nextCP >>> 5) + 0] >>> parser.nextCP) & 31 & 1) === 0)
) {

@@ -105,3 +102,3 @@ report(parser, Errors.MissingPrivateName);

if (parser.index + 5 < parser.end && parser.source.charCodeAt(parser.index + 1) === Chars.LowerU) {
parser.currentCodePoint = parser.source.charCodeAt((parser.index += 2));
parser.nextCP = parser.source.charCodeAt((parser.index += 2));
return scanUnicodeEscapeValue(parser);

@@ -115,5 +112,5 @@ }

// First handle a delimited Unicode escape, e.g. \u{1F4A9}
if (parser.currentCodePoint === Chars.LeftBrace) {
if (parser.nextCP === Chars.LeftBrace) {
while (CharTypes[nextCodePoint(parser)] & CharFlags.Hex) {
codePoint = (codePoint << 4) | toHex(parser.currentCodePoint);
codePoint = (codePoint << 4) | toHex(parser.nextCP);
// Check this early to avoid `code` wrapping to a negative on overflow (which is

@@ -127,3 +124,3 @@ // reserved for abnormal conditions).

// At least 4 characters have to be read
if (codePoint < 1 || (parser.currentCodePoint as number) !== Chars.RightBrace) {
if (codePoint < 1 || (parser.nextCP as number) !== Chars.RightBrace) {
report(parser, Errors.InvalidHexEscapeSequence);

@@ -135,3 +132,3 @@ }

if ((CharTypes[parser.currentCodePoint] & CharFlags.Hex) === 0) report(parser, Errors.InvalidHexEscapeSequence); // first one is mandatory
if ((CharTypes[parser.nextCP] & CharFlags.Hex) === 0) report(parser, Errors.InvalidHexEscapeSequence); // first one is mandatory

@@ -145,7 +142,7 @@ const c2 = parser.source.charCodeAt(parser.index + 1);

codePoint = (toHex(parser.currentCodePoint) << 12) | (toHex(c2) << 8) | (toHex(c3) << 4) | toHex(c4);
codePoint = (toHex(parser.nextCP) << 12) | (toHex(c2) << 8) | (toHex(c3) << 4) | toHex(c4);
parser.currentCodePoint = parser.source.charCodeAt((parser.index += 4));
parser.nextCP = parser.source.charCodeAt((parser.index += 4));
return codePoint;
}

@@ -21,15 +21,15 @@ import { ParserState, Context, Flags } from '../common';

if (isFloat) {
while (CharTypes[parser.currentCodePoint] & CharFlags.Decimal) {
while (CharTypes[parser.nextCP] & CharFlags.Decimal) {
nextCodePoint(parser);
}
} else {
if (parser.currentCodePoint === Chars.Zero) {
if (parser.nextCP === Chars.Zero) {
nextCodePoint(parser);
// Hex
if ((parser.currentCodePoint | 32) === Chars.LowerX) {
if ((parser.nextCP | 32) === Chars.LowerX) {
kind = NumberKind.Hex;
let digits = 0;
while (CharTypes[nextCodePoint(parser)] & CharFlags.Hex) {
value = value * 0x10 + toHex(parser.currentCodePoint);
value = value * 0x10 + toHex(parser.nextCP);
digits++;

@@ -39,19 +39,19 @@ }

// Octal
} else if ((parser.currentCodePoint | 32) === Chars.LowerO) {
} else if ((parser.nextCP | 32) === Chars.LowerO) {
kind = NumberKind.Octal;
let digits = 0;
while (CharTypes[nextCodePoint(parser)] & CharFlags.Octal) {
value = value * 8 + (parser.currentCodePoint - Chars.Zero);
value = value * 8 + (parser.nextCP - Chars.Zero);
digits++;
}
if (digits < 1) report(parser, Errors.ExpectedNumberInRadix, `${8}`);
} else if ((parser.currentCodePoint | 32) === Chars.LowerB) {
} else if ((parser.nextCP | 32) === Chars.LowerB) {
kind = NumberKind.Binary;
let digits = 0;
while (CharTypes[nextCodePoint(parser)] & CharFlags.Binary) {
value = value * 2 + (parser.currentCodePoint - Chars.Zero);
value = value * 2 + (parser.nextCP - Chars.Zero);
digits++;
}
if (digits < 1) report(parser, Errors.ExpectedNumberInRadix, `${2}`);
} else if (CharTypes[parser.currentCodePoint] & CharFlags.Octal) {
} else if (CharTypes[parser.nextCP] & CharFlags.Octal) {
// Octal integer literals are not permitted in strict mode code

@@ -62,3 +62,3 @@ if (context & Context.Strict) report(parser, Errors.StrictOctalEscape);

do {
if (CharTypes[parser.currentCodePoint] & CharFlags.ImplicitOctalDigits) {
if (CharTypes[parser.nextCP] & CharFlags.ImplicitOctalDigits) {
kind = NumberKind.DecimalWithLeadingZero;

@@ -68,5 +68,5 @@ atStart = false;

}
value = value * 8 + (parser.currentCodePoint - Chars.Zero);
value = value * 8 + (parser.nextCP - Chars.Zero);
} while (CharTypes[nextCodePoint(parser)] & CharFlags.Decimal);
} else if (CharTypes[parser.currentCodePoint] & CharFlags.ImplicitOctalDigits) {
} else if (CharTypes[parser.nextCP] & CharFlags.ImplicitOctalDigits) {
if (context & Context.Strict) report(parser, Errors.StrictOctalEscape);

@@ -83,4 +83,4 @@ else parser.flags = Flags.Octals;

let digit = 9;
while (digit >= 0 && CharTypes[parser.currentCodePoint] & CharFlags.Decimal) {
value = 10 * value + (parser.currentCodePoint - Chars.Zero);
while (digit >= 0 && CharTypes[parser.nextCP] & CharFlags.Decimal) {
value = 10 * value + (parser.nextCP - Chars.Zero);
nextCodePoint(parser);

@@ -90,3 +90,3 @@ --digit;

if (digit >= 0 && parser.currentCodePoint !== Chars.Period && !isIdentifierStart(parser.currentCodePoint)) {
if (digit >= 0 && parser.nextCP !== Chars.Period && !isIdentifierStart(parser.nextCP)) {
if (context & Context.OptionsRaw) parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);

@@ -98,3 +98,3 @@ parser.tokenValue = value;

while (CharTypes[parser.currentCodePoint] & CharFlags.Decimal) {
while (CharTypes[parser.nextCP] & CharFlags.Decimal) {
nextCodePoint(parser);

@@ -104,6 +104,6 @@ }

// Scan any decimal dot and fractional component
if (parser.currentCodePoint === Chars.Period) {
if (parser.nextCP === Chars.Period) {
isFloat = true;
nextCodePoint(parser); // consumes '.'
while (CharTypes[parser.currentCodePoint] & CharFlags.Decimal) {
while (CharTypes[parser.nextCP] & CharFlags.Decimal) {
nextCodePoint(parser);

@@ -117,3 +117,3 @@ }

if (
parser.currentCodePoint === Chars.LowerN &&
parser.nextCP === Chars.LowerN &&
(kind & (NumberKind.Decimal | NumberKind.Binary | NumberKind.Octal | NumberKind.Hex)) !== 0

@@ -125,3 +125,3 @@ ) {

// Scan any exponential notation
} else if ((parser.currentCodePoint | 32) === Chars.LowerE) {
} else if ((parser.nextCP | 32) === Chars.LowerE) {
if ((kind & (NumberKind.Decimal | NumberKind.DecimalWithLeadingZero)) === 0) {

@@ -134,3 +134,3 @@ report(parser, Errors.MissingExponent);

// '-', '+'
if (CharTypes[parser.currentCodePoint] & CharFlags.Exponent) {
if (CharTypes[parser.nextCP] & CharFlags.Exponent) {
nextCodePoint(parser);

@@ -141,3 +141,3 @@ }

// Consume exponential digits
while (CharTypes[parser.currentCodePoint] & CharFlags.Decimal) {
while (CharTypes[parser.nextCP] & CharFlags.Decimal) {
nextCodePoint(parser);

@@ -154,3 +154,3 @@ exponentDigits++;

// not be an identifier start or a decimal digit
if (CharTypes[parser.currentCodePoint] & CharFlags.Decimal || isIdentifierStart(parser.currentCodePoint)) {
if (CharTypes[parser.nextCP] & CharFlags.Decimal || isIdentifierStart(parser.nextCP)) {
report(parser, Errors.IDStartAfterNumber);

@@ -157,0 +157,0 @@ }

@@ -25,3 +25,3 @@ import { Chars } from '../chars';

loop: while (true) {
const ch = parser.currentCodePoint;
const ch = parser.nextCP;
nextCodePoint(parser);

@@ -76,3 +76,3 @@

loop: while (parser.index < parser.source.length) {
switch (parser.currentCodePoint) {
switch (parser.nextCP) {
case Chars.LowerG:

@@ -109,3 +109,3 @@ if (mask & RegexFlags.Global) report(parser, Errors.DuplicateRegExpFlag, 'g');

default:
if (!isIdentifierPart(parser.currentCodePoint)) break loop;
if (!isIdentifierPart(parser.nextCP)) break loop;
report(parser, Errors.UnexpectedTokenRegExpFlag);

@@ -112,0 +112,0 @@ }

@@ -30,3 +30,4 @@ import { skipSingleLineComment, skipMultiLineComment, ScannerState, Seek } from './';

* WhiteSpace: 9, 11, 12, 32: '\t', '\v', '\f', ' '
* CarriageReturn: 10, 13: '\n', '\r'
* LineFeed: 10: '\n'
* CarriageReturn: 13: '\r'
* Template: 96: '`'

@@ -166,15 +167,21 @@ */

/**
* Scans next token in the stream
*
* @param parser Parser object
* @param context Context masks
*/
export function nextToken(parser: ParserState, context: Context): void {
parser.flags &= ~Flags.NewLine;
parser.startIndex = parser.index;
parser.token = scanSingleToken(parser, context);
parser.token = scanSingleToken(parser, context, ScannerState.None);
}
export function scanSingleToken(parser: ParserState, context: Context): Token {
let state = ScannerState.None;
export function scanSingleToken(parser: ParserState, context: Context, state: ScannerState): Token {
const isStartOfLine = parser.index === 0;
while (parser.index < parser.end) {
parser.tokenIndex = parser.index;
const first = parser.currentCodePoint;
const first = parser.nextCP;

@@ -213,3 +220,3 @@ if (first <= 0x7e) {

parser.column = 0;
parser.currentCodePoint = parser.source.charCodeAt(++parser.index);
parser.nextCP = parser.source.charCodeAt(++parser.index);
parser.line++;

@@ -225,3 +232,3 @@ break;

state = (state & ~ScannerState.LastIsCR) | ScannerState.NewLine;
parser.currentCodePoint = parser.source.charCodeAt(++parser.index);
parser.nextCP = parser.source.charCodeAt(++parser.index);
break;

@@ -264,3 +271,3 @@ // Look for an identifier.

if (parser.index >= parser.end) return Token.Multiply;
const next = parser.currentCodePoint;
const next = parser.nextCP;

@@ -274,3 +281,3 @@ if (next === Chars.EqualSign) {

nextCodePoint(parser);
if (parser.currentCodePoint !== Chars.EqualSign) return Token.Exponentiate;
if (parser.nextCP !== Chars.EqualSign) return Token.Exponentiate;
nextCodePoint(parser);

@@ -291,3 +298,3 @@ return Token.ExponentiateAssign;

if (parser.currentCodePoint === Chars.Plus) {
if (parser.nextCP === Chars.Plus) {
nextCodePoint(parser);

@@ -297,3 +304,3 @@ return Token.Increment;

if (parser.currentCodePoint === Chars.EqualSign) {
if (parser.nextCP === Chars.EqualSign) {
nextCodePoint(parser);

@@ -310,3 +317,3 @@ return Token.AddAssign;

if (parser.index >= parser.end) return Token.Subtract;
const next = parser.currentCodePoint;
const next = parser.nextCP;

@@ -318,3 +325,3 @@ if (next === Chars.Hyphen) {

(state & ScannerState.NewLine || isStartOfLine) &&
parser.currentCodePoint === Chars.GreaterThan
parser.nextCP === Chars.GreaterThan
) {

@@ -340,3 +347,3 @@ if ((context & Context.OptionsWebCompat) === 0) report(parser, Errors.HtmlCommentInWebCompat);

if (parser.index < parser.end) {
const ch = parser.currentCodePoint;
const ch = parser.nextCP;
if (ch === Chars.Slash) {

@@ -366,6 +373,6 @@ nextCodePoint(parser);

switch (parser.currentCodePoint) {
switch (parser.nextCP) {
case Chars.LessThan:
nextCodePoint(parser);
if ((parser.currentCodePoint as number) === Chars.EqualSign) {
if ((parser.nextCP as number) === Chars.EqualSign) {
nextCodePoint(parser);

@@ -401,7 +408,7 @@ return Token.ShiftLeftAssign;

if (parser.index >= parser.end) return Token.Assign;
const next = parser.currentCodePoint;
const next = parser.nextCP;
if (next === Chars.EqualSign) {
nextCodePoint(parser);
if (parser.currentCodePoint === Chars.EqualSign) {
if (parser.nextCP === Chars.EqualSign) {
nextCodePoint(parser);

@@ -424,3 +431,3 @@ return Token.StrictEqual;

if (parser.index >= parser.end) return Token.BitwiseOr;
const next = parser.currentCodePoint;
const next = parser.nextCP;

@@ -442,3 +449,3 @@ if (next === Chars.VerticalBar) {

if (parser.index >= parser.end) return Token.GreaterThan;
const next = parser.currentCodePoint;
const next = parser.nextCP;

@@ -454,7 +461,7 @@ if (next === Chars.EqualSign) {

if (parser.index < parser.end) {
const next = parser.currentCodePoint;
const next = parser.nextCP;
if (next === Chars.GreaterThan) {
nextCodePoint(parser);
if (parser.currentCodePoint === Chars.EqualSign) {
if (parser.nextCP === Chars.EqualSign) {
nextCodePoint(parser);

@@ -478,3 +485,3 @@ return Token.LogicalShiftRightAssign;

if (parser.index >= parser.end) return Token.BitwiseAnd;
const next = parser.currentCodePoint;
const next = parser.nextCP;

@@ -496,6 +503,6 @@ if (next === Chars.Ampersand) {

nextCodePoint(parser);
if ((CharTypes[parser.currentCodePoint] & CharFlags.Decimal) !== 0) return scanNumber(parser, context, true);
if (parser.currentCodePoint === Chars.Period) {
if ((CharTypes[parser.nextCP] & CharFlags.Decimal) !== 0) return scanNumber(parser, context, true);
if (parser.nextCP === Chars.Period) {
nextCodePoint(parser);
if (parser.currentCodePoint === Chars.Period) {
if (parser.nextCP === Chars.Period) {
nextCodePoint(parser);

@@ -515,10 +522,10 @@ return Token.Ellipsis;

parser.column = 0;
parser.currentCodePoint = parser.source.charCodeAt(++parser.index);
parser.nextCP = parser.source.charCodeAt(++parser.index);
parser.line++;
continue;
}
if (isIDStart(parser.currentCodePoint) || consumeMultiUnitCodePoint(parser, parser.currentCodePoint)) {
if (isIDStart(parser.nextCP) || consumeMultiUnitCodePoint(parser, parser.nextCP)) {
return scanIdentifier(parser, context);
}
if (isExoticECMAScriptWhitespace(parser.currentCodePoint)) {
if (isExoticECMAScriptWhitespace(parser.nextCP)) {
nextCodePoint(parser);

@@ -525,0 +532,0 @@ continue;

@@ -20,3 +20,3 @@ import { ParserState, Context } from '../common';

export function scanString(parser: ParserState, context: Context): any {
const quote = parser.currentCodePoint;
const quote = parser.nextCP;
const { index: start } = parser;

@@ -82,3 +82,3 @@ let ret: string | void = '';

if (ch === Chars.LineFeed) {
parser.currentCodePoint = ch;
parser.nextCP = ch;
parser.index = index + 1;

@@ -116,3 +116,3 @@ }

} else {
parser.currentCodePoint = next;
parser.nextCP = next;
code = (code << 3) | (next - Chars.Zero);

@@ -126,3 +126,3 @@ index++;

if (CharTypes[next] & CharFlags.Octal) {
parser.currentCodePoint = next;
parser.nextCP = next;
code = (code << 3) | (next - Chars.Zero);

@@ -157,3 +157,3 @@ index++;

code = (code << 3) | (next - Chars.Zero);
parser.currentCodePoint = next;
parser.nextCP = next;
parser.index = index;

@@ -191,10 +191,10 @@ parser.column = column;

if (parser.currentCodePoint === Chars.LeftBrace) {
if (parser.nextCP === Chars.LeftBrace) {
let code = 0;
while ((CharTypes[nextCodePoint(parser)] & CharFlags.Hex) !== 0) {
code = (code << 4) | toHex(parser.currentCodePoint);
code = (code << 4) | toHex(parser.nextCP);
if (code > Chars.NonBMPMax) return Escape.OutOfRange;
}
if (parser.currentCodePoint < 1 || (parser.currentCodePoint as number) !== Chars.RightBrace) {
if (parser.nextCP < 1 || (parser.nextCP as number) !== Chars.RightBrace) {
return Escape.InvalidHex;

@@ -201,0 +201,0 @@ }

@@ -46,3 +46,3 @@ import { ParserState, Context } from '../common';

ret += fromCodePoint(ch);
parser.currentCodePoint = parser.source.charCodeAt(++parser.index);
parser.nextCP = parser.source.charCodeAt(++parser.index);
}

@@ -49,0 +49,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc