Lexgen.Generator (lexgen v1.0.0)

Summary

Functions

Given a list of Lexicon structs, generates Elixir source code files to the given output directory.

Reads all Lexicons in the given path and generates code for them.

Given a path to a Lexicon JSON file, reads the file and parses it into a Lexicon struct.

Given a path to one or more Lexicon JSON files, reads the files and parses them into a list of Lexicon structs.

Functions

build_code(lexicons, output)

Given a list of Lexicon structs, generates Elixir source code files to the given output directory.

generate(input, output \\ nil)

Reads all Lexicons in the given path and generates code for them.

The input path argument is given to Lexgen.Generator.read_lexicons/1. See that function for more information about the accepted format of the input path.

If output is given, it is assumed to be a path to a directory where all of the generated source files will be written. The directory will be created if it does not exist.

read_lexicon(path)

Given a path to a Lexicon JSON file, reads the file and parses it into a Lexicon struct.

read_lexicons(path)

Given a path to one or more Lexicon JSON files, reads the files and parses them into a list of Lexicon structs.

Note: Uses Path.wildcard/1 to convert path to a list of paths.