Talk about "consuming input", not "advancing parser position"

It's shorter, less technical, and more understandible.
redux
David Majda 9 years ago
parent 091e60112c
commit 6ff005786c

@ -304,13 +304,12 @@ backtracking.
#### & *expression*
Try to match the expression. If the match succeeds, just return `undefined` and
do not advance the parser position, otherwise consider the match failed.
do not consume any input, otherwise consider the match failed.
#### ! *expression*
Try to match the expression. If the match does not succeed, just return
`undefined` and do not advance the parser position, otherwise consider the match
failed.
`undefined` and do not consume any input, otherwise consider the match failed.
#### & { *predicate* }
@ -318,8 +317,8 @@ The predicate is a piece of JavaScript code that is executed as if it was inside
a function. It gets the match results of labeled expressions in preceding
expression as its arguments. It should return some JavaScript value using the
`return` statement. If the returned value evaluates to `true` in boolean
context, just return `undefined` and do not advance the parser position;
otherwise consider the match failed.
context, just return `undefined` and do not consume any input; otherwise
consider the match failed.
The code inside the predicate can access all variables and functions defined in
the initializer at the beginning of the grammar.
@ -347,8 +346,8 @@ The predicate is a piece of JavaScript code that is executed as if it was inside
a function. It gets the match results of labeled expressions in preceding
expression as its arguments. It should return some JavaScript value using the
`return` statement. If the returned value evaluates to `false` in boolean
context, just return `undefined` and do not advance the parser position;
otherwise consider the match failed.
context, just return `undefined` and do not consume any input; otherwise
consider the match failed.
The code inside the predicate can access all variables and functions defined in
the initializer at the beginning of the grammar.

@ -268,7 +268,7 @@ describe("generated parser behavior", function() {
expect(parser).toParse("a", "a");
});
it("advances parse position past the matched text", function() {
it("consumes the matched text", function() {
var parser = PEG.buildParser('start = "a" .', options);
expect(parser).toParse("ab");
@ -341,7 +341,7 @@ describe("generated parser behavior", function() {
expect(parser).toParse("a", "a");
});
it("advances parse position past the matched character", function() {
it("consumes the matched character", function() {
var parser = PEG.buildParser('start = [a] .', options);
expect(parser).toParse("ab");
@ -377,7 +377,7 @@ describe("generated parser behavior", function() {
expect(parser).toParse("a", "a");
});
it("advances parse position past the matched character", function() {
it("consumes the matched character", function() {
var parser = PEG.buildParser('start = . .', options);
expect(parser).toParse("ab");

Loading…
Cancel
Save