Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

ESTR - ECMAScript traversals

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 tests
Octocat-spinner-32 vimfiles
Octocat-spinner-32 .gitattributes
Octocat-spinner-32 README.md
Octocat-spinner-32 ast_utils.js
Octocat-spinner-32 esprima.js
Octocat-spinner-32 estr.js
Octocat-spinner-32 scope_utils.js
Octocat-spinner-32 tags.js
README.md

ESTR - ECMAScript traversals

Javascript tool for working with Javascript code, using esprima. Estr has a commandline interface, using nodejs, but its modules can also be used from the browser. There is an in-browser demo showing scoped variable highlighting, navigation to variable occurrences, and variable renaming.

Estr currently supports:

  • generating scope-aware tags from esprima ASTs, for use with the scoped_tags Vim mode

  • renaming a variable (this will currently output the modified file to stdout instead of replacing the file)

  • find variable binding and other occurrences

Commandline usage

node estr.js tags ..paths
  traverse paths, extract tags from .js-files, write to file "tags"

node estr.js rename file.js oldName <line> <column> newName
  rename oldName (at <line> <column>) to newName

node estr findVar file.js name <line> <column>
  find binding and other occurrences for name

Assumptions

  • in rename, point to the beginning of an oldName occurrence; all oldName occurrences in the same scope will be renamed, provided that

    • oldName/newName are valid Identifiers
    • a binding for oldName is available
    • no existing binding for newName in the same scope
    • no existing occurrences of newName will be captured by renamed binding
    • no renamed occurrences of oldName will be captured by existing binding
    • renaming is not affected by same-name hoisting over catch (language edge case)
Something went wrong with that request. Please try again.