FYI: If your Javascript editor can be extended by calling out to
Javascript code or commandline tools, you can now add scoped
variable navigation (to binding, to next/previous occurrence) and
variable renaming to your editor's feature set. Example bindings
for CodeMirror and Vim are included.

Claus

--------------------------------------------------
From: "Claus Reinke" <claus.reinke@..>
Sent: Thursday, June 14, 2012 1:15 AM
To: <js-tools@..>
Subject: [js-tools] Introducing ESTR (ES traversals and transformations)


estr is a Javascript library for processing Javascript source code,
building on the Esprima parser and AST. It comes with a commandline
interface, based on nodejs, and an online demo, based on CodeMirror,
showing how to use estr directly as a library, from the browser.

Source:   https://github.com/clausreinke/estr
Demo:     http://clausreinke.github.com/estr

In its current state, estr can:

- generate (scope-aware) tags files for JS projects
 (for use with scoped_tags Vim mode)

- augment Esprima ASTs with scope information

- locate identifier (with line/column info) in augmented AST,
 find its binding occurrence, scope, and other occurrences

- transform JS source code to implement variable renaming,
   while preserving layout and comments (no pretty-printing)

The online demo shows how to use this functionality to enhance a
standard CodeMirror JS editor. CodeMirror provides editing, its
Javascript mode provides basic syntax highlighting, Esprima adds
parsing and parse errors. On top of that, estr enables us to:

- highlight unbound variables
- highlight other occurrences of identifier under cursor
 (scope-aware)

- navigate to next/previous identifier occurrence, or to
 the binding occurrence (scope-aware)

- rename variables (scope-aware, with checks to prevent
 errors introduced by naive renaming)

The demo code is in the gh-pages branch of the estr repo.

If you find estr useful, please tell others;
if you find bugs in estr, please tell me!-)

If you have access to another JS renaming tool, you might
want to try the estr renaming tests on it. If you want to
integrate estr in your tool suite, please get in touch.

Enjoy!-)

Claus
http://clausreinke.github.com/


--
http://clausreinke.github.com/js-tools/resources.html - tool information
http://groups.google.com/group/js-tools - mailing list information

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to