A lightweight s-expression parser for JavaScript.
benthepoet / fast-sexpr Goto Github PK
View Code? Open in Web Editor NEWA lightweight s-expression parser for JavaScript.
License: MIT License
A lightweight s-expression parser for JavaScript.
License: MIT License
This line
Line 12 in db4974f
will push the cursor forward in the sexpr's text. However, due to integer size limitations, the number will no longer be able to increase when the integer cap is hit (in my computer, that number is 1048576
), which means the condition if (data.index === data.sexpr.length) return null;
is never hit, and therefore the parser gets stuck in an infinite loop for really large inputs.
Solution: I was able to get through this with just a small change
var data = {
- index: 0,
+ index: BigInt(0),
sexpr: sexpr
}
As far as compatibility goes, according to what I read in https://www.npmjs.com/package/big-integer, BigInt is natively supported in recent versions of Node. I am able to confirm this because I'm using Node 13.5 and didn't have to install anything extra.
I wanted to ask if you think this change is warranted and/or needed, or if I should look into other packages from other languages for my use-case (speed matters).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.