Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Compiles a grammar from a nearley grammar file.

NotificationsYou must be signed in to change notification settings

LeetCode-OpenSource/nearley-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package is a standardwebpack loaderwhich allows you to loadnearleyparser specification files as parser rules directly from webpack.

This branch contains support for the latest nearley version, currentlynearley@^2.0.0. Fornearlet@^1.0.0 check thenearley1 branch in thisrepo.

Installation

You need to install bothnearley andnearley-loader, sincenearley is apeer dependency of this package. The major version of thenearley-loaderpackage must match the installed version ofnearley, so if you installnearley@2.13.0, then you need to installnearley-loader@^2.0.0.

Usage

Just configure webpack to handle nearley files with this loader:

module:{rules:[{test:/\.nearley$/,use:['nearley-loader',],},]}

If using withcreate-react-app or any other pre-configured webpack, be surethat the.ne extension (or whatever file extension you use above) is notaffected by another loader. For instance,create-react-app will apply aurl-loader to any file extension it doesn't recognize.

Once you've done that, you can now require nearley files in your javascriptmodules and you'll get the compiled parser rules:

import{Parser,Grammar}from'nearley';importgrammarfrom'./grammar.ne';constparser=newParser(Grammar.fromCompiled(grammar));

License

MIT License

Copyright (c) 2016 Kozily

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

About

Compiles a grammar from a nearley grammar file.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript76.6%
  • Dockerfile23.4%

[8]ページ先頭

©2009-2025 Movatter.jp