HHAST-Inspect is a tool to generate an interactive view of a Hack program's concrete syntax tree, built using HHAST. It was previously included with HHAST, and is primarily used as a developer tool when working with HHAST, such as when working on linters or migrations (a.k.a. codemods).
- Clone this repository: git clone https://github.com/hhvm/hhast-inspect
- Install dependencies:
cd hhast-inspect; composer install
- Run
bin/hhast-inspect /path/to/source/file
; this will produce an HTML file and show the path - Open the output file in a web browser. On most systems, passing
--open
tohhast-inspect
will make it open the file automatically in your default web web browser - Click on Hack source code to select the syntax tre node, and to show information on the node and its' ancestors
- Click on one of the ancestors to highlight the ancestor - the original node remains highlighted in a different color
% bin/hhast-inspect src/InspectorCLI.hack --open
/var/folders/9v/sc1xb84516v_0rv47v0ygm340000gn/T/hhast-inspect-667b4af71f8ce431718c64e2991d49ac.html
HHAST-Inspect is MIT-licensed.