Move PEG.js to packages/pegjs

* Move PEG.js from . to packages/pegjs
* Update relevanr paths
* Remove pegjs-dev; Use pegjs directly
* Generate browser files at packages/pegjs/dist
* nyc: exclude website
* website: keep packages folder
* Root package.json is private now
master
Futago-za Ryuu 6 years ago
parent 35a650dc50
commit be88239543

@ -1,5 +1,5 @@
/.nyc_output
/browser
/packages/pegjs/dist
/coverage
/node_modules
/website

2
.gitattributes vendored

@ -1,2 +1,2 @@
* text=auto
bin/*.js text eol=lf
packages/pegjs/bin/*.js text eol=lf

2
.gitignore vendored

@ -1,5 +1,5 @@
/.idea
/browser
/packages/pegjs/dist
/examples/*.js
/node_modules
/coverage

@ -1,6 +1,7 @@
{
"exclude": [
"test",
"website",
"gulpfile.js",
"**/.eslintrc.js"
],

@ -37,8 +37,7 @@ task( "lint", () => pump(
src( [
"**/.*rc.js",
"bin/*.js",
"lib/**/*.js",
"packages/**/*.js",
"test/benchmark/**/*.js",
"test/benchmark/run",
"test/impact",
@ -71,7 +70,7 @@ task( "benchmark", cb => {
// Generate the grammar parser.
task( "build:parser", cb => {
node( "bin/peg src/parser.pegjs -o lib/parser.js -c src/pegjs.config.js", cb );
node( "packages/pegjs/bin/peg src/parser.pegjs -o packages/pegjs/lib/parser.js -c src/pegjs.config.js", cb );
} );
@ -104,12 +103,12 @@ task( "build:browser", () => {
return pump(
browserify( "lib/peg.js", options )
browserify( "packages/pegjs/lib/peg.js", options )
.transform( babelify )
.bundle(),
stream( "peg.js" ),
header( HEADER ),
dest( "browser" ),
dest( "packages/pegjs/dist" ),
rename( options ),
buffer(),
uglify(),

2
lib/peg.d.ts vendored

@ -1,2 +0,0 @@
import api from "./typings/api"
export = api;

@ -8,7 +8,7 @@
],
"files": [
"examples",
"lib",
"packages",
"test",
"website",
".babelrc",

@ -1,30 +1,9 @@
{
"name": "pegjs",
"version": "0.11.0-dev",
"description": "Parser generator for JavaScript",
"keywords": [
"PEG.js",
"pegjs",
"grammar",
"parser",
"generator",
"language",
"PEG"
"name": "pegjs-dev",
"private": true,
"workspaces": [
"packages/*"
],
"homepage": "https://pegjs.org/",
"repository": "pegjs/pegjs",
"license": "MIT",
"contributors": [
"David Majda <david@majda.cz> (https://majda.cz/)",
"Futago-za Ryuu <futagoza.ryuu@gmail.com>"
],
"files": [
"bin",
"lib"
],
"types": "lib/typings/pegjs.d.ts",
"main": "lib/peg.js",
"bin": "bin/peg.js",
"scripts": {
"lint": "gulp lint",
"spec": "gulp test",

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2010-2016 David Majda
Copyright (c) 2017+ Futago-za Ryuu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, 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 THE
SOFTWARE.

@ -0,0 +1,35 @@
[![ci](https://img.shields.io/travis/pegjs/pegjs.svg)](https://travis-ci.org/pegjs/pegjs)
[![coverage](https://img.shields.io/coveralls/github/pegjs/pegjs.svg)](https://coveralls.io/github/pegjs/pegjs)
[![license](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT)
PEG.js is a simple parser generator for JavaScript that produces fast parsers with excellent error reporting. You can use it to process complex data or computer languages and build transformers, interpreters, compilers and other tools easily.
> PEG.js is still very much work in progress. There are no compatibility guarantees until version 1.0
## features
* Simple and expressive grammar syntax
* Integrates both lexical and syntactical analysis
* Parsers have excellent error reporting out of the box
* Based on [parsing expression grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) formalism - more powerful than traditional LL(*k*) and LR(*k*) parsers
* Usable [from your browser](https://pegjs.org/online), from the command line, or via JavaScript API
## documentation
- [Getting Started](https://github.com/pegjs/pegjs/blob/master/docs/guides/getting-started.md)
- [Installation](https://github.com/pegjs/pegjs/blob/master/docs/guides/installation.md)
- [Generating a Parser](https://github.com/pegjs/pegjs/blob/master/docs/guides/generating-a-parser.md)
- [Using the Parser](https://github.com/pegjs/pegjs/blob/master/docs/guides/using-the-parser.md)
- [Grammar Syntax and Semantics](https://github.com/pegjs/pegjs/tree/master/docs/grammar)
- [JavaScript API](https://github.com/pegjs/pegjs/blob/master/docs/guides/javascript-api.md)
- [Plugins](https://github.com/pegjs/pegjs/blob/master/docs/guides/plugins.md)
- [Compatibility](https://github.com/pegjs/pegjs/blob/master/docs/notes/compatibility.md)
- [Development](https://github.com/pegjs/pegjs/blob/master/docs/notes/development.md)
- [Useful Links](https://github.com/pegjs/pegjs/blob/master/docs/notes/useful-links.md)
## license
Released under the [MIT License](https://opensource.org/licenses/MIT).
Copyright (c) 2010-2016 [David Majda](https://majda.cz/)<br>
Copyright (c) 2017+ [Futago-za Ryuu](https://github.com/futagoza)

@ -0,0 +1,27 @@
{
"name": "pegjs",
"version": "0.11.0-dev",
"description": "Parser generator for JavaScript",
"keywords": [
"PEG.js",
"pegjs",
"grammar",
"parser",
"generator",
"language",
"PEG"
],
"homepage": "https://pegjs.org/",
"repository": "pegjs/pegjs",
"license": "MIT",
"contributors": [
"David Majda <david@majda.cz> (https://majda.cz/)",
"Futago-za Ryuu <futagoza.ryuu@gmail.com>"
],
"types": "typings/pegjs.d.ts",
"main": "lib/peg.js",
"bin": "bin/peg.js",
"engines": {
"node": ">= 6"
}
}

@ -6,8 +6,6 @@ This directory contains various test suites and scripts to ensure PEG.js works c
* [Benchmark Suite](benchmark): It measures speed of the parsers generated by PEG.js on various inputs. Its main goal is to provide data for code generator optimizations.
* [Impact Script](impact): Measures impact of a Git commit (or multiple commits) on generated parsers speed and size.
> Note: The package `pegjs-dev`, used by the benchmark and spec modules within this directory, points to '[test/node_modules/pegjs-dev.js](node_modules/pegjs-dev.js)', which is an alias module for '[lib/peg.js](../lib/peg.js)'
## Download and Install
To run the PEG.js test suites you most download the and install the module via the git repository:

@ -1,6 +1,6 @@
"use strict";
const peg = require( "pegjs-dev" );
const peg = require( "pegjs" );
const Runner = {
run( benchmarks, runCount, options, callbacks ) {

@ -1,7 +1,7 @@
"use strict";
const chai = require( "chai" );
const peg = require( "pegjs-dev" );
const peg = require( "pegjs" );
const sinon = require( "sinon" );
const expect = chai.expect;

@ -1,7 +1,7 @@
"use strict";
const chai = require( "chai" );
const peg = require( "pegjs-dev" );
const peg = require( "pegjs" );
const sinon = require( "sinon" );
const expect = chai.expect;

@ -1,7 +1,7 @@
"use strict";
const chai = require( "chai" );
const util = require( "pegjs-dev" ).util;
const util = require( "pegjs" ).util;
const expect = chai.expect;

@ -1,7 +1,7 @@
"use strict";
const chai = require( "chai" );
const peg = require( "pegjs-dev" );
const peg = require( "pegjs" );
const expect = chai.expect;

@ -1,7 +1,7 @@
"use strict";
const chai = require( "chai" );
const peg = require( "pegjs-dev" );
const peg = require( "pegjs" );
const sinon = require( "sinon" );
const expect = chai.expect;

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.generate.generateBytecode;
const pass = require( "pegjs" ).compiler.passes.generate.generateBytecode;
chai.use( helpers );

@ -1,7 +1,7 @@
"use strict";
const LikeHelper = require( "chai-like" );
const Session = require( "pegjs-dev" ).compiler.Session;
const Session = require( "pegjs" ).compiler.Session;
module.exports = function ( chai, utils ) {

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.generate.inferenceMatchResult;
const pass = require( "pegjs" ).compiler.passes.generate.inferenceMatchResult;
chai.use( helpers );

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.transform.removeProxyRules;
const pass = require( "pegjs" ).compiler.passes.transform.removeProxyRules;
chai.use( helpers );

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.check.reportDuplicateLabels;
const pass = require( "pegjs" ).compiler.passes.check.reportDuplicateLabels;
chai.use( helpers );

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.check.reportDuplicateRules;
const pass = require( "pegjs" ).compiler.passes.check.reportDuplicateRules;
chai.use( helpers );

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.check.reportInfiniteRecursion;
const pass = require( "pegjs" ).compiler.passes.check.reportInfiniteRecursion;
chai.use( helpers );

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.check.reportInfiniteRepetition;
const pass = require( "pegjs" ).compiler.passes.check.reportInfiniteRepetition;
chai.use( helpers );

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.check.reportUndefinedRules;
const pass = require( "pegjs" ).compiler.passes.check.reportUndefinedRules;
chai.use( helpers );

@ -2,7 +2,7 @@
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.check.reportUnusedRules;
const pass = require( "pegjs" ).compiler.passes.check.reportUnusedRules;
chai.use( helpers );

@ -1,9 +1,11 @@
"use strict";
const chai = require( "chai" );
const parser = require( "pegjs-dev" ).parser;
const util = require( "pegjs-dev" ).util;
const visitor = require( "pegjs-dev" ).ast.visitor;
const {
parser,
util,
ast,
} = require( "pegjs" );
const expect = chai.expect;
@ -194,7 +196,7 @@ describe( "PEG.js grammar parser", function () {
}
strip = visitor.build( {
strip = ast.visitor.build( {
grammar( node ) {
delete node.location;

Loading…
Cancel
Save