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

bs-sedlex

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-sedlex - npm Package Compare versions

Comparing version 20.0.0-pre.2 to 20.0.0

3

bsconfig.json
{
"name": "bs-sedlex",
"version": "20.0.0-pre.2",
"version": "20.0.0",
"sources": [

@@ -19,2 +19,3 @@ {

"bsc-flags": [
"-open UcharShim",
"-bs-super-errors",

@@ -21,0 +22,0 @@ "-bs-no-version-header"

{
"name": "bs-sedlex-examples",
"version": "1.99.4-pre.5",
"sources": [

@@ -20,4 +19,4 @@ {

"suffix": ".bs.js",
"bsc-flags": ["-bs-super-errors", "-bs-no-version-header"],
"bsc-flags": ["-open UcharShim", "-bs-super-errors", "-bs-no-version-header"],
"refmt": 3
}
{
"name": "bs-sedlex",
"version": "20.0.0-pre.2",
"version": "20.0.0",
"description": "An OCaml lexer generator for Unicode",

@@ -10,17 +10,16 @@ "main": "index.js",

"dependencies": {
"bs-gen": "^0.5.2-pre.1"
"bs-gen": "^0.5.2",
"bs-uchar": "^2.0.0"
},
"devDependencies": {
"archiver": "^2.1.1",
"bs-platform": "^4.0.3",
"bs-uchar": "0.0.4",
"cpy": "^7.0.1",
"archiver": "^3.1.1",
"bs-platform": "^5.2.1",
"cpy": "^7.3.0",
"foreach-cli": "^1.8.1",
"make-dir": "^1.3.0",
"node-jq": "^1.3.1",
"ppx-sedlex": "=20.0.0-pre.2"
"node-jq": "^1.10.3",
"ppx-sedlex": "=20.0.0"
},
"peerDependencies": {
"bs-uchar": "*",
"bs-platform": ">=4.0.3"
"bs-platform": ">=5.0.0"
},

@@ -27,0 +26,0 @@ "scripts": {

<h1><img alt='Maintenance status: maintained' src="https://img.shields.io/maintenance/yes/2019.svg?style=popout-square&logo=verizon&logoColor=000000" align=right><a href="https://github.com/ELLIOTTCABLE/bs-sedlex/releases" align=right><img alt='Latest npm release' src="https://img.shields.io/npm/v/bs-sedlex.svg?style=popout-square&logo=npm&label=bs%20version" align=right></a><a target="_blank" href="https://travis-ci.com/ELLIOTTCABLE/bs-sedlex" align=right><img alt='Build status on Travis-CI' src="https://img.shields.io/travis/com/ELLIOTTCABLE/bs-sedlex.svg?style=popout-square&logo=travis&label=bs%20build" align=right></a><a target="_blank" href="https://twitter.com/intent/follow?screen_name=ELLIOTTCABLE" align=right><img alt='Follow my work on Twitter' src="https://img.shields.io/twitter/follow/ELLIOTTCABLE.svg?style=popout-square&logo=twitter&label=%40ELLIOTTCABLE&color=blue" align=right></a>
<code>bs-sedlex</code></h1>
> **For details on purpose, usage, and API of sedlex, [scroll down](#sedlex).** These sections added
> at the top is specific to ways that installation and usage of the `bs-sedlex` distribution
> **For details on purpose, usage, and API of sedlex, [scroll down](#sedlex).** These sections I've
> added at the top are specific to ways that installation and usage of the `bs-sedlex` distribution
> **differ** from using the upstream release.

@@ -14,4 +14,4 @@

syntax-extension](#lexer-specifications) component necessary to use sedlex in practice. These are
published to npm as the separate package [`ppx-sedlex`][ppx-sedlex], versioned in lockstep with the
parent `bs-sedlex` package. Instructions for *enabling* this extension in your BuckleScript
published to npm as the separate npm package, [`ppx-sedlex`][ppx-sedlex], versioned in lockstep with
the parent `bs-sedlex` package. Instructions for *enabling* this extension in your BuckleScript
configuration-file, `bsconfig.json`, are included below. Don't miss them!

@@ -31,24 +31,30 @@

1. If you're writing an app or a similar end-consumer project, install the peerDependencies of this
project via [npm][], including the BuckleScript compiler and the [`bs-uchar`][bs-uchar] shim.
See that package's README for details on selecting the appropriate versions of these
dependencies; but briefly, choose either `bs-platform` 4 or 5 ...
1. If you're writing an app or a similar end-consumer project, install BuckleScript compiler (a
peerDependency of this project) via [npm][].
```sh
$ npm install --save bs-platform@latest # 4.x.x || 5.x.x, corresponding to OCaml 4.02
$ npm install --save bs-uchar@latest # 0.x.x
$ npm install --save bs-platform
```
... or, the new `bs-platform` 6:
Worh repeating: *do not add this dependency to a library.* The final application-developer
should generally select the version of the BuckleScript compiler; you don't want users having
duplicated versions of the compiler in their `node_modules`. Instead, library developers should
add `bs-platform` to both `"peerDependencies"` (with a permissive version), and
`"devDependencies"` (with a restrictive version):
```sh
$ npm install --save bs-platform@next # >= 6.0.0, corresponding to OCaml 4.06
$ npm install --save bs-uchar@next # 1.x.x
$ npm install --save-dev bs-platform
```
(Worh repeating: *do not add these dependencies to a library.* See [a more thorough
discussion][uchar-notes] in the `bs-uchar` README; but basically, shims like `bs-uchar` should
only be installed in the final consumer project that's selecting the `bs-platform` version.)
```diff
"devDependencies": {
...
"bs-platform": "^5.0.0"
},
"peerDependencies": {
+ "bs-platform": "4.x || 5.x" // example. express the versions of BuckleScript you support here.
},
```
2. Add the ppx transformer into `"devDependencies"`:
2. Add the ppx transformer to your `"devDependencies"`:

@@ -65,4 +71,4 @@ ```sh

4. Manually add both the runtime package (`bs-sedlex`) and Uchar-shim (`bs-uchar`) to your
`bsconfig.json`'s `bs-dependencies` field:
4. Manually add it (the runtime package, `bs-sedlex`) to your `bsconfig.json`'s `bs-dependencies`
field:

@@ -72,3 +78,2 @@ ```diff

...
+ "bs-uchar",
+ "bs-sedlex"

@@ -96,8 +101,5 @@ ],

"npm, the package-manager for the JavaScript ecosystem"
[bs-uchar]: <https://github.com/ELLIOTTCABLE/bs-uchar#readme>
"A BuckleScript-ported shim for the core OCaml Uchar.t type"
[uchar-notes]: <https://github.com/ELLIOTTCABLE/bs-uchar#versioning--libraries>
"Detailed description of the issues involved in adding an ML shim to an intermediate libarary"
## Versioning of this package
Thanks to [SemVer not including a ‘generation’ number][semver-213], there's really no way I can

@@ -237,3 +239,3 @@ reasonably tie this project's version on npm to the upstream version of Sedlex as released by the

```ocaml
[%sedlex match lexbuf with
[%sedlex match lexbuf with
| R1 -> e1

@@ -240,0 +242,0 @@ ...

@@ -8,10 +8,11 @@ 'use strict';

var Curry = require("bs-platform/lib/js/curry.js");
var Uchar = require("bs-uchar/src/uchar.bs.js");
var $$Buffer = require("bs-platform/lib/js/buffer.js");
var Stream = require("bs-platform/lib/js/stream.js");
var Caml_obj = require("bs-platform/lib/js/caml_obj.js");
var UcharShim = require("bs-uchar/src/ucharShim.bs.js");
var Caml_array = require("bs-platform/lib/js/caml_array.js");
var Caml_bytes = require("bs-platform/lib/js/caml_bytes.js");
var Pervasives = require("bs-platform/lib/js/pervasives.js");
var Caml_option = require("bs-platform/lib/js/caml_option.js");
var Caml_string = require("bs-platform/lib/js/caml_string.js");
var Js_primitive = require("bs-platform/lib/js/js_primitive.js");
var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions.js");

@@ -25,3 +26,3 @@ var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions.js");

function gen_of_channel(chan) {
return (function () {
return (function (param) {
try {

@@ -32,3 +33,3 @@ return Pervasives.input_char(chan);

if (exn === Caml_builtin_exceptions.end_of_file) {
return undefined;
return ;
} else {

@@ -43,3 +44,3 @@ throw exn;

if (o !== undefined) {
return Curry._1(f, Js_primitive.valFromOption(o));
return Curry._1(f, Caml_option.valFromOption(o));
}

@@ -50,9 +51,9 @@

function gen_of_stream(stream) {
return (function () {
return (function (param) {
try {
return Js_primitive.some(Stream.next(stream));
return Caml_option.some(Stream.next(stream));
}
catch (exn){
if (exn === Stream.Failure) {
return undefined;
return ;
} else {

@@ -66,3 +67,3 @@ throw exn;

var empty_lexbuf = /* record */[
/* refill */(function (_, _$1, _$2) {
/* refill */(function (param, param$1, param$2) {
throw [

@@ -97,3 +98,3 @@ Caml_builtin_exceptions.assert_failure,

/* refill */f,
/* buf */Caml_array.caml_make_vect(512, Uchar.of_int(0)),
/* buf */Caml_array.caml_make_vect(512, UcharShim.Uchar.of_int(0)),
/* len */empty_lexbuf[/* len */2],

@@ -137,3 +138,3 @@ /* offset */empty_lexbuf[/* offset */3],

if (match !== undefined) {
Caml_array.caml_array_set(buf, pos + i | 0, Curry._1(f, Js_primitive.valFromOption(match)));
Caml_array.caml_array_set(buf, pos + i | 0, Curry._1(f, Caml_option.valFromOption(match)));
_i = i + 1 | 0;

@@ -165,3 +166,3 @@ continue ;

/* buf */$$Array.init(len, (function (i) {
return Uchar.of_int(Caml_array.caml_array_get(a, i));
return UcharShim.Uchar.of_int(Caml_array.caml_array_get(a, i));
})),

@@ -217,3 +218,3 @@ /* len */len,

var newlen = ((lexbuf[/* buf */1].length + 512 | 0) << 1);
var newbuf = Caml_array.caml_make_vect(newlen, Uchar.of_int(0));
var newbuf = Caml_array.caml_make_vect(newlen, UcharShim.Uchar.of_int(0));
$$Array.blit(lexbuf[/* buf */1], s, newbuf, 0, ls);

@@ -251,10 +252,10 @@ lexbuf[/* buf */1] = newbuf;

if (lexbuf[/* finished */15] && lexbuf[/* pos */4] === lexbuf[/* len */2]) {
return undefined;
return ;
} else {
var ret = Caml_array.caml_array_get(lexbuf[/* buf */1], lexbuf[/* pos */4]);
lexbuf[/* pos */4] = lexbuf[/* pos */4] + 1 | 0;
if (Caml_obj.caml_equal(ret, Uchar.of_int(10))) {
if (Caml_obj.caml_equal(ret, UcharShim.Uchar.of_int(10))) {
new_line(lexbuf);
}
return Js_primitive.some(ret);
return Caml_option.some(ret);
}

@@ -351,3 +352,3 @@ }

function with_tokenizer(lexer$prime, lexbuf) {
return (function () {
return (function (param) {
var token = Curry._1(lexer$prime, lexbuf);

@@ -364,4 +365,5 @@ var match = lexing_positions(lexbuf);

function from_gen$1(s) {
var partial_arg = UcharShim.Uchar.of_char;
return create((function (param, param$1, param$2) {
return fill_buf_from_gen(Uchar.of_char, s, param, param$1, param$2);
return fill_buf_from_gen(partial_arg, s, param, param$1, param$2);
}));

@@ -371,6 +373,3 @@ }

function from_stream$1(s) {
var s$1 = gen_of_stream(s);
return create((function (param, param$1, param$2) {
return fill_buf_from_gen(Uchar.of_char, s$1, param, param$1, param$2);
}));
return from_gen$1(gen_of_stream(s));
}

@@ -383,3 +382,3 @@

/* buf */$$Array.init(len, (function (i) {
return Uchar.of_char(Caml_string.get(s, i));
return UcharShim.Uchar.of_char(Caml_string.get(s, i));
})),

@@ -404,15 +403,12 @@ /* len */len,

function from_channel(ic) {
var s = gen_of_channel(ic);
return create((function (param, param$1, param$2) {
return fill_buf_from_gen(Uchar.of_char, s, param, param$1, param$2);
}));
return from_gen$1(gen_of_channel(ic));
}
function to_latin1(c) {
if (Uchar.is_char(c)) {
return Uchar.to_char(c);
if (UcharShim.Uchar.is_char(c)) {
return UcharShim.Uchar.to_char(c);
} else {
throw [
InvalidCodepoint,
Uchar.to_int(c)
UcharShim.Uchar.to_int(c)
];

@@ -427,3 +423,3 @@ }

function sub_lexeme$1(lexbuf, pos, len) {
var s = Caml_string.caml_create_string(len);
var s = Caml_bytes.caml_create_bytes(len);
for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){

@@ -463,11 +459,10 @@ s[i] = to_latin1(Caml_array.caml_array_get(lexbuf[/* buf */1], (lexbuf[/* start_pos */7] + pos | 0) + i | 0));

throw MalFormed;
} else {
var n2 = Caml_string.get(s, i + 1 | 0);
var n3 = Caml_string.get(s, i + 2 | 0);
var n4 = Caml_string.get(s, i + 3 | 0);
if ((n2 >>> 6) !== 2 || (n3 >>> 6) !== 2 || (n4 >>> 6) !== 2) {
throw MalFormed;
}
return ((c & 7) << 18) | ((n2 & 63) << 12) | ((n3 & 63) << 6) | n4 & 63;
}
var n2 = Caml_string.get(s, i + 1 | 0);
var n3 = Caml_string.get(s, i + 2 | 0);
var n4 = Caml_string.get(s, i + 3 | 0);
if ((n2 >>> 6) !== 2 || (n3 >>> 6) !== 2 || (n4 >>> 6) !== 2) {
throw MalFormed;
}
return ((c & 7) << 18) | ((n2 & 63) << 12) | ((n3 & 63) << 6) | n4 & 63;
} else if (c >= 224) {

@@ -491,5 +486,6 @@ var n2$1 = Caml_string.get(s, i + 1 | 0);

}
} else if (c >= 128) {
throw MalFormed;
} else {
if (c >= 128) {
throw MalFormed;
}
return c;

@@ -505,14 +501,13 @@ }

throw MalFormed;
} else {
return $great$great$eq(Gen.next(s), (function (c2) {
return $great$great$eq(Gen.next(s), (function (c3) {
return $great$great$eq(Gen.next(s), (function (c4) {
if ((c2 >>> 6) !== 2 || (c3 >>> 6) !== 2 || (c4 >>> 6) !== 2) {
throw MalFormed;
}
return Js_primitive.some(Uchar.of_int(((c & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | c4 & 63));
}));
}));
}));
}
return $great$great$eq(Gen.next(s), (function (c2) {
return $great$great$eq(Gen.next(s), (function (c3) {
return $great$great$eq(Gen.next(s), (function (c4) {
if ((c2 >>> 6) !== 2 || (c3 >>> 6) !== 2 || (c4 >>> 6) !== 2) {
throw MalFormed;
}
return Caml_option.some(UcharShim.Uchar.of_int(((c & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | c4 & 63));
}));
}));
}));
} else if (c >= 224) {

@@ -524,3 +519,3 @@ return $great$great$eq(Gen.next(s), (function (c2) {

}
return Js_primitive.some(Uchar.of_int(((c & 15) << 12) | ((c2 & 63) << 6) | c3 & 63));
return Caml_option.some(UcharShim.Uchar.of_int(((c & 15) << 12) | ((c2 & 63) << 6) | c3 & 63));
}));

@@ -533,9 +528,10 @@ }));

}
return Js_primitive.some(Uchar.of_int(((c & 31) << 6) | c2 & 63));
return Caml_option.some(UcharShim.Uchar.of_int(((c & 31) << 6) | c2 & 63));
}));
}
} else if (c >= 128) {
throw MalFormed;
} else {
return Js_primitive.some(Uchar.of_char(c));
if (c >= 128) {
throw MalFormed;
}
return Caml_option.some(UcharShim.Uchar.of_char(c));
}

@@ -619,3 +615,3 @@ }));

var partial_arg = gen_of_channel(ic);
return from_gen((function () {
return from_gen((function (param) {
return from_gen$2(partial_arg);

@@ -629,3 +625,3 @@ }));

return id;
}), (function () {
}), (function (param) {
return from_gen$2(s);

@@ -655,3 +651,3 @@ }), param, param$1, param$2);

if (len$2 > 0) {
store(b, Uchar.to_int(Caml_array.caml_array_get(a, apos$1)));
store(b, UcharShim.Uchar.to_int(Caml_array.caml_array_get(a, apos$1)));
_len = len$2 - 1 | 0;

@@ -702,3 +698,3 @@ _apos = apos$1 + 1 | 0;

var bo = /* record */[/* contents */opt_bo];
return (function () {
return (function (param) {
return $great$great$eq(Gen.next(s), (function (c1) {

@@ -725,3 +721,3 @@ return $great$great$eq(Gen.next(s), (function (c2) {

if (w1 < 55296 || 57343 < w1) {
return Js_primitive.some(Uchar.of_int(w1));
return Caml_option.some(UcharShim.Uchar.of_int(w1));
} else if (w1 <= 56319) {

@@ -734,3 +730,3 @@ return $great$great$eq(next_in_gen(bo$1, s$1), (function (w2) {

var lower10 = w2 & 1023;
return Js_primitive.some(Uchar.of_int((65536 + upper10 | 0) + lower10 | 0));
return Caml_option.some(UcharShim.Uchar.of_int((65536 + upper10 | 0) + lower10 | 0));
}));

@@ -750,3 +746,3 @@ } else {

var l = /* record */[/* contents */0];
Gen.iter((function () {
Gen.iter((function (param) {
l[0] = l[0] + 1 | 0;

@@ -772,3 +768,3 @@ return /* () */0;

var len = compute_len$1(opt_bo, s, pos, bytes);
var a = Caml_array.caml_make_vect(len, Uchar.of_int(0));
var a = Caml_array.caml_make_vect(len, UcharShim.Uchar.of_int(0));
blit_to_int$1(opt_bo, s, pos, a, 0, bytes);

@@ -803,3 +799,3 @@ return a;

return (function (param) {
return from_gen$4(partial_arg, param);
return from_gen(gen_from_char_gen(param, partial_arg));
});

@@ -809,3 +805,4 @@ }

function from_channel$2(ic, opt_bo) {
return from_gen$4(gen_of_channel(ic), opt_bo);
var s = gen_of_channel(ic);
return from_gen(gen_from_char_gen(opt_bo, s));
}

@@ -833,3 +830,3 @@

if (len$2 > 0) {
store$1(bo$1, b, Uchar.to_int(Caml_array.caml_array_get(a, apos$1)));
store$1(bo$1, b, UcharShim.Uchar.to_int(Caml_array.caml_array_get(a, apos$1)));
_len = len$2 - 1 | 0;

@@ -848,29 +845,29 @@ _apos = apos$1 + 1 | 0;

var Latin1 = [
from_gen$1,
from_stream$1,
from_channel,
from_string,
lexeme$1,
sub_lexeme$1,
lexeme_char$1
];
var Latin1 = {
from_gen: from_gen$1,
from_stream: from_stream$1,
from_channel: from_channel,
from_string: from_string,
lexeme: lexeme$1,
sub_lexeme: sub_lexeme$1,
lexeme_char: lexeme_char$1
};
var Utf8 = [
from_gen$3,
from_stream$2,
from_channel$1,
from_string$1,
lexeme$2,
sub_lexeme$2
];
var Utf8 = {
from_gen: from_gen$3,
from_stream: from_stream$2,
from_channel: from_channel$1,
from_string: from_string$1,
lexeme: lexeme$2,
sub_lexeme: sub_lexeme$2
};
var Utf16 = [
from_gen$4,
from_stream$3,
from_channel$2,
from_string$2,
lexeme$3,
sub_lexeme$3
];
var Utf16 = {
from_gen: from_gen$4,
from_stream: from_stream$3,
from_channel: from_channel$2,
from_string: from_string$2,
lexeme: lexeme$3,
sub_lexeme: sub_lexeme$3
};

@@ -877,0 +874,0 @@ exports.InvalidCodepoint = InvalidCodepoint;

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