talira

Sourceror

Utilities to work with Elixir source code, comments included

open sourceApache-2.0free

Sourceror is a library for working with Elixir source code: parsing it into an AST that stays as close as possible to Elixir's standard one while keeping comments attached to nodes (leading and trailing comments in node metadata), so code can be transformed and written back without losing or misplacing them. It includes a zipper for navigating and editing the AST and has no dev or prod dependencies, which makes it easy to build into other tools. It's by Dorgan.

Problems it solves

  • rewrite Elixir source code programmatically without losing comments
  • build a codemod or refactoring tool for Elixir
  • edit Elixir files from a mix task while keeping comments in place

Features

  • parse Elixir source with comments attached to AST nodes
  • AST close to the standard Elixir AST
  • zipper for navigating and editing code
  • no dependencies