Commit graph

10 commits

Author SHA1 Message Date
David Majda b1ad2a1f61 Rename |reportedPos| to |savedPos|
Preform the following renames:

  * |reportedPos| -> |savedPos| (abstract machine variable)
  * |peg$reportedPos| -> |peg$savedPos| (variable in generated code)
  * |REPORT_SAVED_POS| -> |LOAD_SAVED_POS| (instruction)
  * |REPORT_CURR_POS| -> |UPDATE_SAVED_POS| (instruction)

The idea is that the name |reportedPos| is no longer accurate after the
|location| change (seea the previous commit) because now both
|reportedPos| and |currPos| are reported to user code. Renaming to
|savedPos| resolves this inaccuracy.

There is probably some better name for the concept than quite generic
|savedPos|, but it doesn't come to me.
2015-04-03 16:26:34 +02:00
David Majda 3473c6cb64 Remove extra whitespace 2015-04-02 14:34:26 +02:00
David Majda fb320c4c59 Fix small errors in Jasmine matcher messages 2015-04-02 14:32:31 +02:00
David Majda d7fc0b5c3b Implement infinite loop detection
Fixes #26.
2015-04-01 12:21:43 +02:00
David Majda 6ce97457bf Fix left recursion detection
So far, left recursion detector assumed that left recursion occurs only
when the recursive rule is at the very left-hand side of rule's
expression:

  start = start

This didn't catch cases like this:

  start = "a"? start

In general, if a rule reference can be reached without consuming any
input, it can lead to left recursion. This commit fixes the detector to
consider that.

Fixes #190.
2015-04-01 10:10:51 +02:00
David Majda 5a2ca2abc7 Add two missing blank lines 2014-06-07 14:20:53 +02:00
David Majda 5ce5f7a612 Specs cleanup: Use raw node types in |generateBytecode| specs
Use raw node types instead of humanized node names in |generateBytecode|
specs. This corresponds more closely to the level the specs are written
at.
2014-06-07 14:17:11 +02:00
David Majda 0977dd37a3 Reordering in visitors and their specs
Reorder visiting functions and their specs to more closely match
ordering used in the PEG.js grammar.
2014-06-07 14:06:42 +02:00
David Majda 850ddf5889 Specs cleanup: Simplify compiler passes specs
After 898a7b5a2d the specs mostly tested
the visitor implementation, not actual code in the passes.
2014-06-07 10:50:55 +02:00
David Majda 3d637173ee Specs cleanup: Split specs into unit and API specs
Unit specs are unit tests of internal stuff. API specs are tests of the
user-visible APIs and behavior.

I think it makes sense to make this distinction because then the public
API line is more clearly visible e.g. when using the specs as
documentation.
2014-05-23 12:57:41 +02:00