Make ZeroOrMore non-greedy to make it nestable without exponential behavior.
This commit is contained in:
5
test.js
5
test.js
@@ -8,7 +8,7 @@ QUnit.test('Simple', function(assert) {
|
||||
var iterable = context.rules['wikidoc'].match(context);
|
||||
assert.equal(iterable.next().value.nodes[0].innerHTML,
|
||||
'<h3>Heading</h3>This is a wiki doc.\n' +
|
||||
'How about some <b>bold and <i>bold italic</i></b>.\n' +
|
||||
"How about some <b>bold and ''bold italic</b>''.\n" +
|
||||
'I would also love some nowiki <b>foo</b>');
|
||||
});
|
||||
|
||||
@@ -16,7 +16,8 @@ QUnit.test('Simple', function(assert) {
|
||||
QUnit.test('ZeroOrMore', function(assert) {
|
||||
assert.expect(1);
|
||||
var rules = {
|
||||
'test': rr.Node('test', rr.ZeroOrMore(rr.MultiLineText()))
|
||||
'test': rr.Node('test',
|
||||
rr.Sequence(rr.ZeroOrMore(rr.MultiLineText()), rr.EndOfText()))
|
||||
};
|
||||
var context = new rr.Context(rules, 'foobar');
|
||||
var iterable = context.rules['test'].match(context);
|
||||
|
||||
Reference in New Issue
Block a user