Comparing version 0.4.2 to 0.4.3
10
index.js
@@ -5,4 +5,3 @@ //// export module lexing { | ||
function __() { this.constructor = d; } | ||
__.prototype = b.prototype; | ||
d.prototype = new __(); | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
@@ -301,7 +300,12 @@ /** | ||
// TODO (see TODO in next()) | ||
// _ensureLength(length) ensures that our subsequent call to toString() will | ||
// return a string that is at least `length` long. | ||
this._ensureLength(length); | ||
var consumed_string = this._buffer.toString(this._encoding).slice(0, length); | ||
// even though we know we consumed (at least) `length` number of characters, | ||
// we also need to know exactly how long that string is in bytes, in order | ||
// to advance the underlying buffer appropriately | ||
var byteLength = Buffer.byteLength(consumed_string, this._encoding); | ||
// we cannot skip more than `this._buffer.length` bytes | ||
var bytesSkipped = Math.min(byteLength, this._buffer.length); | ||
// var bytesSkipped = Math.min(byteLength, this._buffer.length); // is this necessary? | ||
this._buffer = this._buffer.slice(byteLength); | ||
@@ -308,0 +312,0 @@ return consumed_string.length; |
@@ -348,7 +348,12 @@ //// export module lexing { | ||
// TODO (see TODO in next()) | ||
// _ensureLength(length) ensures that our subsequent call to toString() will | ||
// return a string that is at least `length` long. | ||
this._ensureLength(length); | ||
var consumed_string = this._buffer.toString(this._encoding).slice(0, length); | ||
// even though we know we consumed (at least) `length` number of characters, | ||
// we also need to know exactly how long that string is in bytes, in order | ||
// to advance the underlying buffer appropriately | ||
var byteLength = Buffer.byteLength(consumed_string, this._encoding); | ||
// we cannot skip more than `this._buffer.length` bytes | ||
var bytesSkipped = Math.min(byteLength, this._buffer.length); | ||
// var bytesSkipped = Math.min(byteLength, this._buffer.length); // is this necessary? | ||
this._buffer = this._buffer.slice(byteLength); | ||
@@ -355,0 +360,0 @@ return consumed_string.length; |
{ | ||
"name": "lexing", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Regex-based lexer", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
136192
12
3070