Erl2ex v0.0.3 Erl2ex
Erl2ex is an Erlang to Elixir transpiler, converting well-formed Erlang source to Elixir source with equivalent functionality.
The goal is to produce correct, functioning Elixir code, but not necessarily perfectly idiomatic. This tool may be used as a starting point when porting code from Erlang to Elixir, but manual cleanup will likely be desired.
This module provides the main entry points into Erl2ex.
Summary
Types
Options that may be provided to a conversion run
Information on an error that happened converting a piece of Erlang source
Functions
Searches a directory for Erlang source files, and writes corresponding Elixir files for each module
Searches a directory for Erlang source files, and writes corresponding Elixir files for each module
Converts a single Erlang source file, and writes the generated Elixir code to a new file
Converts a single Erlang source file, and writes the generated Elixir code to a new file
Converts the source for an Erlang module, represented as a string
Converts the source for an Erlang module, represented as a string, and returns the Elixir source as a string
Types
options :: [include_dir: Path.t, verbosity: integer]
Options that may be provided to a conversion run.
Recognized options are:
:include_dir
Add a directory to the include path.:verbosity
Set the output verbosity level. (Default is 0, which outputs only error messages. 1 outputs basic status information, and 2 outputs debug information.)
source_error :: {Path.t, integer | :unknown, String.t}
Information on an error that happened converting a piece of Erlang source.
The three tuple elements are: the path to the Erlang source file, the line
number (or :unknown
if it could not be determined), and a text description
of the problem (which usually contains some token or AST information.)
Functions
Searches a directory for Erlang source files, and writes corresponding Elixir files for each module.
By default, the Elixir files will be written in the same directories as the Erlang source files. You may optionally provide a different base directory for the destination files.
If the conversion is successful, returns a tuple of {:ok, map} where the map is from the Erlang source paths to the Elixir destination paths. If an error occurs, returns a tuple of {:error, error_details}.
Searches a directory for Erlang source files, and writes corresponding Elixir files for each module.
By default, the Elixir files will be written in the same directories as the Erlang source files. You may optionally provide a different base directory for the destination files.
Returns a map from the Erlang source paths to the Elixir destination paths. Raises a CompileError if an error occurs.
Specs
convert_file(Path.t, Path.t, options) ::
{:ok, Path.t} |
{:error, source_error}
Converts a single Erlang source file, and writes the generated Elixir code to a new file.
You must provide the relative or absolute path to the Erlang source. You may optionally provide a path to the Elixir destination. If the destination is not specified, the result will be written in the same directory as the source.
If the conversion is successful, returns a tuple of {:ok, path} where “path” is the path to the generated Elixir file. If an error occurs, returns a tuple of {:error, error_details}.
Converts a single Erlang source file, and writes the generated Elixir code to a new file.
You must provide the relative or absolute path to the Erlang source. You may optionally provide a path to the Elixir destination. If the destination is not specified, the result will be written in the same directory as the source.
Returns the path to the generated Elixir file. Raises a CompileError if an error occurs.
Specs
convert_str(String.t, options) ::
{:ok, String.t} |
{:error, source_error}
Converts the source for an Erlang module, represented as a string.
If the conversion is successful, returns a tuple of {:ok, result}. If an error occurs, returns a tuple of {:error, error_details}.