Commit graph

123 commits

Author SHA1 Message Date
Futago-za Ryuu 699038c507 Link to doc for plugins 2018-03-23 03:20:14 +00:00
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.
2018-02-16 02:39:13 +00:00
Futago-za Ryuu 8e9be9afea Use CommentMap 2018-01-30 01:02:39 +00:00
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
2018-01-29 02:08:12 +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 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.
2018-01-19 08:55:04 +00:00
Mingun 3f8cf7cd58 Add coveralls.io support 2017-12-18 18:58:49 +05:00
Futago-za Ryuu d6142772f8 Switch dev to pegjs@dev [ci skip] 2017-12-18 03:52:23 +00:00
Futago-za Ryuu db70215c4a Added 'header' option (#491) 2017-12-18 00:54:47 +00:00
Futago-za Ryuu a33eb0b45c Updated contribution section 2017-11-29 18:53:12 +00:00
felix 6a9a9a5d23 Add more explanation of balanced braces (#533) 2017-09-15 21:40:14 +01:00
felix 369b8cdcc6 Clarify details for the execution environment for actions (#531)
* Clarify execution environment of actions and predicates
* Makes a new section for describing the common execution environment
* Add the new section to TOC
* Clarify start/end for predicates
* Clarify the scope of labels
2017-09-14 22:56:39 +01:00
felix 958e15879d Reimplement offset() and add range(). (#528)
* Reimplement offset()
* Implement range()

Fixes #526, thanks @felix9
2017-09-04 05:48:17 +01:00
Futago-za Ryuu 0ed8c6f89a Rewrote command line tool
- Split into 3 files: "peg.js", "options.js" and "usage.txt"
- Rewrote arguments parser and helpers to be more precise
- Any arguments after "--" will be passed to "options['--']" now
- Added negation options: "--no-cache" and "--no-trace"
- Added "bare" to accepted module formats
- Added 2 aliases for "--extra-options-file": "-c" and "--config"
- Added short options: "-a", "-f" and "-p"
- Reformatted help text in "usage.txt"
- Updated documentation related to command line options and normal options
- Changed "bin" field in "package.json" from "bin/pegjs" to "bin/peg"
- Added documentation note about command line options that are repeated
- Updated gulpfile.js, replacing "bin/pegjs" with "bin/*.js"

See #429, which was what I intended to fix/solve, but instead pushed back and did this instead.
2017-08-24 03:29:02 +01:00
Futago-za Ryuu 48a0c37997 Fix link for dot character [ci skip] 2017-08-23 09:20:05 +01:00
Futago-za Ryuu 6661f6b958 Updated documentation
- Updated Badges
- Moved the introduction back to the top
- Added a title for the TOC list
- Added "Latest" sub-section (closes #521)
- Added "Case-insensitivity" sub-section (see #518)
- Added "Backtracking" sub-section (closes #438)
- Fixed link for . (dot character)
- Added a title for the links in the development section
- Added "Contribution" sub-section (closses #457)
- Updated the TOC list
2017-08-20 12:44:08 +01:00
Futago-za Ryuu 928fdca6ac Added TOC's [skip ci] 2017-06-12 08:21:53 +01:00
Futago-za Ryuu 8856913ae8 Updated maintainer #503 2017-06-12 07:40:38 +01:00
Futago-za Ryuu 5e3ed79f95 Merge pull request #415 from sampsyo/master
Docs: try to explain error messages
2017-06-12 05:23:13 +01:00
fatfisz d1f62596f1 Add info about the "es" target to the README 2017-06-11 18:49:40 +02:00
Adhir Ramjiawan f861c2f476 spelling error 2017-03-08 08:56:56 +02:00
David Majda 9f36131637 Use https: in links to majda.cz
This avoids redirects.
2016-12-08 10:45:07 +01:00
David Majda f982e1cfd1 README.md: Indicate that IE8 is unsupported
Should have been done as part of #441.
2016-12-08 10:26:30 +01:00
David Majda 266f17d11c Adapt to using HTTPS on PEG.js website
PEG.js website is now served exclusively using HTTPS. Change protocol in
all links to it to avoid redirects.
2016-12-04 11:24:33 +01:00
David Majda 400a3cfa3c Avoid aligning object keys
The only exception left are objects representing a mapping with simple
keys and values -- essentially tables written as object literals.

See #443.
2016-09-22 07:55:30 +02:00
David Majda 16f38f6380 Drop Node 0.10.x & 0.12.x support
See #442.
2016-09-07 11:26:52 +02:00
David Majda 8003edafc9 Rename the "node" module format to "commonjs"
Parsers generated in this format use module.exports, so they are not
strictly CommonJS, but this is a common extension and the original name
would be confusing once Node.js implements ES2015 modules.
2016-08-06 18:05:03 +02:00
David Majda 8962dcfd16 Rename the "global" module format to "globals"
I think the new name is more widely used when describing the pattern.
2016-08-06 17:59:32 +02:00
David Majda 2a8544d86c README.md: Remove io.js from the list of compatible environments 2016-08-05 11:39:02 +02:00
David Majda 75cd17ed58 bin/pegjs: Implement the --format option 2016-07-14 16:18:57 +02:00
David Majda db9920e3ca peg.generate: Implement { format: "global" } 2016-07-14 16:18:50 +02:00
David Majda 61c11ee1b4 peg.generate: Implement { format: "amd" } 2016-07-14 16:18:43 +02:00
David Majda f633f697c9 peg.generate: Implement { format: "node" } 2016-07-14 16:18:32 +02:00
David Majda e8be76ee3a Don't expose the "parser" variable in parser code
The "parser" variable allowed access to the parser object. Among other
things, this made it possible to invoke the parser recursively using
"parser.parse".

One problem with the "parser" variable is that it bakes in the idea that
the parser is an *object*, not a *module*. While this is true now, it
won't necessarily be in the future, when parsers may be exported as ES6
modules. Also, people tend to use parsers as modules even today, e.g.
like this:

  var parse = require("parser").parse;
  var result = parse(...);

Such usage broke the "parser" variable (as it was implemented).

For this reasons I decided to remove the "parser" variable. If someone
needs to do tricks like recursive invocation of the parser, he/she must
pass the parser or the "parse" function itself using options.

Related to #433.
2016-07-04 08:35:39 +02:00
David Majda c0e2bd218c README.md: Describe the --optimize command-line option 2016-06-22 09:47:24 +02:00
David Majda da1395e21e README.md: Describe the --dependency command-line option 2016-06-22 09:47:24 +02:00
David Majda 6bf19ae6f8 README.md: Order command-line options alphabetically 2016-06-22 09:47:24 +02:00
David Majda 01aa32615b README.md: Describe the "trace" peg.generate option 2016-06-22 09:47:14 +02:00
David Majda f41535224d README.md: Order peg.generate options alphabetically 2016-06-22 09:35:50 +02:00
David Majda a57431955e bin/pegjs: Use the -o/--output option to specify the output file
This is more traditional compiler interface. Its main advantage against
specifying the output file as a second argument (which is what bin/pegjs
used until now) is that input and output files can't be mixed up.

Part of #370.
2016-06-21 16:51:01 +02:00
David Majda 6b60896216 Revert "Remove info about found string from syntax errors"
This reverts commit 25ab98027d.

Part of work on #428.
2016-06-10 15:18:25 +02:00
David Majda 138405d89d Add syntax highlighting to code blocks in README.md files 2016-05-05 10:21:20 +02:00
David Majda 45de51a881 Consistently talk about generating (not building) a parser 2016-05-04 14:08:43 +02:00
David Majda f4504a93fe Rename the "buildParser" function to "generate"
In most places, we talk about "generating a parser", not "building a
parser", which the function name should reflect. Also, mentioning a
parser in the name is not necessary as in case of a parser generator
it's pretty clear what is generated.
2016-05-04 14:01:14 +02:00
David Majda 0847a69643 Rename the "PEG" variable to "peg"
So far, PEG.js was exported in a "PEG" global variable when no module
loader was detected. The same variable name was also conventionally used
when requiring it in Node.js or otherwise referring to it. This was
reflected in various places in the code, documentation, examples, etc.

This commit changes the variable name to "peg" and fixes all relevant
occurrences. The main reason for the change is that in Node.js, modules
are generally referred to by lower-case variable names, so "PEG" was
sticking out when used in Node.js projects.
2016-05-04 12:37:13 +02:00
David Majda 810567d865 UMD parsers: Allow specifying parser dependencies
Introduce two ways of specifying parser dependencies: the "dependencies"
option of PEG.buildParser and the -d/--dependency CLI option. Specified
dependencies are translated into AMD dependencies and Node.js's
"require" calls when generating an UMD parser.

Part of work on #362.
2016-05-03 11:50:01 +02:00
David Majda a0a57cd22d UMD parsers: Make bin/pegjs generate UMD parsers
Part of work on #362.
2016-05-03 10:44:31 +02:00
David Majda b87268ade6 UMD parsers: Allow generating parsers in UMD format from the API
Introduce new "format" and "exportVar" options to PEG.buildParser which
together allow generating parsers in UMD format.

Part of work on #362.
2016-05-03 10:44:20 +02:00
David Majda a89aa11779 README.md: Mention that AMD loader will be used in the browser 2016-04-28 10:08:55 +02:00
David Majda ce44c62f14 Support passing custom location info to "error" and "expected"
Based on a pull request by Konstantin (@YemSalat):

  https://github.com/pegjs/pegjs/pull/391

Resolves #390.
2016-04-27 14:11:32 +02:00