@ikasoba000/daizu

0.3.0 • Public • Published

٩(๑òωó๑)۶

@ikasoba000/daizu

daizu is simple parser combinator library.

installation

pnpm i @ikasoba000/daizu

Hello, world!

import * as D from "@ikasoba000/daizu";

const parser = D.string("Hello, world!");

D.parse(parser, "Hello, world!"); // "Hello, world!"

const parser = D.regexp(/Hello, \w+!/);

D.parse(parser, "Hello, daizu!"); // "Hello, daizu!"

const parser = D.regexp(/Hello, (\w+)!/);

D.parse(parser, "Hello, daizu!"); // "daizu"

daizu/helper

import D from "@ikasoba000/daizu/helper";

D.string("a").many1(); // Matches aaaaaaaaaaaaaa...

const parser =
  D.choice(
    D.regexp(/[a-zA-Z]/).map(x => x.toLowerCase()),
    D.regexp(/\s*/).ignore()
  )
  .many0();

parser.parse("a b \n c    d e\n f") // "a", "b", "c", "d", "e", "f"

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.01latest
1.0.0-next.20next

Version History

VersionDownloads (Last 7 Days)Published
1.0.0-next.20
1.0.0-next.11
1.0.0-next0
0.3.01
0.2.00
0.1.70
0.1.60
0.1.50
0.1.40
0.1.30
0.1.20
0.1.10

Package Sidebar

Install

npm i @ikasoba000/daizu

Weekly Downloads

2

Version

0.3.0

License

MIT

Unpacked Size

12.2 kB

Total Files

21

Last publish

Collaborators

  • ikasoba000