Label specs: Add missing test case

This commit is contained in:
David Majda 2015-07-17 11:43:30 +02:00
parent f4385da177
commit 8487c9a0ff

View file

@ -654,6 +654,15 @@ describe("generated parser behavior", function() {
expect(parser).toParse("abc");
});
it("can access label variables from preceding labeled elements in an outside sequence (group)", function() {
var parser = PEG.buildParser(
'start = a:"a" ("b" !{ return a !== "a"; })',
options
);
expect(parser).toParse("ab", ["a", ["b", undefined]]);
});
it("can access label variables from preceding labeled elements in an outside sequence (optional)", function() {
var parser = PEG.buildParser(
'start = a:"a" ("b" !{ return a !== "a"; })?',