Browse Source

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 3 years ago
parent
commit
be88239543
  1. 2
      .eslintignore
  2. 2
      .gitattributes
  3. 2
      .gitignore
  4. 1
      .nycrc
  5. 9
      gulpfile.js
  6. 2
      lib/peg.d.ts
  7. 2
      now.json
  8. 29
      package.json
  9. 22
      packages/pegjs/LICENSE
  10. 35
      packages/pegjs/README.md
  11. 0
      packages/pegjs/bin/options.js
  12. 0
      packages/pegjs/bin/peg.js
  13. 0
      packages/pegjs/bin/usage.js
  14. 0
      packages/pegjs/lib/ast/Grammar.js
  15. 0
      packages/pegjs/lib/ast/Node.js
  16. 0
      packages/pegjs/lib/ast/index.js
  17. 0
      packages/pegjs/lib/ast/visitor.js
  18. 0
      packages/pegjs/lib/compiler/index.js
  19. 0
      packages/pegjs/lib/compiler/opcodes.js
  20. 0
      packages/pegjs/lib/compiler/passes/calc-report-failures.js
  21. 0
      packages/pegjs/lib/compiler/passes/generate-bytecode.js
  22. 0
      packages/pegjs/lib/compiler/passes/generate-js.js
  23. 0
      packages/pegjs/lib/compiler/passes/inference-match-result.js
  24. 0
      packages/pegjs/lib/compiler/passes/remove-proxy-rules.js
  25. 0
      packages/pegjs/lib/compiler/passes/report-duplicate-labels.js
  26. 0
      packages/pegjs/lib/compiler/passes/report-duplicate-rules.js
  27. 0
      packages/pegjs/lib/compiler/passes/report-infinite-recursion.js
  28. 0
      packages/pegjs/lib/compiler/passes/report-infinite-repetition.js
  29. 0
      packages/pegjs/lib/compiler/passes/report-undefined-rules.js
  30. 0
      packages/pegjs/lib/compiler/passes/report-unused-rules.js
  31. 0
      packages/pegjs/lib/compiler/session.js
  32. 0
      packages/pegjs/lib/grammar-error.js
  33. 0
      packages/pegjs/lib/parser.js
  34. 0
      packages/pegjs/lib/peg.js
  35. 0
      packages/pegjs/lib/util/index.js
  36. 0
      packages/pegjs/lib/util/js.js
  37. 0
      packages/pegjs/lib/util/objects.js
  38. 0
      packages/pegjs/lib/util/vm.js
  39. 27
      packages/pegjs/package.json
  40. 0
      packages/pegjs/typings/api.d.ts
  41. 0
      packages/pegjs/typings/generated-parser.d.ts
  42. 0
      packages/pegjs/typings/modules.d.ts
  43. 0
      packages/pegjs/typings/pegjs.d.ts
  44. 2
      test/README.md
  45. 2
      test/benchmark/runner.js
  46. 2
      test/spec/api/generated-parser-api.spec.js
  47. 2
      test/spec/api/pegjs-api.spec.js
  48. 2
      test/spec/api/pegjs-util.spec.js
  49. 2
      test/spec/api/plugin-api.spec.js
  50. 2
      test/spec/behavior/generated-parser-behavior.spec.js
  51. 2
      test/spec/unit/compiler/passes/generate-bytecode.spec.js
  52. 2
      test/spec/unit/compiler/passes/helpers.js
  53. 2
      test/spec/unit/compiler/passes/inference-match-result.spec.js
  54. 2
      test/spec/unit/compiler/passes/remove-proxy-rules.spec.js
  55. 2
      test/spec/unit/compiler/passes/report-duplicate-labels.spec.js
  56. 2
      test/spec/unit/compiler/passes/report-duplicate-rules.spec.js
  57. 2
      test/spec/unit/compiler/passes/report-infinite-recursion.spec.js
  58. 2
      test/spec/unit/compiler/passes/report-infinite-repetition.spec.js
  59. 2
      test/spec/unit/compiler/passes/report-undefined-rules.spec.js
  60. 2
      test/spec/unit/compiler/passes/report-unused-rules.spec.js
  61. 10
      test/spec/unit/parser.spec.js

2
.eslintignore

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

2
.gitattributes

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

2
.gitignore

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

1
.nycrc

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

9
gulpfile.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

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

2
now.json

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

29
package.json

@ -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",

22
packages/pegjs/LICENSE

@ -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.

35
packages/pegjs/README.md

