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

parsimmon

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsimmon - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

build/parsimmon.commonjs.js

8

package.json
{
"name": "parsimmon",
"version": "0.2.0",
"version": "0.2.1",
"description": "A monadic LL(infinity) parser combinator library",

@@ -9,3 +9,3 @@ "keywords": ["parsing", "parse", "parser combinators"],

"files": ["index.js", "src", "test", "Makefile", "package.json"],
"files": ["index.js", "src", "test", "Makefile", "package.json", "build/parsimmon.commonjs.js"],
"main": "index.js",

@@ -18,8 +18,8 @@ "devDependencies": {

"dependencies": {
"pjs": "3.x"
"pjs": "5.x"
},
"scripts": {
"install": "make commonjs",
"prepublish": "make commonjs",
"test": "make test"
}
}

@@ -71,9 +71,3 @@ var Parsimmon = {};

_.or = function(alternative) {
var self = this;
return Parser(function(stream, i) {
var result = self._(stream, i);
return result.status ? result : furthestBacktrackFor(alternative._(stream, i), result);
});
return alt([this, alternative]);
};

@@ -172,3 +166,3 @@

for (; times < max && result; times += 1) {
for (; times < max; times += 1) {
result = self._(stream, i);

@@ -308,4 +302,15 @@ prevResult = furthestBacktrackFor(result, prevResult);

});
}
};
var alt = Parsimmon.alt = function(parsers) {
return Parser(function(stream, i) {
var result;
for (var j = 0; j < parsers.length; j += 1) {
result = furthestBacktrackFor(parsers[j]._(stream, i), result);
if (result.status) return result;
}
return result;
});
};
var index = Parsimmon.index = Parser(function(stream, i) {

@@ -317,4 +322,5 @@ return makeSuccess(i, i);

//- Semigroup
_.concat = _.then;
//- Monoid (Alternative, really)
_.concat = _.or;
_.empty = fail('empty')

@@ -321,0 +327,0 @@ //- Applicative

@@ -185,2 +185,11 @@ suite('parser', function() {

test('atMost', function() {
var atMostTwo = letter.atMost(2);
debugger
assertEqualArray(atMostTwo.parse(''), []);
assertEqualArray(atMostTwo.parse('a'), ['a']);
assertEqualArray(atMostTwo.parse('ab'), ['a', 'b']);
assert.throws(function() { atMostTwo.parse('abc'); });
});
test('atLeast', function() {

@@ -187,0 +196,0 @@ var atLeastTwo = letter.atLeast(2);

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