From 7d7345b9ec92480459fa540d3fee400af7071813 Mon Sep 17 00:00:00 2001
From: Ian Gulliver '),
rr.Ref('multiline-wikichunk'),
rr.Literal(''))),
- 'multiline-comment': rr.Node('comment', rr.Sequence(
+ 'multiline-comment': rr.Hidden(rr.Sequence(
rr.Literal(''))),
@@ -185,7 +185,7 @@ var mediawiki = {
rr.Literal(''),
rr.Ref('singleline-wikichunk'),
rr.Literal(''))),
- 'singleline-comment': rr.Node('comment', rr.Sequence(
+ 'singleline-comment': rr.Hidden(rr.Sequence(
rr.Literal(''))),
@@ -287,8 +287,8 @@ var mediawiki = {
'paragraph': rr.Node('p', rr.Sequence(
rr.Ref('multiline-wikichunk'),
rr.Or(
- rr.Sequence(rr.EndOfLine(), rr.Literal('\n')),
- rr.EndOfText()))),
+ rr.Sequence(rr.EndOfLine(), rr.Literal('\n')),
+ rr.EndOfText()))),
'wikidoc': rr.Node('wikidoc', rr.Sequence(
rr.ZeroOrMore(rr.Ref('paragraph')),
diff --git a/recentrunes.js b/recentrunes.js
index 6f3496b..8885d00 100644
--- a/recentrunes.js
+++ b/recentrunes.js
@@ -180,6 +180,7 @@ rr.EndOfText = function() {
/**
* @type {rr.EndOfText_}
* @const
+ * @private
*/
rr.EndOfText.cache_ = new rr.EndOfText_();
}
@@ -188,6 +189,51 @@ rr.EndOfText = function() {
+/**
+ * @constructor
+ *
+ * @param {rr.typeMatcher} child
+ * @private
+ */
+rr.Hidden_ = function(child) {
+ this.child_ = child;
+};
+
+
+/**
+ * @param {rr.Context} context
+ * @return {rr.typeIterator}
+ */
+rr.Hidden_.prototype.match = function(context) {
+ var iterator = this.child_.match(context);
+ return {
+ 'next': function() {
+ var next = iterator.next();
+ if (next['done']) {
+ return { 'done': true };
+ }
+ return {
+ 'done': false,
+ 'value': {
+ 'context': next['value']['context'],
+ 'nodes': []
+ }
+ };
+ }.bind(this)
+ };
+};
+
+
+/**
+ * @param {rr.typeMatcher} child
+ * @return {rr.Hidden_}
+ */
+rr.Hidden = function(child) {
+ return new rr.Hidden_(child);
+};
+
+
+
/**
* @constructor
*
diff --git a/test.js b/test.js
index beb76e1..ac7562a 100644
--- a/test.js
+++ b/test.js
@@ -46,8 +46,7 @@ QUnit.test('Base', function(assert) {
'this. This sentence is inline pre-formatted, which stops \n',
"'''''this from being bold and italic.''''' We can also \nstop ",
'<u>this from being underlined</u>, or just try \n',
- '<pre>interrupting cow style.</pre>This is a ",
+ '<pre>interrupting cow style.</pre>
This is a ',
'blockquote