mogglo-typescript-0.1.1-rc.2 is not a library.
Mogglo
Mogglo is a multi-language AST-based code search and rewriting tool. Mogglo supports embedding Lua code in search patterns and replacements.
Mogglo focuses on the following goals:
- Minimal setup: Mogglo will work right away on any codebase in a supported language.
- Many languages: 12 and counting!
- High-quality grammars: Mogglo is based on tree-sitter grammars.
- Lua: Mogglo exposes a rich API to embedded Lua snippets.
Introduction
The following examples give a taste of Mogglo. Here's how to find pointless assignments of an expression to itself:
Lua code is wrapped in braces. Lua can recursively match patterns with rec
.
Here's a pattern to detect out-of-bounds array accesses:
Here's how to unroll a simple loop:
This transformation demonstrates the power of using Lua: it can't be done with regular expression substitutions and would be very difficult with other codemod tools.
See the documentation for more details!