Socket
Socket
Sign inDemoInstall

lex

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lex - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

3

lib/lexer.js

@@ -9,2 +9,3 @@ if (typeof module === "object" && typeof module.exports === "object") module.exports = Lexer;

this.input = input;
return this;
};

@@ -36,2 +37,4 @@

});
return this;
};

@@ -38,0 +41,0 @@

2

package.json
{
"name": "lex",
"description": "An elegant armor-plated JavaScript lexer modelled after flex. Easily extensible to tailor to your need for perfection.",
"version": "1.2.0",
"version": "1.3.0",
"keywords": ["lexer"],

@@ -6,0 +6,0 @@ "author": "Aadit M Shah (http://aaditmshah.github.com/) <aaditmshah@myopera.com>",

@@ -29,3 +29,3 @@ # Lexer #

After adding rules to the lexer you may set the property `input` of the lexer to any string that you wish to tokenize and then call the method `lex`. The function returns the first non `undefined` value returned by an action. Else it returns `undefined` if it scans the entire input string. On calling `lex` it starts scanning where it last left off.
After adding rules to the lexer you may set the property `input` of the lexer to any string that you wish to tokenize and then call the method `lex`. The function returns the first non `undefined` value returned by an action. Else it returns `undefined` if it scans the entire input string. On calling `lex` it starts scanning where it last left off. The `addRule` and `setInput` methods of the lexer support chaining.

@@ -36,16 +36,8 @@ ```javascript

var lexer = new Lexer;
lexer.addRule(/\n/, function () {
(new Lexer).addRule(/\n/, function () {
lines++;
chars++;
});
lexer.addRule(/./, function () {
}).addRule(/./, function () {
chars++;
});
lexer.input = "Hello World!";
lexer.lex();
}).setInput("Hello World!").lex();
```

@@ -52,0 +44,0 @@

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