remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
remix-project/libs/remix-astwalker/README.md

41 lines
1.8 KiB

## Remix Astwalker
[![npm version](https://badge.fury.io/js/%40remix-project%2Fremix-astwalker.svg)](https://www.npmjs.com/package/@remix-project/remix-astwalker)
[![npm](https://img.shields.io/npm/dt/@remix-project/remix-astwalker.svg?label=Total%20Downloads)](https://www.npmjs.com/package/@remix-project/remix-astwalker)
[![npm](https://img.shields.io/npm/dw/@remix-project/remix-astwalker.svg)](https://www.npmjs.com/package/@remix-project/remix-astwalker)
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ethereum/remix-project/tree/master/libs/remix-astwalker)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/ethereum/remix-project/issues)
`@remix-project/remix-astwalker` is a tool to parse AST (Abstract Syntax Tree) generated by Solidity compiler to perform certain operations. It is used in `remix-analyzer`, `remix-debug` and in `contextualListener` plugin of Remix IDE.
### Installation
`@remix-project/remix-astwalker` is an NPM package and can be installed using NPM as:
`yarn add @remix-project/remix-astwalker`
### How to use
`@remix-project/remix-astwalker` can be used as:
```ts
import { AstWalker } from "remix-astwalker";
const astWalker = new AstWalker();
astWalker.on("node", node => {
if (node.nodeType === "ContractDefinition") {
checkContract(st, node);
}
if (node.nodeType === "PragmaDirective") {
checkProgramDirective(st, node);
}
});
```
### Contribute
Please feel free to open an issue or a pull request.
In case you want to add some code, do have a look at our contribution guidelines [here](https://github.com/ethereum/remix-project/blob/master/CONTRIBUTING.md). Reach us on [Gitter](https://gitter.im/ethereum/remix) in case of any queries.
### License
MIT © 2018-21 Remix Team