r112104 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112103‎ | r112104 | r112105 >
Date:13:13, 22 February 2012
Author:gwicke
Status:deferred
Tags:
Comment:
Cleanup and commenting.
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js
@@ -62,25 +62,7 @@
6363 };
6464
6565
66 -
6766 /**
68 - * Map a rank to a phase.
69 - *
70 - * XXX: Might not be needed anymore, as phases are now subclassed and
71 - * registrations are separated.
72 - */
73 -TokenTransformManager.prototype._rankToPhase = function ( rank ) {
74 - if ( rank < 0 || rank > 3 ) {
75 - throw "TransformManager error: Invalid transformation rank " + rank;
76 - }
77 - if ( rank <= 2 ) {
78 - return 2;
79 - } else {
80 - return 3;
81 - }
82 -};
83 -
84 -/**
8567 * Add a transform registration.
8668 *
8769 * @method
@@ -151,8 +133,6 @@
152134 * fully processed). The token type change case still needs to be covered
153135 * though.
154136 */
155 -TokenTransformManager.prototype._setTokenRank = function ( token ) {
156 -};
157137 TokenTransformManager.prototype._resetTokenRank = function ( res, transformer ) {
158138 if ( res.token ) {
159139 // reset rank after type or name change
Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt
@@ -126,6 +126,9 @@
127127 /*
128128 * Annotate a token stream with list items with appropriate list tokens
129129 *
 130+ * XXX: Move this to a token handler in phase sync23! That way we can
 131+ * support list items from templates too.
 132+ *
130133 * @static
131134 * @method
132135 * @param {[tokens]} Token stream with li tokens
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.js
@@ -135,6 +135,9 @@
136136 * Token stream transformations to register by type and per phase. The
137137 * possible ranks for individual transformation registrations are [0,1)
138138 * (excluding 1.0) for sync01, [1,2) for async12 and [2,3) for sync23.
 139+ *
 140+ * Should perhaps be moved to mediawiki.parser.environment.js, so that all
 141+ * configuration can be found in a single place.
139142 */
140143 ParserPipeline.prototype._transformers = {
141144 'text/wiki': {
@@ -143,14 +146,26 @@
144147 [
145148 IncludeOnly,
146149 NoInclude
 150+ // Insert TokenCollectors for extensions here (don't expand
 151+ // templates in extension contents); wrap collected tokens in
 152+ // special extension token.
 153+ /* Extension1, */
 154+ /* Extension2, */
147155 ],
148 - // Asynchronous out-of-order per input
 156+ /*
 157+ * Asynchronous out-of-order per input. Output of transforms is *not*
 158+ * processed by other async transforms. Transforms are expected to
 159+ * apply any additional async transformations themselves.
 160+ */
149161 async12:
150162 [
151 - // Insert TokenCollector for extensions here (don't expand
152 - // templates in extension contents)
153163 TemplateHandler,
154 - AttributeExpander // After templates to avoid expanding unused branches
 164+ // Expand attributes after templates to avoid expanding unused branches
 165+ // XXX: Should we support further processing after attribute
 166+ // expansion?
 167+ AttributeExpander
 168+ /* ExtensionHandler1, */
 169+ /* ExtensionHandler2, */
155170 ],
156171 // Synchronous in-order on fully expanded token stream (including
157172 // expanded templates etc).
@@ -159,6 +174,7 @@
160175 QuoteTransformer,
161176 PostExpandParagraphHandler,
162177 /* Cite, */
 178+ /* ListHandler, */
163179 Sanitizer
164180 ]
165181 }

Status & tagging log