Skip to content

Commit

Permalink
chore(all): v. 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KFlash committed Mar 19, 2020
1 parent 030ceb2 commit 1a76dd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
26 changes: 9 additions & 17 deletions src/scanner/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,9 @@ export function scan(

if (char === Chars.QuestionMark) {
parser.index++;
if (source.charCodeAt(parser.index) === Chars.EqualSign) {
parser.index++;
return Token.CoalesceAssign;
}

return Token.Coalesce;
if (source.charCodeAt(parser.index) !== Chars.EqualSign) return Token.Coalesce;
parser.index++;
return Token.CoalesceAssign;
}

return Token.QuestionMark;
Expand Down Expand Up @@ -456,11 +453,9 @@ export function scan(

if (char === Chars.VerticalBar) {
parser.index++;
if (source.charCodeAt(parser.index) === Chars.EqualSign) {
parser.index++;
return Token.LogicalOrAssign;
}
return Token.LogicalOr;
if (source.charCodeAt(parser.index) !== Chars.EqualSign) return Token.LogicalOr;
parser.index++;
return Token.LogicalOrAssign;
}

if (char === Chars.EqualSign) {
Expand All @@ -476,12 +471,9 @@ export function scan(

if (char === Chars.Ampersand) {
parser.index++;
if (source.charCodeAt(parser.index) === Chars.EqualSign) {
parser.index++;
return Token.LogicalAndAssign;
}

return Token.LogicalAnd;
if (source.charCodeAt(parser.index) !== Chars.EqualSign) return Token.LogicalAnd;
parser.index++;
return Token.LogicalAndAssign;
}

if (char === Chars.EqualSign) {
Expand Down
9 changes: 0 additions & 9 deletions test/scanner/punctuators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ import { create } from '../../src/parser/core';
import { Token } from '../../src/token';
import { scan } from '../../src/scanner/scan';

function convertDecimalToBinary(digit: any, groups: boolean): string {
let res = '';
for (let i = 0, shifted = digit; i < 32; i++, res += String(shifted >>> 31), shifted <<= 1);
// Makes a groups of 8 bits
if (groups) res = res.replace(/\B(?=(.{8})+(?!.))/g, '_');
return res;
}

console.log(convertDecimalToBinary(67109002, false));
describe('Scanner - Punctuator', () => {
describe('scan()', () => {
interface Opts {
Expand Down

0 comments on commit 1a76dd0

Please sign in to comment.