DSL.Macros (dsl v0.1.1)

Copy Markdown View Source

Helpers for defining public macro wrappers around DSL scope modules.

Summary

Functions

Import public macro-definition helpers.

Defines a block macro with start and finish calls.

Defines a macro that expands to a single call.

Expand variables in a quoted template with caller-provided AST bindings.

Functions

__using__(opts)

(macro)

Import public macro-definition helpers.

defblock(head, opts \\ [], list)

(macro)

Defines a block macro with start and finish calls.

defblock project(name, opts \ []) do
  start MyScope.start_project(name, opts)
  finish MyScope.finish_project()
end

Pass source: true to make a source variable available to start and finish expressions. The generated macro uses DSL.Source.escape_caller/1.

defdirective(head, list)

(macro)

Defines a macro that expands to a single call.

defdirective providers(providers) do
  MyScope.put_providers(providers)
end

expand_template(template, bindings)

@spec expand_template(
  Macro.t(),
  keyword(Macro.t())
) :: Macro.t()

Expand variables in a quoted template with caller-provided AST bindings.