From ea8303ef51c9543e3c9b3851fb2ad0a5e8dfee01 Mon Sep 17 00:00:00 2001 From: Snehil Shah Date: Sat, 10 Aug 2024 21:54:38 +0530 Subject: [PATCH] fix: handle tokens where start idx is greater than end idx PR-URL: #2770 Signed-off-by: Snehil Shah Reviewed-by: Philipp Burckhardt --- lib/node_modules/@stdlib/repl/lib/tokenizer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/repl/lib/tokenizer.js b/lib/node_modules/@stdlib/repl/lib/tokenizer.js index 612844f61718..188ae75ce857 100644 --- a/lib/node_modules/@stdlib/repl/lib/tokenizer.js +++ b/lib/node_modules/@stdlib/repl/lib/tokenizer.js @@ -103,7 +103,7 @@ function tokenizer( line, context ) { */ function onToken( token ) { // Ignore placeholders & EOF tokens: - if ( token.start === token.end ) { + if ( token.start >= token.end ) { return; } if ( token.type.isLoop || isControlKeyword( token.type.keyword ) || ( token.type.label === 'name' && isUnrecognizedControlKeyword( token.value ) ) ) { @@ -196,7 +196,7 @@ function tokenizer( line, context ) { var i; // Ignore placeholder nodes: - if ( node.start === node.end ) { + if ( node.start >= node.end ) { return true; } // Ignore node if it is an unrecognized `keyword`: @@ -275,7 +275,7 @@ function tokenizer( line, context ) { var obj; // Ignore placeholder nodes: - if ( node.start === node.end ) { + if ( node.start >= node.end ) { return; } @@ -308,7 +308,7 @@ function tokenizer( line, context ) { property = properties.next(); while ( !property.done ) { // Ignore placeholder nodes: - if ( property.value.start === property.value.end ) { + if ( property.value.start >= property.value.end ) { return; } // Case: 'bar' in `foo['bar']` - property already pushed as a string token. Ignore...