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

moo

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moo - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

38

moo.js

@@ -7,3 +7,3 @@ (function(root, factory) {

} else {
root.Moo = factory()
root.moo = factory()
}

@@ -279,6 +279,6 @@ }(this, function() {

var Lexer = function(states, state) {
this.startState = state
this.states = states
this.buffer = ''
this.stack = []
this.setState(state)
this.reset()

@@ -333,11 +333,22 @@ }

group = this.error
if (!group) {
// TODO prettier syntax errors
throw new Error('Syntax error')
}
// consume rest of buffer
text = value = buffer.slice(index)
re.lastIndex = buffer.length
// throw, if no rule with {error: true}
if (!group) {
// seek to end
this.index = buffer.length
var start = Math.max(0, index - this.col + 1)
var eol = text.indexOf('\n')
if (eol === -1) eol = text.length
var line = buffer.slice(start, index + eol)
var message = ""
message += "invalid syntax at line " + this.line + " col " + this.col + ":\n\n"
message += " " + line + "\n"
message += " " + Array(this.col).join(" ") + "^"
throw new Error(message)
}
} else {

@@ -415,7 +426,8 @@ text = match[0]

Lexer.prototype.reset = function(data, state) {
Lexer.prototype.reset = function(data, info) {
this.buffer = data || ''
this.index = 0
this.line = state ? state.line : 1
this.col = state ? state.col : 1
this.line = info ? info.line : 1
this.col = info ? info.col : 1
this.setState(info ? info.state : this.startState)
return this

@@ -428,10 +440,6 @@ }

col: this.col,
state: this.state,
}
}
Lexer.prototype.feed = function(data) {
this.buffer += data
return this
}
Lexer.prototype.clone = function() {

@@ -438,0 +446,0 @@ return new Lexer(this.states, this.state)

{
"name": "moo",
"version": "0.2.0",
"version": "0.3.0",
"description": "Optimised tokenizer/lexer generator! 🐄 Uses /y for performance. Moo!",

@@ -23,3 +23,3 @@ "main": "moo.js",

"benchr": "^3.2.0",
"chevrotain": "^0.23.0",
"chevrotain": "^0.27.1",
"eslint": "^3.17.1",

@@ -26,0 +26,0 @@ "jest": "^19.0.2",

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