Neurotoxin Powered Marketing

    fuse-box-nearley-plugin
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    fuse-box-nearley-plugin

    A plugin for fuse-box that lets you import Nearley *.ne files as a grammar for use in a Nearley parser

    Usage

    yarn add fuse-box-nearley-plugin

    Add to your fuse-box plugins list.

    const { NearleyPlugin } = require("fuse-box-nearley-plugin");
     
    fuse = FuseBox.init({
        plugins: [
            NearleyPlugin()
        ]
    });

    Import your grammar into your project, compile, and parse.

    // Import the grammar
    const grammar = require("calculator.ne");
     
    // Compile
    const compiled = Grammar.fromCompiled(grammar);
    const parser = new Parser(compiled);
     
    // Use the grammar
    parser.feed("1 + 1 * 2");
    console.log(parser.results[0]); // 3

    Install

    npm i fuse-box-nearley-plugin

    DownloadsWeekly Downloads

    1

    Version

    1.1.0

    License

    ISC

    Unpacked Size

    82.4 kB

    Total Files

    8

    Last publish

    Collaborators

    • ldom66