Diesel behaviour (diesel v0.5.4)

Declarative programming in Elixir

Diesel is a toolkit that helps you build your own DSLs.

Usage:

defmodule MyApp.Fsm do
  use Diesel,
    otp_app: :my_app,
    dsl: MyApp.Fsm.Dsl,
    parsers: [
      ...
    ],
    generators: [
      ...
    ]
end

For more information on how to use this library, please check:

  • the Diesel.Dsl and Diesel.Tag modules,
  • the guides and tutorials provided in the documentation
  • the examples used in tests

Summary

Callbacks

Compiles the raw definition and returns a compiled version of it

Returns the raw definition for the dsl, before compilation

Functions

Returns the first child of the given element, or list of elements

Returns the first child element matching the given name, from the given definition

Returns all children elements matching the given tag

Returns all elements matching the given name

Types

@type element() :: {tag(), keyword(), [element()]}
@type tag() :: atom()

Callbacks

Link to this callback

compile(context)

@callback compile(context :: map()) :: term()

Compiles the raw definition and returns a compiled version of it

The obtained structure is the result of applying the configured list of parsers to the raw internal definition and then compiling it according to the rules implemented by packages.

@callback definition() :: element()

Returns the raw definition for the dsl, before compilation

Functions

@spec child(element() | [element()]) :: any()

Returns the first child of the given element, or list of elements

Link to this function

child(element, name)

@spec child(element(), tag()) :: element() | nil

Returns the first child element matching the given name, from the given definition

Link to this function

children(arg, name)

@spec children(element(), tag()) :: [element()]

Returns all children elements matching the given tag

Link to this function

elements(elements, name)

@spec elements([element()], tag()) :: [element()]

Returns all elements matching the given name