1186 Commits (46c3dcf40b99a8fb94f4d59ebda263dc6d7cdf0b)
 

Author SHA1 Message Date
Futago-za Ryuu 46c3dcf40b Document Session#fatal method 6 years ago
Futago-za Ryuu f4ca7ca461 Remove grammar option for Session API 6 years ago
Futago-za Ryuu 6d25da2d2b Use bare option with browserify 6 years ago
Futago-za Ryuu 126a4c95f4 Update devDependencies
Closes #568
6 years ago
Futago-za Ryuu 2f0680ca16 Restore orignal output on generation fail
If the output file already exists, and the parser generator fails, the result is a empty file. This commit tries  to avoid this pitfall.
6 years ago
Futago-za Ryuu 21a6de06d5 Optional features
This commit enables optional features that are enabled by default in the generated parser.

For now, only some of the helpers and filename are generated based on this new option, but this will change in the future most likely.

Resolves #421
6 years ago
Futago-za Ryuu 15d364587c Update tsd to include changes since 8e9be9a 6 years ago
Futago-za Ryuu 2ac387e1c9 Move documentation
The README.md file in the root of the repository had become too large, and as a result the file became hard to maintain.

This commit extracts all the documentation and moves it to separate but managable files within the docs directory, a new folder also located in the root of the repository.
6 years ago
Futago-za Ryuu 418f441d88 Ignore '.idea' directory 6 years ago
Futago-za Ryuu fedf0f3480 Resolve 'vm.runInContext' bottleneck
Calling 'vm.runInContext'  is slightly more expensive then calling `eval`, but removing the string template and extracting the variable generator helps abit.
6 years ago
Futago-za Ryuu 43a305eaef Clarify templates
- what to chose and do
- remove checkboxs
- all question in comments
- reformat style
6 years ago
Futago-za Ryuu b3135690b0 Not session.fail but session.fatal 6 years ago
Futago-za Ryuu 30cfa29553 Provide context to parser (#517) 6 years ago
Futago-za Ryuu 04dfef3b63 Use error emitter (Closes #430) 6 years ago
Futago-za Ryuu ef0595596f Implement error emitter (Closes #431)
Along with commit 851d8ed, this resolves #431 based on the fact that plugins can overwrite session methods, allowing use cases like multiple or limited errors (and/or warnings) to be an opt-in feature.
6 years ago
Futago-za Ryuu a11d217167 Updated devDependencies 6 years ago
Futago-za Ryuu 621b11b715 Disable no-unused-vars in Session API 6 years ago
Futago-za Ryuu 6500189d58 Report unused rules (Closes #200) 6 years ago
Futago-za Ryuu 851d8edfdd Implement warning emitter (Closes #327) 6 years ago
Futago-za Ryuu f4c67993f6 Added the Session API 6 years ago
Futago-za Ryuu 8e9be9afea Use CommentMap 6 years ago
Futago-za Ryuu 11bc94f4c3 Updated docs for JavaScript API [ci skip]
This includes detials about the 3 main methods a developer will use along with their respective options.

Closes #553
6 years ago
Futago-za Ryuu a5d7cc11a4 ECMA, not ESMA 6 years ago
Futago-za Ryuu fe6f09238a Relay parser opts from peg.generate (#553) 6 years ago
Futago-za Ryuu 8d711627c1 Remove usless refrences to peg 6 years ago
Futago-za Ryuu 269b36b9db Remove redundant glob for linting 6 years ago
Futago-za Ryuu a79757683f Should be 'test/impact master' 6 years ago
Futago-za Ryuu 5476eca59f Moved AST and visitor classes 6 years ago
Futago-za Ryuu f41ef82ce9 Update tsd to include latest changes
These changes are mainly from from @Minigun and @futagoza
6 years ago
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()'
6 years ago
Futago-za Ryuu b0a5db1ab9 Expose ast classes used by parser 6 years ago
Futago-za Ryuu 9ecb21b749 stripLocation > stripProperties 6 years ago
Futago-za Ryuu 9d266625b4 Merge ast utils into Grammar class 6 years ago
Mingun 1a713d0175 Add some useful debug information to some exceptions (#475)
* Add some useful debug information to some exceptions

* Add guard for visitor functions preventing from cryptic errors due to incomplete visitors

* Add guard for js generator for preventing from cryptic errors due to incarrect stack manipulations
6 years ago
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()
}
```
6 years ago
Futago-za Ryuu b6bc0d905e Use .js files with -c option on CLI
This commit adds support for '.js' files to be passed to the '-c', '--config'  or '--extra-options-file' options on the CLI, allowing the developer to do some extra work before the parser is generated (if they wish), or dynamically set options based on the enviroment.
6 years ago
Futago-za Ryuu d06a5b52ef Restore silentFails guard for rule$expects 6 years ago
Futago-za Ryuu 75a4101622 Some cosmetic changes
- Remove unused '__slice' variable
- Nicely indent a map/concat chain
- 'forEach' instead of 'map' in emitted code
6 years ago
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
6 years ago
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
6 years ago
Futago-za Ryuu 617b6b7425 Updated utils and tsd
- Exposed 'visitor.ASTVisitor'
- Remoed 'util.createVisitor'
- Added type 'peg.SourceLocation'
- Updated tsd for 'peg.compiler.visitor'
- Added tsd for 'peg.util.enforceFastProperties'
- Added tsd for new parser modules
6 years ago
Futago-za Ryuu 27ec5ed9b1 Ensure we are nearly always in fast mode on V8
See: https://stackoverflow.com/a/24989927/1518408
6 years ago
Futago-za Ryuu 7a19d46e8a Add the ASTVisitor class (#451)
For compatibility with pre-0.11 plugins, this class lives on the same namespace as the orignal visitor helper and also exports a static method called 'build'.
6 years ago
Futago-za Ryuu 93cc6c5b26 Parser calls AST node creator now
Before this commit, the PEG.js parser always created the AST using a plain JavaSctript object, but allthough simple and effective for the job, this method sacrificies performance slightly.

From now on the parser shall call a Node creator. This should help with performance, as well as in the future move some AST helpers into the new AST functions.
6 years ago
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.
6 years ago
Futago-za Ryuu 02486cef7f ignore sh.exe stack trace file 6 years ago
Futago-za Ryuu 1b2072f239 Fix edgecase in gulpfile.js
There seem's to be an edgecase where a spawned process (in this case node.exe it self) is opened and gulp straight away thinks it closed. At first I thought it was a problem with Gulp, but after fiddleing it seem's to be a Window's problem, so I just updated the `node()` spawner to work on all platforms by using Gulp's callback to create an async task. Problem solved :)
6 years ago
Futago-za Ryuu b0056d7a9f Merge branch 'master' of github.com:pegjs/pegjs 6 years ago
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".
6 years ago
Futago-za Ryuu 1434346332 Move require statement to the top 6 years ago