def resolve_lexically(resolver, val, ctx)
      case val
      when Hash
        new = {}

        val.each do |k, v|
          new[k] = resolve_lexically(resolver, v, [val] + ctx)
        end

        new
      when Array
        val.collect do |v|
          resolve_lexically(resolver, v, ctx)
        end
      when String
        val.gsub(/\$\{([^\}]+)\}/) do
          resolve_symbol(resolver, $1, ctx)
        end
      else
        val
      end
    end
def resolve_lexically(resolver, val, ctx)
      case val
      when Hash
        new = {}

        val.each do |k, v|
          new[k] = resolve_lexically(resolver, v, [val] + ctx)
        end

        new
      when Array
        val.collect do |v|
          resolve_lexically(resolver, v, ctx)
        end
      when String
        val.gsub(/\$\{([^\}]+)\}/) do
          resolve_symbol(resolver, $1, ctx)
        end
      else
        val
      end
    end
resolve symbols, with hashes introducing new lexical symbols