diff --git a/docs/api-reference.md b/docs/api-reference.md index 8059726..2455e0e 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -60,7 +60,7 @@ An `Outcome` represents a `Success` or a `Failure` (for those coming from a func A `ParseResult` is an object of shape `{ value, ctx }` that holds the resulting value along with the new `Context`. ```js -import { Outcome } from 'parser-lang/outcome'; +import { Outcome } from 'parser-lang'; let p = new Parser(ctx => { return Outcome.of({ @@ -566,7 +566,7 @@ Return the original outcome after applying `f` to the value for its effects. ### Context ```js -import Context from 'parser-lang/context`; +import { Context } from 'parser-lang`; ``` The **context** protocol defines a standard way for mutable iterable objects to be used in an "immutable" way by allowing consumers to make clones before performing mutations. diff --git a/docs/tutorial.md b/docs/tutorial.md index 25a91a8..0a5ae06 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -105,7 +105,7 @@ sequence(char('a'), char('b')) One downside of defining parser combinators using JavaScript functions and methods is that it can become difficult to read as the parsers grow in complexity. The way ParserLang approaches handling this problem is by allowing you to define your parsers using a declarative language in template literals: ```js -import lang from 'parser-lang/lang'; +import { lang } from 'parser-lang'; let { a } = lang` a = 'a'; diff --git a/main.js b/main.js index d6b7f68..bfaf830 100644 --- a/main.js +++ b/main.js @@ -1,2 +1,5 @@ export { default } from './src/parser'; export * from './src/parser'; +export { default as Context } from './src/context'; +export { default as lang } from './src/lang'; +export * from './src/outcome'; diff --git a/package-lock.json b/package-lock.json index 87b5991..e0d0e75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "parser-combinators", - "version": "1.0.0", + "name": "parser-lang", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 937a84d..83373fb 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { - "name": "parser-combinators", - "version": "1.0.0", - "private": true, - "description": "", + "name": "parser-lang", + "version": "0.1.0", + "description": "A parser combinator library for JavaScript with declarative definition power", "main": "index.js", "module": "main.js", + "keywords": ["parsing", "parse", "parser combinators", "template literals"], "scripts": { "lint": "prettier --check src/*.js", "test": "ava" }, - "author": "", - "license": "ISC", + "author": "Tim Disney", + "license": "MIT", "dependencies": { "ava": "^2.1.0", "esm": "^3.2.20" diff --git a/readme.md b/readme.md index d94e074..f390250 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ ParserLang is parser combinator library. It lets you make parsers by combining o Its primary superpower is the ability to define parsers declaratively with template literals: ```js -import lang from 'parser-lang/lang'; +import { lang } from 'parser-lang'; let { calc } = lang` num = /[0-9]+/ > ${ch => parseInt(ch, 10)};