New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

krl-parser

Package Overview
Dependencies
Maintainers
2
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

krl-parser - npm Package Compare versions

Comparing version 0.12.9 to 0.13.0

src/tokenizer.js

3

package.json
{
"name": "krl-parser",
"version": "0.12.9",
"version": "0.13.0",
"description": "Parse KRL source code into an AST",

@@ -41,3 +41,2 @@ "main": "src/index.js",

"dependencies": {
"comment-regex": "^1.0.0",
"excerpt-at-line-col": "^1.0.0",

@@ -44,0 +43,0 @@ "line-column": "^1.0.2",

var nearley = require('nearley');
var grammar = require('./grammar.js');
var tokenizer = require('./tokenizer');
var lineColumn = require('line-column');
var commentsToSpaces = require('./commentsToSpaces');
var excerptAtLineCol = require('excerpt-at-line-col');

@@ -32,8 +32,16 @@

var tokens = tokenizer(src).filter(function(t){
return true
&& t.type !== "WHITESPACE"
&& t.type !== "LINE-COMMENT"
&& t.type !== "BLOCK-COMMENT"
;
});
var p = new nearley.Parser(grammar.ParserRules, grammar.ParserStart);
try{
p.feed(commentsToSpaces(src));
p.feed(tokens);
}catch(e){
if(typeof e.offset === "number"){
var lc = lineColumn(src, e.offset);
if(typeof e.offset === "number" && tokens[e.offset] && tokens[e.offset].loc){
var lc = lineColumn(src, tokens[e.offset].loc.start);
if(lc){

@@ -40,0 +48,0 @@ throw mkParseError(src, lc.line, lc.col, e, opts.filename);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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