Commit graph

251 commits

Author SHA1 Message Date
Futago-za Ryuu ed6690e5bb Use mocha/mocha.js 2019-02-14 11:05:27 +00:00
Futago-za Ryuu 6525825f2e Use mocha-loader 2019-02-13 06:43:48 +00:00
Futago-za Ryuu 7a78b7cfdf Upgrade dependencies 2019-02-07 05:40:01 +00:00
Futago-za Ryuu 9906f21c57 Update output for mocha-junit-reporter 2019-01-25 05:57:49 +00:00
Futago-za Ryuu 2dc0a1b64a Upgrade dependencies 2019-01-01 12:51:59 +00:00
Futago-za Ryuu bdde25a9e4
Set up CI with Azure Pipelines (#596)
* Add support for Azure Pipelines
* Remove Travis CI support
* coverage: Generate cobertura and lcov reports only
* Add support for Code Climate
2019-01-01 12:26:41 +00:00
Futago-za Ryuu 9751980261 Remove unrequired ESLint rules 2018-11-05 12:06:23 +00:00
Futago-za Ryuu 93ceeff597 General QOL changes
- Added 'test/package.json' for dependencies used by spec tests
- Changed package names of local tools to reflect actual usage
- Removed bins for local tools (using files via 'node [file]' command)
- Updated help text for the CLIs of local tools to reflect changes
- Updated READMEs for tools
- Moved babel dependencies to 'tools/bundle/package.json'
- 'tools/bundle' now only logs created and watching
- Updated scripts in root package.json
2018-11-04 10:01:56 +00:00
Futago-za Ryuu 390478d61e Move test/spec to test 2018-11-02 17:51:26 +00:00
Futago-za Ryuu 163ff20508 Move test/benchmark to tools/benchmark 2018-11-02 17:03:30 +00:00
Futago-za Ryuu 9c039ce79b Move test/impact to tools/impact 2018-11-02 15:15:25 +00:00
Futago-za Ryuu 14b8b76a79 runInContext -> evalModule 2018-09-25 19:15:16 +01:00
Futago-za Ryuu e64118f3b7 Update src/parser.pegjs
- use value plucking
- remove helpers not needed now
- types in OPS_* are now returned by *Operator
- RESERVED_WORDS is now a `Object<Identifier,true>`
- use ES2015+ JavaScript
- cleanup source code
2018-09-18 06:57:55 +01:00
Futago-za Ryuu 460f0cc5bc Implement value plucking
Resolves #235, #427, #545
2018-09-17 11:32:34 +01:00
Futago-za Ryuu dd044b8cfb remove extronous files 2018-09-11 11:01:42 +01:00
Futago-za Ryuu dd76ff85d4 Update execution files 2018-09-11 10:32:23 +01:00
Futago-za Ryuu be88239543 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
2018-09-08 02:39:12 +01:00
Futago-za Ryuu 5e7134936b Merge the test suites into the website 2018-09-06 12:38:26 +01:00
Futago-za Ryuu 60f69d6558 Stop ESLint warnings
- about use of eval
- whitespace before comments
2018-09-05 08:54:35 +01:00
Futago-za Ryuu b31009f73d Use peg.util.reservedWords 2018-04-03 03:16:55 +01:00
Futago-za Ryuu 30cfa29553 Provide context to parser (#517) 2018-02-02 06:42:03 +00:00
Futago-za Ryuu 6500189d58 Report unused rules (Closes #200) 2018-01-31 02:17:27 +00:00
Futago-za Ryuu 851d8edfdd Implement warning emitter (Closes #327) 2018-01-31 02:04:19 +00:00
Futago-za Ryuu f4c67993f6 Added the Session API 2018-01-30 02:38:49 +00:00
Futago-za Ryuu 5476eca59f Moved AST and visitor classes 2018-01-28 02:00:28 +00:00
Futago-za Ryuu 4b6ceb2b46 Fix plugin test that replaces parser
This test broke down aftert I intergrated the AST utils directly into the Grammar class, then I had problems importing the PEG.js parser to use the Grammar class, but found a workaround using 'process.cwd()'
2018-01-26 09:33:13 +00:00
Futago-za Ryuu 9ecb21b749 stripLocation > stripProperties 2018-01-26 08:17:53 +00:00
Mingun 0dab14d652 Add ability to extract comments from the grammar (#511)
All comments stored in the `comments` property of the `grammar` node.
Comments extracted only if the `extractComments` options set to `true` when you generate parser.
This property is object with mapping start offset of comment to comment object, that looks like:

```js
{
  text: 'text in the comment, just after // or /* and before */',
  multiline: true|false,// true for /**/ comments, false for // comments
  location: location()
}
```
2018-01-24 18:10:45 +00:00
Futago-za Ryuu f5b323b401 Report consistent errors on look ahead + cached results
This should resolve issue #452, and is based entirely on a fix @nikku did on a local branch of PEG.js v0.10.0 (Currently at https://github.com/nikku/pegjs/tree/452-peg-js-0.10-fix).

Also his test case from #555 is included.

Fixes #452, Closes #555
2018-01-18 01:24:34 +00:00
Mingun 9b90fa1d81 Move all codegeneration from generateBytecode pass to generateJs pass (#459)
* Split 'consts' collection by content types into:

  - literals: for literal expressions, like `"a"`
  - classes: for character class expressions, like `[a]`
  - expectations: for constants describing expected values when parse failed
  - functions: for constants with function code

* Move any JavaScript code generation from 'generateBytecode' to 'generateJs'.
* Rename opcode 'MATCH_REGEXP' to 'MATCH_CLASS' (name reflects purpose, not implementation).
* Replace 'PUSH' opcode with 'PUSH_EMPTY_STRING' opcode because it is only used with empty strings
2018-01-17 16:57:49 +00:00
Futago-za Ryuu 7cdfc03e9f Added utility methods for objects
Before there used to be some internal utility methods for arrays and objects, but as the code base moved to ES5+ use  case only, these were removed in favour of native alternatives, but most of these were only beneficial for arrays.

This commit add's common utility methods for objects, and also exposes these as they can be used by plugin developer's on the PEG.js AST.
2018-01-14 20:44:53 +00:00
Futago-za Ryuu b0056d7a9f Merge branch 'master' of github.com:pegjs/pegjs 2018-01-07 15:32:28 +00:00
Mingun 4cc9185a78 Improve error when reserved word used as label (#552)
Before this commit error looks like (for input `start = break:'a'`)

> Expected "!", "$", "&", "(", "*", "+", ".", "/", "/*", "//", ";", "?", character class, code block, comment, end of line, identifier, literal, or whitespace but ":" found.

After this error looks like

> Label can't be a reserved word "break".
2018-01-07 14:51:06 +00:00
Futago-za Ryuu 1434346332 Move require statement to the top 2018-01-07 02:12:05 +00:00
Mingun fde1c480f4 Use chai-like instead of own properties matcher (#550) 2018-01-06 23:29:24 +00:00
Mingun 534dc53ac2 Optimize redundant fail checks (#400)
eliminate unnecessary checks for the result of parse, when it can be statically determined
2018-01-05 21:28:09 +00:00
Futago-za Ryuu 92f1798308 Moved Babel options to .babelrc 2018-01-02 02:08:50 +00:00
Mingun 42ec335d13 Optimize silent fails: remove checks that always false (#399)
* Optimization: do not generate unreachable calls |peg$fail| and constants for it (local to the rule).
* Optimization: do not generate unreachable calls |peg$fail| and constants for it (non-local to rule).
2018-01-01 19:35:59 +00:00
Mingun a7a0a0d9ac Bump devDependencies (#549)
- Removed: babel-preset-es2015@6.24.1
- Added: babel-preset-env@1.6.1
- Updated: gulp-mocha@5.0.0
- Updated: nyc@11.4.1
- Updated: vinyl-buffer@1.0.1
- Updated: vinyl-source-stream@2.0.0
2017-12-31 22:01:29 +00:00
Mingun 669f782a5f Partial fix #194 - nonsenses error messages with semantic predicates (#547)
* Remove stack manipulations from FAIL opcode and rename FAIL to EXPECT
* Always save the expected values regardless of the match result of expression
* Remove unnecessary check for match result in the `named` node
* Collect and process expectations from predicates
2017-12-31 10:59:51 +00:00
Futago-za Ryuu 1b20aa5427 Ensure usage of 'lib/peg.d.ts'
This commit ensures that all modules outside 'lib' are importing 'lib/peg.js' so that VS Code automatically gets 'lib/peg.d.ts'.

An alias module for 'lib/peg.js' called 'pegjs-dev' was made for test files at 'test/node_modules/pegjs-dev.js'
2017-12-28 01:48:01 +00:00
Mingun 3e89534bb7 Auto-add allowedStartRules to test options for changeAST and reportError methods if it not defined 2017-12-19 01:38:26 +05:00
Futago-za Ryuu 881eb67545 Removed redundant css files
The css files used in the benchmark contained 2 files for IE that contained syntax errors. These files weren't actually used by the benchmark, but were still in the repository.
2017-11-29 20:52:07 +00:00
Futago-za Ryuu 5f0001c3e5 Fix compatibility for older bins 2017-10-25 23:08:53 +01:00
Futago-za Ryuu e6d018a88d Update code format and style
This is related to my last commit. I've updated all the JavaScript files to satisfy 'eslint-config-futagozaryuu', my eslint configuration.

I'm sure I've probally missed something, but I've run all NPM scripts and Gulp tasks, fixed any bugs that cropped up, and updated some stuff (mainly related to generated messages), so as far as I can, tell this conversion is over (I know I've probally jixed it just by saying this ;P).
2017-10-25 19:19:42 +01:00
Futago-za Ryuu 3c6523ff83 Switched eslint configuration
Was using 'eslint-config-dmajda' by @dmajda, but since it's diffucult for me to use multiple styles across multiple projects, I'm switching to my own 'eslint-config-futagozaryuu'.
2017-10-25 02:24:11 +01:00
Futago-za Ryuu 9802bae15f test/impact: Add compatibility for older bin files
This ensures the impact test doesn't throw when testing against older commits that contain the bin files at their orignal locations.
2017-10-24 15:26:31 +01:00
Futago-za Ryuu abadaf4d5d Add test for empty grammars
This add's a test that ensures grammars without any rules are not accepted.
2017-10-20 19:01:19 +01:00
Futago-za Ryuu 96a386ff15 Merged documents for test suites 2017-10-15 02:36:10 +01:00
Futago-za Ryuu 5c36738a52 Rewrote test/impact as a Node.js script
"test/impact" was a bash script before, and used tools spefic to some systems, which required Window users to have more software installed.

This rewrite removes the bash script and add's a cross platform Node.js script that doesn't depend on platform-spefic tools.
2017-10-06 07:49:52 +01:00