     end
   end
 
-  @doc """
-  Returns an empty string as initial buffer.
-  """
+  @doc false
   def init(_opts) do
     %{
       binary: [],

    {:__block__, [], Enum.reverse(dynamic)}
  end

  @doc """
  The default implementation simply concatenates text to the buffer.
  """
  def handle_text(state, text) do
    %{binary: binary} = state
    %{state | binary: [text | binary]}
  end

  @doc """
  Implements expressions according to the markers.

      <% Elixir expression - inline with output %>
      <%= Elixir expression - replace with result %>
      <%/ Elixir expression - raise EEx.SyntaxError, to be implemented by custom engines %>
      <%| Elixir expression - raise EEx.SyntaxError, to be implemented by custom engines %>

  All other markers are not implemented by this engine.
  """
  def handle_expr(state, "=", ast) do
    %{binary: binary, dynamic: dynamic, vars_count: vars_count} = state
    var = Macro.var(:"arg#{vars_count}", __MODULE__)

  @moduledoc ~S"""
  Basic EEx engine that ships with Elixir.

  An engine needs to implement all callbacks below.

  An engine may also `use EEx.Engine` to get the default behaviour
  but this is not advised. In such cases, if any of the callbacks
  are overridden, they must call `super()` to delegate to the
  underlying `EEx.Engine`.
  """

  @type state :: term

  @doc """
  Called at the beginning of every template.

  It must return the initial state.
  """
  @callback init(opts :: keyword) :: state

  @doc """
  Called at the end of every template.

  It must return Elixir's quoted expressions for the template.
  """
  @callback handle_body(state) :: Macro.t()

  @doc """
  Called for the text/static parts of a template.

  It must return the updated state.
  """
  @callback handle_text(state, text :: String.t()) :: state

  @doc """
  Called for the dynamic/code parts of a template.

  The marker is what follows exactly after `<%`. For example,
  `<% foo %>` has an empty marker, but `<%= foo %>` has `"="`
  as marker. The allowed markers so far are:

    * `""`
    * `"="`
    * `"/"`
    * `"|"`

  Markers `"/"` and `"|"` are only for use in custom EEx engines
  and are not implemented by default. Using them without an
  appropriate implementation raises `EEx.SyntaxError`.

  It must return the updated state.
  """
  @callback handle_expr(state, marker :: String.t(), expr :: Macro.t()) :: state

  @doc """
  Invoked at the beginning of every nesting.

  It must return a new state that is used only inside the nesting.
  Once the nesting terminates, the current `state` is resumed.
  """
  @callback handle_begin(state) :: state

  @doc """
  Invokes at the end of a nesting.

  It must return Elixir's quoted expressions for the nesting.
  """
  @callback handle_end(state) :: Macro.t()

  @doc false
