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.0 to 0.3.1

9

index.js

@@ -340,6 +340,8 @@ var __extends = this.__extends || function (d, b) {

var Tokenizer = (function () {
function Tokenizer(default_rules, state_rules) {
function Tokenizer(default_rules, state_rules, peek_length) {
if (state_rules === void 0) { state_rules = {}; }
if (peek_length === void 0) { peek_length = 256; }
this.default_rules = default_rules;
this.state_rules = state_rules;
this.peek_length = peek_length;
}

@@ -377,3 +379,3 @@ Tokenizer.prototype.getRules = function (state_name) {

var rules = this.tokenizer.getRules(state);
var input = this.iterable.peek(256);
var input = this.iterable.peek(this.tokenizer.peek_length);
for (var i = 0, rule; (rule = rules[i]); i++) {

@@ -386,3 +388,4 @@ var match = input.match(rule[0]);

}
throw new Error("Invalid language; could not find a match in input \"" + input + "\" while in state \"" + state + "\"");
var state_description = (state === undefined) ? 'the default state' : "state \"" + state + "\"";
throw new Error("Invalid language; could not find a match in input \"" + input + "\" while in " + state_description);
};

@@ -389,0 +392,0 @@ /**

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

constructor(private default_rules: RegexRule<T>[],
private state_rules: {[index: string]: RegexRule<T>[]} = {}) { }
private state_rules: {[index: string]: RegexRule<T>[]} = {},
public peek_length: number = 256) { }

@@ -417,3 +418,3 @@ getRules(state_name: string): RegexRule<T>[] {

var rules = this.tokenizer.getRules(state);
var input = this.iterable.peek(256);
var input = this.iterable.peek(this.tokenizer.peek_length);
for (var i = 0, rule; (rule = rules[i]); i++) {

@@ -427,3 +428,4 @@ var match = input.match(rule[0]);

throw new Error(`Invalid language; could not find a match in input "${input}" while in state "${state}"`);
var state_description = (state === undefined) ? 'the default state' : `state "${state}"`;
throw new Error(`Invalid language; could not find a match in input "${input}" while in ${state_description}`);
}

@@ -430,0 +432,0 @@

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

private state_rules;
peek_length: number;
constructor(default_rules: RegexRule<T>[], state_rules?: {
[index: string]: RegexRule<T>[];
});
}, peek_length?: number);
getRules(state_name: string): RegexRule<T>[];

@@ -224,0 +225,0 @@ /**

{
"name": "lexing",
"version": "0.3.0",
"version": "0.3.1",
"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