Commit graph

646 commits

Author SHA1 Message Date
David Majda 725927e05f Change ordering of "action" code
Places all code that does something with "action" AST nodes under code
handling "choice" nodes.

This ordering is logical because now all the node handling code matches
the sequence in which various node types usually appear when descending
through the AST tree.
2012-06-26 20:28:06 +02:00
David Majda cdf23e0a49 Change ordering of "literal", "class" and "any" code
Changes all code that does something with "literal", "class" or "any"
AST nodes so that the code deals with these in the follwing order:

  1. literal
  2. class
  3. any

Previously the code used this ordering:

  1. literal
  2. any
  3. class

The new ordering is more logical because the nodes are handled from the
most specific to the most generic.
2012-06-25 21:46:47 +02:00
David Majda eb4badab24 Refactor named rules AST representation
PEG.js grammar rules are represented by |rule| nodes in the AST. Until
now, all such nodes had a |displayName| property which was either |null|
or stored rule's human-readable name. This commit gets rid of the
|displayName| property and starts representing rules with a
human-readable name using a new |named| node (a child of the |rule|
node).

This change simplifies code generation code a bit as tests for
|displayName| can be removed (see changes in generate-code.js). It also
separates different concerns from each other nicely.
2012-06-25 21:36:41 +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 a59516f89b Small reordering of properties when creating |class| nodes
General rule: Least important things/flags go last.
2012-05-07 10:14:09 +02:00
David Majda 55a255a882 Add forgotten tests for |nonBraceCharacter| & |nonBraceCharacters| rules 2012-05-07 09:56:39 +02:00
David Majda 7900b66c70 Fix |braced| rule in the PEG.js grammar
This fix does not change the behavior, it just makes the
|nonBraceCharacters| rule un-dead (as originally intended).
2012-05-07 09:53:21 +02:00
David Majda 23e04bb4f4 Jasmine: Delete remains the old test suite 2012-05-06 19:05:38 +02:00
David Majda 8ef5f08c90 Jasmine: Convert |removeProxyRules| compiler pass tests 2012-05-06 19:05:38 +02:00
David Majda eaf2af8e7b Jasmine: Convert |computeParams| compiler pass tests 2012-05-06 19:05:38 +02:00
David Majda 4edc9982cc Jasmine: Convert |computeVarNames| compiler pass tests 2012-05-06 19:05:38 +02:00
David Majda 1471df9a69 Jasmine: Convert |reportLeftRecursion| compiler pass tests 2012-05-06 19:05:38 +02:00
David Majda 2889ca72fc Jasmine: Convert |reportMissingRules| compiler pass tests 2012-05-06 19:05:38 +02:00
David Majda ef25ec08c2 Extract |varyAll| calls one level up
DRY + less code.
2012-05-06 19:05:38 +02:00
David Majda e030834a0e Delete test/compiler-test.js 2012-05-06 19:05:38 +02:00
David Majda 112e4122d0 Jasmine: Convert remaining error reporting tests 2012-05-06 19:05:38 +02:00
David Majda 94aaf4ec75 Jasmine: Convert error position reporting tests 2012-05-06 19:05:38 +02:00
David Majda 1825dd4a42 Jasmine: Convert start rule tests 2012-05-06 19:05:37 +02:00
David Majda 68bfeac134 Jasmine: Drop the idempotence test
The code this test covered is long gone.
2012-05-06 19:05:37 +02:00
David Majda f61813238d Jasmine: Convert complex example tests 2012-05-06 19:05:37 +02:00
David Majda 022a51f94e Jasmine: Convert cache tests 2012-05-06 19:05:37 +02:00
David Majda e9f7255d47 Jasmine: Convert initializer tests 2012-05-06 19:05:37 +02:00
David Majda f5f40f68d2 Jasmine: Convert choice matching tests 2012-05-06 19:05:37 +02:00
David Majda 1b0789fbae Jasmine: Convert sequence matching tests 2012-05-06 19:05:37 +02:00
David Majda ae8a89c9e4 Jasmine: Convert labeled matching tests 2012-05-06 19:05:37 +02:00
David Majda b013ba8cc9 Jasmine: Convert simple and matching tests 2012-05-06 19:05:37 +02:00
David Majda 343e9db525 Jasmine: Convert simple not matching tests 2012-05-06 19:05:37 +02:00
David Majda 2bb25efa44 Jasmine: Convert semantic and code tests 2012-05-06 19:05:37 +02:00
David Majda f04096189f Jasmine: Convert semantic not code tests 2012-05-06 19:05:37 +02:00
David Majda ccf31f8822 Jasmine: Convert optional matching tests 2012-05-06 19:05:37 +02:00
David Majda 669668fc1b Jasmine: Convert zero or more matching tests 2012-05-06 19:05:37 +02:00
David Majda 1ab06ff906 Jasmine: Convert one or more matching tests 2012-05-06 19:05:37 +02:00
David Majda 03716a562d Jasmine: Convert action code tests 2012-05-06 19:05:37 +02:00
David Majda b06bd774f5 Jasmine: Convert rule reference matching tests 2012-05-06 19:05:36 +02:00
David Majda 14c11b4dfc Jasmine: Convert class matching tests 2012-05-06 19:05:36 +02:00
David Majda 75ab03dc85 Jasmine: Convert any matching tests 2012-05-06 19:05:36 +02:00
David Majda ec48742032 Jasmine: Convert literal matching tests 2012-05-06 19:05:36 +02:00
David Majda feddd10190 Jasmine: Delete test/parser-test.js 2012-05-06 19:05:36 +02:00
David Majda 94205ab639 Jasmine: Convert tests of parser's "grammar" rule 2012-05-06 19:05:36 +02:00
David Majda f746189f2b Jasmine: Convert tests of parser's "initializer" rule 2012-05-06 19:05:36 +02:00
David Majda a49674b05f Jasmine: Change |oneRuleGrammar| parameter handling
This change makes code using |oneRuleGrammar| less verbose + prepares
for passing of the initializer (will be used by code added in the next
few commits).
2012-05-06 19:05:36 +02:00
David Majda 171d62fce4 Jasmine: Convert tests of parser's "rule" rule 2012-05-06 19:05:36 +02:00
David Majda e17d4de7ae Jasmine: Convert tests of parser's "expression" rule 2012-05-06 19:05:36 +02:00
David Majda cc22086a09 Jasmine: Convert tests of parser's "choice" rule 2012-05-06 19:05:36 +02:00
David Majda 434abdb272 Jasmine: Convert tests of parser's "sequence" rule 2012-05-06 19:05:36 +02:00
David Majda ec8889f85d Jasmine: Convert tests of parser's "labeled" rule 2012-05-06 19:05:36 +02:00
David Majda bf6d412a4f Jasmine: Convert tests of parser's "prefixed" rule 2012-05-06 19:05:36 +02:00
David Majda 3e083cc51b Jasmine: Convert tests of parser's "suffixed" rule 2012-05-06 19:05:36 +02:00
David Majda 45f825c24f Jasmine: Convert tests of parser's "primary" rule 2012-05-06 19:05:35 +02:00