c2c03c23db200c8e884d5a342cd5e51b92c7986f
[platform/framework/web/crosswalk-tizen.git] /
1 # rocambole-token
2
3 Helpers to manipulate [rocambole](https://github.com/millermedeiros/rocambole)
4 AST tokens.
5
6
7 ## Why?
8
9 Created mainly to be used by
10 [esindent](https://github.com/millermedeiros/esindent/) and
11 [esformatter](https://github.com/millermedeiros/esformatter/).
12
13
14 ## Important Notes
15
16 Right now all methods ignores the `loc` and `range` info of the tokens, this is
17 *by design* since updating the range and loc info on a large JS program
18 multiple times can be very expensive. It's *better* to write a separate tool to
19 *sanitize* this info and that can be executed as a separate step.
20
21 Also important to note that right now rocambole doesn't add any reference on
22 the token itself to the nodes that contain that token, so if you remove a token
23 that happens to be the `startToken` or `endToken` of any node you might have
24 some conflict if you start manipulating the tokens based on the `nodes`,
25 instead of the `token` LinkedList. - the `node.startToken` might be *detached*
26 from the LinkedList.
27
28 Test coverage is pretty low so far, but since it was mostly extracted from
29 esformatter the methods should work as expected. I started to write some tests
30 just to show how I would do it but did not had the time to finish it...
31 (ideally tests should be written before the implementation).
32
33
34 ## License
35
36 Released under the MIT License.
37