r106168 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106167‎ | r106168 | r106169 >
Date:09:33, 14 December 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Update comments a bit and add a note on things to improve in API.
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformDispatcher.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformDispatcher.js
@@ -2,7 +2,8 @@
33 * expansion. Individual transformations register for the token types they are
44 * interested in and are called on each matching token.
55 *
6 - * A transformer might return null, a single token, or an array of tokens.
 6+ * A transformer might set TokenContext.token to null, a single token, or an
 7+ * array of tokens before returning it.
78 * - Null removes the token and stops further processing for this token.
89 * - A single token is further processed using the remaining transformations
910 * registered for this token, and finally placed in the output token list.
@@ -15,6 +16,10 @@
1617 * token last in its internal accumulator. This setup avoids the need to apply
1718 * operational-transform-like index transformations when parallel expansions
1819 * insert tokens in front of other ongoing expansion tasks.
 20+ *
 21+ * XXX: I am not completely happy with the mutable TokenContext construct. At
 22+ * least the token should probably be passed as a separate argument. Also,
 23+ * integrate the general environment (configuration, cache etc). (gwicke)
1924 * */
2025
2126 /**
@@ -33,14 +38,14 @@
3439 newline: [],
3540 comment: [],
3641 end: [], // eof
37 - martian: [], // none of the above
 42+ martian: [], // none of the above (unknown token type)
3843 any: [] // all tokens, before more specific handlers are run
3944 };
4045 this.reset();
4146 }
4247
4348 /**
44 - * Reset the internal token and callback state of the
 49+ * Reset the internal token and outstanding-callback state of the
4550 * TokenTransformDispatcher, but keep registrations untouched.
4651 *
4752 * @method

Status & tagging log