Commit graph

136 commits

Author SHA1 Message Date
David Majda 203243b884 README.md: Add link to the Trello board 2012-11-23 22:25:28 +01:00
David Majda 05a6bad989 Kill the |toSource| method, introduce the |output| option
Before this commit, |PEG.buildParser| always returned a parser object.
The only way to get its source code was to call the |toSource| method on
it. While this method worked for parsers produced by |PEG.buildParser|
directly, it didn't work for parsers instantiated by executing their
source code. In other words, it was unreliable.

This commit remvoes the |toSource| method on generated parsers and
introduces a new |output| option to |PEG.buildParser|. It allows callers
to specify whether they want to get back the parser object
(|options.output === "parser"|) or its source code (|options.output ===
"source"|). This is much better and more reliable API.
2012-11-11 18:18:52 +01:00
David Majda e5e9ce2778 README.md: Wrap lines at column 80 2012-10-28 15:26:12 +01:00
David Majda 208cc33930 Allowed start rules must be specified explicitly
Before this commit, generated parser were able to start parsing from any
rule. This was nice, but it made rule code inlining impossible.

Since this commit, the list of allowed start rules has to be specified
explicitly using the |allowedStartRules| option of the |PEG.buildParser|
method (or the --allowed-start-rule option on the command-line). These
rules will be excluded from inlining when it's implemented.
2012-10-22 19:49:01 +02:00
David Majda e97c501072 README.md: Add wiki link 2012-09-24 20:29:48 +02:00
David Majda edb547958e README.md: Fix project website link 2012-09-23 16:06:11 +02:00
David Majda 98ff2eb83f Allow passing options to the parser
This commit replaces the |startRule| parameter of the |parse| method in
generated parsers with more generic |options| -- an options object. This
options object can be used to pass custom options to the parser because
it is visible as the |options| variable inside parser code.

The start rule can now be specified as the |startRule| option. This
means you have to replace all calls like:

  parser.parse("input", "myStartRule");

with

  parser.parse("input", { startRule: "myStartRule" });

Closes GH-37.
2012-09-19 08:32:21 +02:00
David Majda b05b09a9f6 README.md: Remove extraneous "and"
Based on patch for pegjs-website by Michael Ficarra:

  https://github.com/dmajda/pegjs-website/pull/3
2012-06-16 15:13:00 +02:00
David Majda 4f6386ea2a README.md: Fix typo
Based on patch for pegjs-website by Michael Ficarra:

  https://github.com/dmajda/pegjs-website/pull/2
2012-06-16 15:13:00 +02:00
David Majda 5bd2ca1cb5 README.md: Fix |PEG.buildParser| option name 2012-04-18 11:15:16 +02:00
David Majda 11f3dc9744 README.md: Document options and variables visible in actions/predicates 2012-04-17 11:55:01 +02:00
David Majda b7e41b0985 README.md: Various tweaks 2012-04-17 11:03:49 +02:00
David Majda a2af1fe612 Semantic predicates now have access to preceding labels
Part of a fix for GH-69.
2012-02-27 20:18:21 +01:00
David Majda 9d96e1e303 README.md: Update compatibility information 2012-02-13 08:40:12 +01:00
David Majda 46b2eaf3e3 Add |expected| and |found| properties to exceptions thrown by parsers
Based on a patch by Marcin Stefaniuk (marcin@stefaniuk.info).
2012-02-12 12:28:59 +01:00
David Majda 21c6d9ccd3 Add |offset| property to exceptions thrown by parsers
Based on a patch by Marcin Stefaniuk (marcin@stefaniuk.info).
2012-02-12 12:28:53 +01:00
David Majda c04af99df8 Implament case-insensitive class matching 2011-09-30 11:45:36 +02:00
David Majda b540b2d460 Implement case-insensitive literal matching 2011-09-30 11:20:37 +02:00
David Majda 950cc80738 Few small README.md fixes 2011-09-29 17:02:02 +02:00
David Majda ffbe60094a Rewrite README.md 2011-04-12 20:33:51 +02:00
David Majda f3845726f2 Rakefile -> Jakefile
Or, swapped Ruby dependency for a Node dependency.

The build script was also modified to always regenerate the parser (in
case of the "parser" task) or rebuild the library (in case of the
"build" task) even if the source files were not modified. Not doing this
led to problems when the generating code changed but the files didn't
(which happened often during development).
2011-01-24 13:51:50 +01:00
David Majda 814ce7d9db Switch command-line mode backend from Rhino to Node 2011-01-24 10:57:00 +01:00
David Majda a12a24fca1 Make parsers generated by /bin/pegjs CommonJS modules by default 2010-09-28 16:44:04 +02:00
David Majda e59f3ba338 Split the source code into several files, introduce build system
The source code is now in the src directory. The library needs to be
built using "rake", which creates the lib/peg.js file by combining the
source files.
2010-08-15 19:45:51 +02:00
David Majda b30f4a9c34 README.md tweaks 2010-06-10 09:43:08 +02:00
David Majda 08ea5e49d6 README.md: Fix example code 2010-06-09 09:44:33 +02:00
David Majda a616b00c83 Improve README.md 2010-06-09 09:40:22 +02:00
David Majda a93ad0a5b8 README.md: Make the "Compatibility" section a bulleted list 2010-06-08 15:06:21 +02:00
David Majda 7214de6dc8 README.md: Removed unnecessary "id" attribute from the example. 2010-04-17 11:54:47 +02:00
David Majda db4cc71f2c README.md: Fixed formatting. 2010-04-17 11:52:36 +02:00
David Majda 7822379c70 Rewrote the "Usage" section. 2010-04-17 11:49:18 +02:00
David Majda c9a5e283e7 README.md: Renamed the "Requirements" section to "Compatibility" and moved it at the end. 2010-04-17 11:17:37 +02:00
David Majda 3752fe211a README.md: Added the "Features" section. 2010-04-17 11:15:49 +02:00
David Majda b4bf906cf8 Modified README.md to indicate that IE6+ is supported. 2010-04-16 20:28:24 +02:00
David Majda e63f64a3d5 Make the generated parsers standalone (no runtime is required).
This and also speeds up the benchmark suite execution by 7.83 % on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   26.17 kB/s   28.16 kB/s
      2   26.05 kB/s   28.16 kB/s
      3   25.99 kB/s   28.10 kB/s
      4   26.13 kB/s   28.11 kB/s
      5   26.14 kB/s   28.07 kB/s
---------------------------------
Average   26.10 kB/s   28.14 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2
2010-04-12 19:06:04 +02:00
David Majda 9488291ac0 Converted README to GitHub Flavored Markdown.
Also added ".txt" extension to VERSION and LICENSE for more consistency.
2010-04-09 18:29:43 +02:00