Comparing version 0.8.2 to 0.9.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.equalTo = exports.lastIndexOf = exports.indexOf = exports.compare = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ Returns true iff `haystack`, starting at fromIndex, matches `needle`. |
@@ -67,7 +67,7 @@ /// <reference types="node" /> | ||
constructor(_buffer: Buffer, position?: number); | ||
static fromString(str: string, encoding?: string): BufferIterator; | ||
static fromString(str: string, encoding?: BufferEncoding): BufferIterator; | ||
/** | ||
Return the total length of the underlying Buffer. | ||
*/ | ||
readonly size: number; | ||
get size(): number; | ||
/** | ||
@@ -84,3 +84,3 @@ Read the next `length` bytes from the underlying Buffer, or fewer iff we reach | ||
`new Buffer([1, 2, 3, 4]).slice(2, 10)` produces `<Buffer 03 04>` | ||
`Buffer.from([1, 2, 3, 4]).slice(2, 10)` produces `<Buffer 03 04>` | ||
*/ | ||
@@ -105,7 +105,7 @@ next(length: number): Buffer; | ||
constructor(_string: string, position?: number); | ||
static fromBuffer(buffer: Buffer, encoding?: string, start?: number, end?: number): StringIterator; | ||
static fromBuffer(buffer: Buffer, encoding?: BufferEncoding, start?: number, end?: number): StringIterator; | ||
/** | ||
Return the total length of the underlying Buffer. | ||
*/ | ||
readonly size: number; | ||
get size(): number; | ||
/** | ||
@@ -136,3 +136,3 @@ Read the next `length` characters from the underlying string, or fewer iff | ||
constructor(_array: Array<T>, position?: number); | ||
readonly size: number; | ||
get size(): number; | ||
next(): T; | ||
@@ -162,7 +162,7 @@ peek(): T; | ||
*/ | ||
readonly position: number; | ||
get position(): number; | ||
/** | ||
@returns {number} The total size (in bytes) of the underlying file. | ||
*/ | ||
readonly size: number; | ||
get size(): number; | ||
/** | ||
@@ -174,3 +174,3 @@ Read data from the underlying file and append it to the buffer. | ||
*/ | ||
private _fillBuffer(length); | ||
private _fillBuffer; | ||
/** | ||
@@ -213,3 +213,3 @@ Read from the underlying file, appending to the currently held buffer, | ||
private _encoding; | ||
constructor(source: Source, _encoding: string, position?: number, block_size?: number); | ||
constructor(source: Source, _encoding: BufferEncoding, position?: number, block_size?: number); | ||
peek(length: number): string; | ||
@@ -322,3 +322,3 @@ next(length: number): string; | ||
constructor(iterable: StringIterable, peek_length?: number); | ||
private readonly name; | ||
private get name(); | ||
/** | ||
@@ -325,0 +325,0 @@ pop() returns the value of this state. When used as a rule's callback, this |
30
index.js
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
@@ -13,2 +16,3 @@ extendStatics(d, b); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MachineState = exports.MachineRule = exports.Combiner = exports.Tokenizer = exports.Token = exports.SourceStringIterator = exports.SourceBufferIterator = exports.BufferedSourceReader = exports.ArrayIterator = exports.StringIterator = exports.BufferIterator = void 0; | ||
/** | ||
@@ -24,3 +28,3 @@ Wraps a Buffer as a stateful iterable. | ||
BufferIterator.fromString = function (str, encoding) { | ||
var buffer = new Buffer(str, encoding); | ||
var buffer = Buffer.from(str, encoding); | ||
return new BufferIterator(buffer); | ||
@@ -35,3 +39,3 @@ }; | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -52,3 +56,3 @@ }); | ||
`new Buffer([1, 2, 3, 4]).slice(2, 10)` produces `<Buffer 03 04>` | ||
`Buffer.from([1, 2, 3, 4]).slice(2, 10)` produces `<Buffer 03 04>` | ||
*/ | ||
@@ -94,3 +98,3 @@ BufferIterator.prototype.next = function (length) { | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -141,3 +145,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -180,3 +184,3 @@ }); | ||
this._block_size = _block_size; | ||
this._buffer = new Buffer(0); | ||
this._buffer = Buffer.alloc(0); | ||
} | ||
@@ -190,3 +194,3 @@ Object.defineProperty(BufferedSourceReader.prototype, "position", { | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -201,3 +205,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -212,3 +216,3 @@ }); | ||
BufferedSourceReader.prototype._fillBuffer = function (length) { | ||
var buffer = new Buffer(length); | ||
var buffer = Buffer.alloc(length); | ||
// always read from the current position | ||
@@ -500,3 +504,3 @@ var bytesRead = this._source.read(buffer, 0, length, this._position); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -503,0 +507,0 @@ }); |
{ | ||
"name": "lexing", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "Regex-based lexer", | ||
@@ -10,16 +10,13 @@ "keywords": [ | ||
"homepage": "https://github.com/chbrown/lexing", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/chbrown/lexing.git" | ||
}, | ||
"repository": "github:chbrown/lexing", | ||
"license": "MIT", | ||
"author": "Christopher Brown <io@henrian.com> (http://henrian.com)", | ||
"devDependencies": { | ||
"@types/mocha": "^2.2.44", | ||
"@types/node": "latest", | ||
"coveralls": "^2.13.3", | ||
"@types/mocha": "^8.0.4", | ||
"@types/node": "^14.14.9", | ||
"coveralls": "^3.1.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^2.5.3", | ||
"mocha": "^8.2.1", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"typescript": "^2.6.2" | ||
"typescript": "^4.1.2" | ||
}, | ||
@@ -26,0 +23,0 @@ "scripts": { |
@@ -73,3 +73,3 @@ # lexing | ||
npm installl lexing --save | ||
npm install lexing --save | ||
@@ -76,0 +76,0 @@ In your code: |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lastIndexOf = exports.indexOf = void 0; | ||
var buffer_1 = require("./buffer"); | ||
@@ -13,8 +14,8 @@ /** | ||
if (BLOCK_SIZE === void 0) { BLOCK_SIZE = 1024; } | ||
var needle = new Buffer(searchValue); | ||
var needle = Buffer.from(searchValue); | ||
var position = fromIndex; | ||
var haystack = new Buffer(0); | ||
var haystack = Buffer.alloc(0); | ||
var haystack_file_position = position; | ||
var haystack_search_offset = 0; | ||
var block_buffer = new Buffer(BLOCK_SIZE); | ||
var block_buffer = Buffer.alloc(BLOCK_SIZE); | ||
var bytesRead = BLOCK_SIZE; | ||
@@ -54,5 +55,5 @@ // exit loop once we read fewer bytes than intended (indicating EOF) | ||
if (BLOCK_SIZE === void 0) { BLOCK_SIZE = 1024; } | ||
var needle = new Buffer(searchValue); | ||
var needle = Buffer.from(searchValue); | ||
var position = fromIndex; | ||
var haystack = new Buffer(0); | ||
var haystack = Buffer.alloc(0); | ||
// haystack's position within file is always equal to `position` | ||
@@ -59,0 +60,0 @@ // exit loop once we reach the beginning of the file. |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
50686
1028
1