open-index/open-npm huggingface dataset:
npm package: @loquat/char
Description: Character parsers
Author: Susisu
Latest version: 3.2.0

# `@loquat/char`
Character parsers.

## Installation
``` shell
npm i @loquat/char
# or
yarn add @loquat/char
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework).

## Options
If `sugar: true` is specified, the method extensions of `Parser` is enabled.

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/combinators
Description: Useful combinators
Author: Susisu
Latest version: 3.2.0

# `@loquat/combinators`
Useful combinators.

## Installation
``` shell
npm i @loquat/combinators
# or
yarn add @loquat/combinators
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework).

## Options
If `sugar: true` is specified, the method extensions of `Parser` is enabled.

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/core
Description: The core of loquat
Author: Susisu
Latest version: 3.2.0

# `@loquat/core`
The core of loquat.

## Installation
``` shell
npm i @loquat/core
# or
yarn add @loquat/core
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework).

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/expr
Description: Expression parser builder
Author: Susisu
Latest version: 3.2.0

# `@loquat/expr`
Expression parser builder.

## Installation
``` shell
npm i @loquat/expr
# or
yarn add @loquat/expr
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework) and [an example](https://github.com/susisu/loquat/tree/master/packages/simple/examples/calc.js).

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/framework
Description: Loquat framework
Author: Susisu
Latest version: 3.2.0

# `@loquat/framework`
Loquat framework.

## Installation
``` shell
npm i @loquat/core @loquat/framework
# or
yarn add @loquat/core @loquat/framework
```

## Usage
First, create a new instance of loquat.

``` javascript
const lq = require("@loquat/framework")(require("@loquat/core"));
```

The core features will be accessible via `lq`, like `lq.parse`.

To use an extension, first install it

``` shell
npm i @loquat/prim
# or
yarn add @loquat/prim
```

and `use` it.

``` javascript
lq.use(require("@loquat/prim"), { options: { sugar: true } });

const p = lq.pure(42);
```

## API
### `lq.use(ext, opts)`
Use an extension.

An extension is a function that takes the core instance and options.

``` javascript
module.exports = (core, opts) => {
  // ...
  return {
    // foo: "bar", ...
  };
};
```

All the values returned from the extension will be assigned to `lq` by default.

#### Options
If `name` is specified, the extension will also be accessible via `lq.exts[name]`.

If `qualified: true` is specified, the extension will not be assigned to `lq`.

If `options` is provided, it will be passed to the extension as an argument.

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/monad
Description: Monadic functions
Author: Susisu
Latest version: 3.2.0

# `@loquat/monad`
Monadic functions.

## Installation
``` shell
npm i @loquat/monad
# or
yarn add @loquat/monad
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework).

## Options
If `sugar: true` is specified, the method extensions of `Parser` is enabled.

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/prim
Description: Primitive parsers and combinators
Author: Susisu
Latest version: 3.2.0

# `@loquat/prim`
Primitive parsers and combinators.

## Installation
``` shell
npm i @loquat/prim
# or
yarn add @loquat/prim
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework).

## Options
If `sugar: true` is specified, the method extensions of `Parser` is enabled.

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/qo
Description: Sweet syntax powered by generators
Author: Susisu
Latest version: 3.2.0

# `@loquat/qo`
Sweet syntax powered by generators.

## Installation
``` shell
npm i @loquat/qo
# or
yarn add @loquat/qo
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework).

## Usage
When writing parsers, `.bind` chains sometimes introduce a kind of *Callback Hell*. But fortunately, you can avoid it using generators to keep your code readable and maintainable!

For example, the following code

``` javascript
const parser =
  parserA.bind(x =>
    parserB.bind(y =>
      perserC.bind(z =>
        pure(foo(x, y, z))
      )
    )
  );
```

can be rewritten as

``` javascript
const parser = qo(function* () {
  const x = yield parserA;
  const y = yield parserB;
  const z = yield parserC;
  return foo(x, y, z);
});
```

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/simple
Description: A simple interface of loquat
Author: Susisu
Latest version: 3.2.0

# `@loquat/simple`
A simple interface of loquat, provided as a single package.

## Installation
``` shell
npm i @loquat/simple
# or
yarn add @loquat/simple
```

## Examples
* [json.js](https://github.com/susisu/loquat/blob/master/packages/simple/examples/json.js): A JSON parser
* [json_generators.js](https://github.com/susisu/loquat/blob/master/packages/simple/examples/json_generators.js): A JSON parser using do-notation with generators
* [calc.js](https://github.com/susisu/loquat/blob/master/packages/simple/examples/calc.js): A simple calculator, an example of expression parser builder
* [s_expr.js](https://github.com/susisu/loquat/blob/master/packages/simple/examples/s_expr.js): An S-expression parser

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/testutil
Description: Test utilities
Author: Susisu
Latest version: 3.2.0

# `@loquat/testutil`
Test utilities.

## Installation
``` shell
npm i -D @loquat/core @loquat/testutil
# or
yarn add -D @loquat/core @loquat/testutil
```

## Usage
First, you need to instantiate `testutil`.
``` javascript
const core = require("@loquat/core")();
const testutil = require("@loquat/testutil")(core);
```

### Chai plugin
``` javascript
chai.use(testutil.plugin);
```

The following language chains are available:

- `.equalPositionTo(pos)`
- `.equalErrorMessageTo(msg)`
- `.equalErrorMessagesTo(msgs)`
- `.equalErrorTo(err)`
- `.equalConfigTo(config)`
- `.equalStateTo(state)`
- `.equalResultTo(res)`
- `.be.a.parser`


### Test helpers
`testutil.helpers` contains test helper functions.

- `createDummyParser`: Create a parser that always fails without consumption

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
npm package: @loquat/token
Description: Token parser builder
Author: Susisu
Latest version: 3.2.0

# `@loquat/token`
Token parser builder.

## Installation
``` shell
npm i @loquat/token
# or
yarn add @loquat/token
```

See also [`@loquat/framework`](https://github.com/susisu/loquat/tree/master/packages/framework).

## Usage
First, create a language definition.

``` javascript
const def = LanguageDef.create({
    commentStart  : "/*",
    commentEnd    : "*/",
    commentLine   : "//",
    nestedComments: false,
    idStart       : letter,
    idLetter      : alphaNum,
    opStart       : oneOf("+-*/%=<>!&|"),
    opLetter      : oneOf("+-*/%=<>!&|"),
    reservedIds   : ["if", "else", "for"],
    reservedOps   : ["=", "=>"],
    caseSensitive : true
});
```

Then build token parsers from it.

``` javascript
const tp = makeTokenParser(def);
```

The returned `tp` is an object containing the following token parsers:

- `whiteSpace`
- `lexeme(parser)`
- `symbol(str)`
- `parens(parser)`
- `braces(parser)`
- `angles(parser)`
- `brackets(parser)`
- `semi`
- `comma`
- `colon`
- `dot`
- `semiSep(parser)`
- `semiSep1(parser)`
- `commaSep(parser)`
- `commaSep1(parser)`
- `decimal`
- `hexadecimal`
- `octal`
- `natural`
- `integer`
- `float`
- `naturalOrFloat`
- `charLiteral`
- `stringLiteral`
- `identifier`
- `reserved(name)`
- `operator`
- `reservedOp(name)`

## License
```
Copyright 2019 Susisu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```