@ -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
bin/options.js → packages/pegjs/bin/options.js

0
bin/peg.js → packages/pegjs/bin/peg.js

0
bin/usage.js → packages/pegjs/bin/usage.js

0
lib/ast/Grammar.js → packages/pegjs/lib/ast/Grammar.js

0
lib/ast/Node.js → packages/pegjs/lib/ast/Node.js

0
lib/ast/index.js → packages/pegjs/lib/ast/index.js

0
lib/ast/visitor.js → packages/pegjs/lib/ast/visitor.js

0
lib/compiler/index.js → packages/pegjs/lib/compiler/index.js

0
lib/compiler/opcodes.js → packages/pegjs/lib/compiler/opcodes.js

0
lib/compiler/passes/calc-report-failures.js → packages/pegjs/lib/compiler/passes/calc-report-failures.js

0
lib/compiler/passes/generate-bytecode.js → packages/pegjs/lib/compiler/passes/generate-bytecode.js

0
lib/compiler/passes/generate-js.js → packages/pegjs/lib/compiler/passes/generate-js.js

0
lib/compiler/passes/inference-match-result.js → packages/pegjs/lib/compiler/passes/inference-match-result.js

0
lib/compiler/passes/remove-proxy-rules.js → packages/pegjs/lib/compiler/passes/remove-proxy-rules.js

0
lib/compiler/passes/report-duplicate-labels.js → packages/pegjs/lib/compiler/passes/report-duplicate-labels.js

0
lib/compiler/passes/report-duplicate-rules.js → packages/pegjs/lib/compiler/passes/report-duplicate-rules.js

0
lib/compiler/passes/report-infinite-recursion.js → packages/pegjs/lib/compiler/passes/report-infinite-recursion.js

0
lib/compiler/passes/report-infinite-repetition.js → packages/pegjs/lib/compiler/passes/report-infinite-repetition.js

0
lib/compiler/passes/report-undefined-rules.js → packages/pegjs/lib/compiler/passes/report-undefined-rules.js

0
lib/compiler/passes/report-unused-rules.js → packages/pegjs/lib/compiler/passes/report-unused-rules.js

0
lib/compiler/session.js → packages/pegjs/lib/compiler/session.js

0
lib/grammar-error.js → packages/pegjs/lib/grammar-error.js

0
lib/parser.js → packages/pegjs/lib/parser.js

0
lib/peg.js → packages/pegjs/lib/peg.js

0
lib/util/index.js → packages/pegjs/lib/util/index.js

0
lib/util/js.js → packages/pegjs/lib/util/js.js

0
lib/util/objects.js → packages/pegjs/lib/util/objects.js

0
lib/util/vm.js → packages/pegjs/lib/util/vm.js

27
packages/pegjs/package.json

@ -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"
}
}

0
lib/typings/api.d.ts → packages/pegjs/typings/api.d.ts

0
lib/typings/generated-parser.d.ts → packages/pegjs/typings/generated-parser.d.ts

0
lib/typings/modules.d.ts → packages/pegjs/typings/modules.d.ts

0
lib/typings/pegjs.d.ts → packages/pegjs/typings/pegjs.d.ts

2
test/README.md

@ -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:

2
test/benchmark/runner.js

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

2
test/spec/api/generated-parser-api.spec.js

@ -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
test/spec/api/pegjs-api.spec.js

@ -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
test/spec/api/pegjs-util.spec.js

@ -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;

2
test/spec/api/plugin-api.spec.js

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

2
test/spec/behavior/generated-parser-behavior.spec.js

@ -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
test/spec/unit/compiler/passes/generate-bytecode.spec.js

@ -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 );

2
test/spec/unit/compiler/passes/helpers.js

@ -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
test/spec/unit/compiler/passes/inference-match-result.spec.js

@ -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
test/spec/unit/compiler/passes/remove-proxy-rules.spec.js

@ -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
test/spec/unit/compiler/passes/report-duplicate-labels.spec.js

@ -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
test/spec/unit/compiler/passes/report-duplicate-rules.spec.js

@ -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
test/spec/unit/compiler/passes/report-infinite-recursion.spec.js

@ -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
test/spec/unit/compiler/passes/report-infinite-repetition.spec.js

@ -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
test/spec/unit/compiler/passes/report-undefined-rules.spec.js

@ -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
test/spec/unit/compiler/passes/report-unused-rules.spec.js

@ -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 );

10
test/spec/unit/parser.spec.js

@ -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