Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(input, function () {
const state = new ParserState(input);
const result = parse(state, Access.Reset, Precedence.Variadic, bindingType);
assert.deepStrictEqual(result, expected);
});
}
it(input, function () {
const state = new ParserState(input);
const result = parse(state, Access.Reset, Precedence.Assign, bindingType);
if ((result.$kind & ExpressionKind.IsPrimary) > 0 ||
(result.$kind & ExpressionKind.Unary) === ExpressionKind.Unary ||
(result.$kind & ExpressionKind.Binary) === ExpressionKind.Binary ||
(result.$kind & ExpressionKind.Conditional) === ExpressionKind.Conditional ||
(result.$kind & ExpressionKind.Assign) === ExpressionKind.Assign) {
if ((expected.$kind & ExpressionKind.IsPrimary) > 0 ||
(expected.$kind & ExpressionKind.Unary) === ExpressionKind.Unary ||
(expected.$kind & ExpressionKind.Binary) === ExpressionKind.Binary ||
(expected.$kind & ExpressionKind.Conditional) === ExpressionKind.Conditional ||
(expected.$kind & ExpressionKind.Assign) === ExpressionKind.Assign) {
assert.deepStrictEqual(result, expected);
assert.strictEqual(state.index >= state.length, true, `state.index >= state.length`);
} else {
assert.strictEqual(state.index < state.length, true, `state.index < state.length`);
assert.notStrictEqual(result.$kind, expected.$kind, 'result.$kind');
}
it(input, function () {
const state = new ParserState(input);
const result = parse(state, Access.Reset, Precedence.Conditional, bindingType);
if ((result.$kind & ExpressionKind.IsPrimary) > 0 ||
(result.$kind & ExpressionKind.Unary) === ExpressionKind.Unary ||
(result.$kind & ExpressionKind.Binary) === ExpressionKind.Binary ||
(result.$kind & ExpressionKind.Conditional) === ExpressionKind.Conditional) {
if ((expected.$kind & ExpressionKind.IsPrimary) > 0 ||
(expected.$kind & ExpressionKind.Unary) === ExpressionKind.Unary ||
(expected.$kind & ExpressionKind.Binary) === ExpressionKind.Binary ||
(expected.$kind & ExpressionKind.Conditional) === ExpressionKind.Conditional) {
assert.deepStrictEqual(result, expected);
assert.strictEqual(state.index >= state.length, true, `state.index >= state.length`);
} else {
assert.strictEqual(state.index < state.length, true, `state.index < state.length`);
assert.notStrictEqual(result.$kind, expected.$kind, 'result.$kind');
}
} else {
throw new Error('Should not parse anything higher than ConditionalExpression');
it(input, function () {
const state = new ParserState(input);
const result = parse(state, Access.Reset, Precedence.Unary, bindingType);
if ((result.$kind & ExpressionKind.IsPrimary) > 0 ||
(result.$kind & ExpressionKind.Unary) === ExpressionKind.Unary) {
if ((expected.$kind & ExpressionKind.IsPrimary) > 0 ||
(expected.$kind & ExpressionKind.Unary) === ExpressionKind.Unary) {
assert.deepStrictEqual(result, expected);
assert.strictEqual(state.index >= state.length, true, `state.index >= state.length`);
} else {
assert.strictEqual(state.index < state.length, true, `state.index < state.length`);
assert.notStrictEqual(result.$kind, expected.$kind, 'result.$kind');
}
} else {
throw new Error('Should not parse anything higher than UnaryExpression');
}
});
}
it(input, function () {
const state = new ParserState(input);
const result = parse(state, Access.Reset, Precedence.Binary, bindingType);
if ((result.$kind & ExpressionKind.IsPrimary) > 0 ||
(result.$kind & ExpressionKind.Unary) === ExpressionKind.Unary ||
(result.$kind & ExpressionKind.Binary) === ExpressionKind.Binary) {
if ((expected.$kind & ExpressionKind.IsPrimary) > 0 ||
(expected.$kind & ExpressionKind.Unary) === ExpressionKind.Unary ||
(expected.$kind & ExpressionKind.Binary) === ExpressionKind.Binary) {
assert.deepStrictEqual(result, expected);
assert.strictEqual(state.index >= state.length, true, `state.index >= state.length`);
} else {
assert.strictEqual(state.index < state.length, true, `state.index < state.length`);
assert.notStrictEqual(result.$kind, expected.$kind, 'result.$kind');
}
} else {
throw new Error('Should not parse anything higher than BinaryExpression');
}
});