Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lexing

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lexing - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

.travis.yml

49

index.js

@@ -501,2 +501,9 @@ var __extends = this.__extends || function (d, b) {

}
Object.defineProperty(MachineState.prototype, "name", {
get: function () {
return this.constructor['name'];
},
enumerable: true,
configurable: true
});
// generic callbacks

@@ -513,20 +520,32 @@ MachineState.prototype.pop = function () {

MachineState.prototype.read = function () {
var input = this.iterable.peek(this.peek_length);
for (var i = 0, rule; (rule = this.rules[i]); i++) {
var match = input.match(rule[0]);
if (match) {
// advance the input tape over the matched input
this.iterable.skip(match[0].length);
// apply the matched transition
var result = rule[1].call(this, match);
if (result !== undefined) {
return result;
while (1) {
var input = this.iterable.peek(this.peek_length);
var match;
for (var i = 0, rule; (rule = this.rules[i]); i++) {
// rule[0] is the RegExp; rule[1] is the instance method to call on success
match = input.match(rule[0]);
if (match !== null) {
// advance the input tape over the matched input
this.iterable.skip(match[0].length);
// apply the matched transition
var result = rule[1].call(this, match);
if (result !== undefined) {
return result;
}
if (input.length === 0) {
throw new Error("EOF reached without termination; cannot continue");
}
if (match[0].length === 0) {
throw new Error("0-width match found without termination; cannot continue");
}
// break out of the for loop while match is still defined
break;
}
else {
return this.read();
}
}
// If at some point in the input iterable we run through all the patterns
// and none of them match, we cannot proceed further.
if (match === null) {
throw new Error("Invalid language; could not find a match in input \"" + input + "\" for state \"" + this.name + "\"");
}
}
var message = "Invalid language; could not find a match in input \"" + input + "\"";
throw new Error(message);
};

@@ -533,0 +552,0 @@ return MachineState;

@@ -555,2 +555,6 @@ /// <reference path="type_declarations/DefinitelyTyped/node/node.d.ts" />

private get name(): string {
return this.constructor['name'];
}
// generic callbacks

@@ -569,22 +573,33 @@ pop(): T {

read(): T {
var input = this.iterable.peek(this.peek_length);
for (var i = 0, rule: MachineRule<T>; (rule = this.rules[i]); i++) {
var match = input.match(rule[0]);
if (match) {
// advance the input tape over the matched input
this.iterable.skip(match[0].length);
// apply the matched transition
var result = rule[1].call(this, match);
if (result !== undefined) {
return result;
while (1) {
var input = this.iterable.peek(this.peek_length);
var match: RegExpMatchArray;
for (var i = 0, rule: MachineRule<T>; (rule = this.rules[i]); i++) {
// rule[0] is the RegExp; rule[1] is the instance method to call on success
match = input.match(rule[0]);
if (match !== null) {
// advance the input tape over the matched input
this.iterable.skip(match[0].length);
// apply the matched transition
var result = rule[1].call(this, match);
if (result !== undefined) {
return result;
}
if (input.length === 0) {
throw new Error(`EOF reached without termination; cannot continue`);
}
if (match[0].length === 0) {
throw new Error(`0-width match found without termination; cannot continue`);
}
// break out of the for loop while match is still defined
break;
}
else {
return this.read();
}
}
// If at some point in the input iterable we run through all the patterns
// and none of them match, we cannot proceed further.
if (match === null) {
throw new Error(`Invalid language; could not find a match in input "${input}" for state "${this.name}"`);
}
}
var message = `Invalid language; could not find a match in input "${input}"`;
throw new Error(message);
}

@@ -591,0 +606,0 @@ }

@@ -288,2 +288,3 @@ /// <reference path="../../type_declarations/DefinitelyTyped/node/node.d.ts" />

constructor(iterable: StringIterable, peek_length?: number);
private name;
pop(): T;

@@ -290,0 +291,0 @@ ignore(): T;

{
"name": "lexing",
"version": "0.3.4",
"version": "0.3.5",
"description": "Regex-based lexer",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc