360 Commits (6091e4426bb8c35b738302b6ce4d2627aec6d04f)
 

Author SHA1 Message Date
David Majda 6091e4426b Update version to 0.7.0 13 years ago
David Majda 4e04acafa3 Update CHANGELOG 13 years ago
David Majda ef06621a2b Remove extra comma in compiler tests 13 years ago
David Majda 7faf40dc44 Do not use results cache in the PEG.js grammar parser 13 years ago
David Majda 11f3dc9744 README.md: Document options and variables visible in actions/predicates 13 years ago
David Majda b7e41b0985 README.md: Various tweaks 13 years ago
David Majda 6f78df19d4 Make benchmark suite support the |cache| option
Both the browser and the command-line version of the benchmark suite
runner now allow users to specify a value of the |cache| option.
13 years ago
David Majda 8f71c07cec Implement the "--cache" command-line option 13 years ago
David Majda 5b3321d302 Implement |cache| option for |PEG.buildParser|
This option enables/disables the results cache in generated parsers.
Until now, it was always enabled, but after this commit it needs to be
enabled explicitly (i.e. the |cache| option default value is |false|).
The reason is that parsing without it is *much* faster according to the
benchmark.

Note that disabling the cache breaks the linear parsing time guarantee,
meaning that with some grammars you can get exponential parsing time
with respect to the input length. This, together with the possibility of
improving the cache performance in the future, is the reason to keep it
as an option.

Speed impact
------------
Before:     214.08 kB/s
After:      827.52 kB/s
Difference: 286.54%

Size impact
-----------
Before:     1045396 b
After:      949783 b
Difference: -9.15%

(Measured by /tools/impact with Node.js v0.6.6 on x86_64 GNU/Linux.)
13 years ago
David Majda 1ee6731b51 Supply default option value only if the option is not specified
The "|| trick" is too brittle in this case -- it wouldn't work e.g. for
options with default value |true| and passed value |false|, enforcing
inconsistent default values handling.
13 years ago
David Majda 2aaa038499 Add a hack to skip last comma in |parseFunctions| 13 years ago
David Majda f3970bfa5c Extend QUnit a bit more cleanly 13 years ago
David Majda abf33d3feb Add a note about semantic versioning to |PEG.VERSION| comment 13 years ago
David Majda 7f2dc850e0 Change how the library is exported
This commit makes the library define the |PEG| global variable (for
browser export) and possibly assign it into |module.exports| (for
Node.js export) later. The |module.exports| assignment is done *outside*
the main library |function| statement.

The big idea behind this is to make copy & paste inclusion of the
library into another code easier -- one just needs to strip the last
three lines.
13 years ago
David Majda d35b21e9b2 Simplify the |indent| function in /test/run 13 years ago
David Majda 9d5990f80a Update code formatting in /test/run to match conventions I use elsewhere 13 years ago
David Majda 8b5e88674c Update bundled jQuery to version 1.7.2 13 years ago
David Majda 6d624a89bd Update bundled QUnit to version 1.5.0 13 years ago
David Majda 8d74248251 Make "Generated by ..." comment match the copyright comment 13 years ago
David Majda 7e02e45831 Improve copyright comment 13 years ago
David Majda d28324306c LICENSE: Update copyright years 13 years ago
David Majda 90d164445a Update embedded Codie to version 1.1.0 13 years ago
David Majda 0865e9e51a Make benchmark suite support |trackLineAndColumn| option
Both the browser and the command-line version of the benchmark suite
runner now allow users to specify a value of the |trackLineAndColumn|
option. In case of the command-line version this required a minor CLI
redesign.
13 years ago
David Majda 58cc5b739d Implement "--track-line-and-column" command-line option 13 years ago
David Majda 52d7ec2224 Implement |trackLineAndColumn| option for |PEG.buildParser|
This option makes the generated parser track line and column during
parsing. Tracked line and column are made available inside actions and
predicates as |line| and |column| variables.

Note that in actions these variables denote start position of the
action's expression while in predicates they denote the current
position. The slightly different behavior is motivated by expected
usage.
13 years ago
David Majda 9615eb4bb6 Allow passing options to |PEG.buildParser|
These get passed down to the emitter templates.
13 years ago
David Majda f2f88b87ea Make current parse position visible in actions and predicates
The speed/size impact is insignificant.

Speed impact
------------
Before:     214.11 kB/s
After:      214.87 kB/s
Difference: 0.35%

Size impact
-----------
Before:     1042691 b
After:      1046731 b
Difference: 0.38%

(Measured by /tools/impact with Node.js v0.6.6 on x86_64 GNU/Linux.)
13 years ago
David Majda f47da5c682 Fix a bug in param name fixup code for sequences 13 years ago
David Majda 4d5b1d58aa AST: Store rules in an array instead of an object
This simplifies the code a bit and makes the AST more regular (each node
type has a fixed set of properties). The latter may get useful later
when generalizing visitors.
13 years ago
David Majda bc5abfef5c Replace Jakefile with Makefile
Doing scripting tasks in JavaScript is painful.
13 years ago
David Majda ed45a1808e Fix |quote| visibility in generated parsers
|quote| is used outside of the |parse| function so it must be defined in
more outer scope.

Fixes a problem (introduced in e9d8dc8eba)
where construction of some error messages could throw an error.
13 years ago
David Majda a2af1fe612 Semantic predicates now have access to preceding labels
Part of a fix for GH-69.
13 years ago
David Majda 4cf50bcf9f Move param computations from the emitter into a separate pass
This has two main benefits:

  1. The knowledge about scoping params in at one designated place,
     making all future adjustments in this area easier.

  2. Action-related code does not handle sequences specially anymore.
     Such knowledge/behavior doesn't belong there.
13 years ago
David Majda efc38eef9b Consolidate all variable name computations into one compiler pass
Before this change, knowledge about variable names was spread between
the |computeStackDepths| pass and the code emitter code. For example,
the fact that the |&...| expression needs one variable to store a
position was represented in both places.

This changes consolidates that knowledge and introduces a new
|computeVarNames| pass. This pass replaces old |computeStackDepths|
pass, does all computations realted to variable names and stores the
results in the AST. Note that some knowledge about variables
(inevitably) remained in emitter code templates.

Beside DRYing things up, this change simplifies the emitter
significantly. By storing variable names in the AST it also allows
introduction of a pass that will identify parameters passed to actions
using proper symbol tables. Right now, this is done in a hackish way
directly in the emitter, which won't work well with changes planned in
GH-69.
13 years ago
David Majda 9d96e1e303 README.md: Update compatibility information 13 years ago
David Majda d002cd6ff6 Remove comment about IE in |quoteForRegexpClass|
We escape null for general compatibility (see comment at the top of the
function), not only because of IE.
13 years ago
David Majda a0898388fb /bin/pegjs: Avoid calling |process.openStdin|
While |process.openStdin| is not officially deprecated, it's no longer
documented and just using |process.stdin| and resuming it seems to be
the official way.
13 years ago
David Majda de256105eb /bin/pegjs: Don't close standard output
Avoids "Error: process.stdout cannot be closed" error when invoked
without file arguments.
13 years ago
David Majda 70e4166bb2 Fix typo in a comment in JavaScript example grammar 13 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).
13 years ago
David Majda e9d8dc8eba More responsibility for building an error message into |SyntaxError| 13 years ago
David Majda 21c6d9ccd3 Add |offset| property to exceptions thrown by parsers
Based on a patch by Marcin Stefaniuk (marcin@stefaniuk.info).
13 years ago
David Majda 8ae3eea7c4 Fix typo in JavaScript example grammar
Fixes GH-62.
13 years ago
David Majda 433c278e5d Merge pull request #59 from jasondavies/typo
Fix typo in comment.
13 years ago
David Majda 791c495aec Update embedded Codie to version 1.0.1 13 years ago
David Majda fb5028eb90 Use |util| module instead of |sys|
|sys| emits a warning in Node.js 0.6.x.
13 years ago
David Majda fa1523b651 Update version of Node.js and development dependencies in package.json
The new versions are the ones I test with.
13 years ago
Jason Davies d386d3a351 Fix typo in comment. 13 years ago
David Majda 47969a2f61 Replace |for| loop iterating over sequence elements with |each| 13 years ago
David Majda a19ea83ffa Replace |for| loop iterating over compiler passes with |each| 13 years ago