0.2.4 • Published 4 years ago

cursornext v0.2.4

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Why cursor|next?

While such frameworks like nearley, ohm and peg are powerful already and provide out-of-the-box features for generating and testing parser. These frameworks rely heavily upon LL and LR algorithms and grammars.

cursornext takes another approach, it provides the lowest lever interface to interact with the document and let you decide how to parse your own syntax. The downside is that you have to put more efforts building your own parser. Because you are not rely on any built-in algorithm and grammar, it may lacks of tools for checking and generating syntax tree. The upside is that building a parser tool is now more modular and customizable. The interface is also simple that it is much more friendlier to work with Chrome or Node debugger.

Install

cursornext is available to install via npm:

npm install --save cursornext

and Yarn:

yarn add cursornext

Create your first cursor

To create a new cursor, you can use Cursor.from() method:

const { Cursor } = require('cursornext')

const cursor = Cursor.from('Hello, World!')

Now you can move and test the cursor using next() and startsWith().

cursor.next(7)
cursor.startsWith('World')
// => true

Documentation

For more documentation, please checkout the docs directory:

License

MIT License

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.0.1

5 years ago