137 Commits (7d13580855b9d488297cca61a83d1c56a7b71345)

Author SHA1 Message Date
David Majda da8c455640 Position tracking: Make |offset|, |line| and |column| functions
This will allow to compute position data lazily and get rid of the
|trackLineAndColumn| option without affecting performance of generated
parsers that don't use position data.
12 years ago
David Majda 203243b884 README.md: Add link to the Trello board 12 years ago
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.
12 years ago
David Majda e5e9ce2778 README.md: Wrap lines at column 80 12 years ago
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.
12 years ago
David Majda e97c501072 README.md: Add wiki link 12 years ago
David Majda edb547958e README.md: Fix project website link 12 years ago
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.
12 years ago
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
12 years ago
David Majda 4f6386ea2a README.md: Fix typo
Based on patch for pegjs-website by Michael Ficarra:

  https://github.com/dmajda/pegjs-website/pull/2
12 years ago
David Majda 5bd2ca1cb5 README.md: Fix |PEG.buildParser| option name 12 years ago
David Majda 11f3dc9744 README.md: Document options and variables visible in actions/predicates 12 years ago
David Majda b7e41b0985 README.md: Various tweaks 12 years ago
David Majda a2af1fe612 Semantic predicates now have access to preceding labels
Part of a fix for GH-69.
12 years ago
David Majda 9d96e1e303 README.md: Update compatibility information 12 years ago
David Majda 46b2eaf3e3 Add |expected| and |found| properties to exceptions thrown by parsers
Based on a patch by Marcin Stefaniuk (marcin@stefaniuk.info).
12 years ago
David Majda 21c6d9ccd3 Add |offset| property to exceptions thrown by parsers
Based on a patch by Marcin Stefaniuk (marcin@stefaniuk.info).
12 years ago
David Majda c04af99df8 Implament case-insensitive class matching 13 years ago
David Majda b540b2d460 Implement case-insensitive literal matching 13 years ago
David Majda 950cc80738 Few small README.md fixes 13 years ago
David Majda ffbe60094a Rewrite README.md 13 years ago
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).
13 years ago
David Majda 814ce7d9db Switch command-line mode backend from Rhino to Node 13 years ago
David Majda a12a24fca1 Make parsers generated by /bin/pegjs CommonJS modules by default 14 years ago
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.
14 years ago
David Majda b30f4a9c34 README.md tweaks 14 years ago
David Majda 08ea5e49d6 README.md: Fix example code 14 years ago
David Majda a616b00c83 Improve README.md 14 years ago
David Majda a93ad0a5b8 README.md: Make the "Compatibility" section a bulleted list 14 years ago
David Majda 7214de6dc8 README.md: Removed unnecessary "id" attribute from the example. 14 years ago
David Majda db4cc71f2c README.md: Fixed formatting. 14 years ago
David Majda 7822379c70 Rewrote the "Usage" section. 14 years ago
David Majda c9a5e283e7 README.md: Renamed the "Requirements" section to "Compatibility" and moved it at the end. 14 years ago
David Majda 3752fe211a README.md: Added the "Features" section. 14 years ago
David Majda b4bf906cf8 Modified README.md to indicate that IE6+ is supported. 14 years ago
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
14 years ago
David Majda 9488291ac0 Converted README to GitHub Flavored Markdown.
Also added ".txt" extension to VERSION and LICENSE for more consistency.
14 years ago