Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformDispatcher.js |
— | — | @@ -2,7 +2,8 @@ |
3 | 3 | * expansion. Individual transformations register for the token types they are |
4 | 4 | * interested in and are called on each matching token. |
5 | 5 | * |
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. |
7 | 8 | * - Null removes the token and stops further processing for this token. |
8 | 9 | * - A single token is further processed using the remaining transformations |
9 | 10 | * registered for this token, and finally placed in the output token list. |
— | — | @@ -15,6 +16,10 @@ |
16 | 17 | * token last in its internal accumulator. This setup avoids the need to apply |
17 | 18 | * operational-transform-like index transformations when parallel expansions |
18 | 19 | * 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) |
19 | 24 | * */ |
20 | 25 | |
21 | 26 | /** |
— | — | @@ -33,14 +38,14 @@ |
34 | 39 | newline: [], |
35 | 40 | comment: [], |
36 | 41 | end: [], // eof |
37 | | - martian: [], // none of the above |
| 42 | + martian: [], // none of the above (unknown token type) |
38 | 43 | any: [] // all tokens, before more specific handlers are run |
39 | 44 | }; |
40 | 45 | this.reset(); |
41 | 46 | } |
42 | 47 | |
43 | 48 | /** |
44 | | - * Reset the internal token and callback state of the |
| 49 | + * Reset the internal token and outstanding-callback state of the |
45 | 50 | * TokenTransformDispatcher, but keep registrations untouched. |
46 | 51 | * |
47 | 52 | * @method |