def hash_elements(buffer = '')
      value = proc do
        # Get the value associated to the current hash key
        if (exp = expression)
          buffer += exp[@value]
        else
          error :hash_elements
        end

        # If there is an hash_terminator ",", recursively gather the next
        # array element into the buffer
        if (terminator = accept_stripped :comma)
          accept_newline
          buffer += hash_elements terminator
        end
      end

      # Accept both shorthand and default ruby hash style. Following DRY
      # principles, a Proc is used to assign the value to the current key
      #
      # key:
      # :key =>
      if (symbol = accept_stripped :hash_symbol)
        buffer += symbol
        value[]
      elsif (exp = expression false)
        buffer += exp[@value]
        if (assign = accept_stripped :hash_assignment)
          buffer += assign
          value[]
        else
          error :hash_assignment
        end
      end

      # Array ended prematurely with a trailing comma, therefore the current
      # parsing process will stop
      error :hash_elements_terminator if buffer.strip[-1] == ','

      buffer
    end
def hash_elements(buffer = '')
      value = proc do
        # Get the value associated to the current hash key
        if (exp = expression)
          buffer += exp[@value]
        else
          error :hash_elements
        end

        # If there is an hash_terminator ",", recursively gather the next
        # array element into the buffer
        if (terminator = accept_stripped :comma)
          accept_newline
          buffer += hash_elements terminator
        end
      end

      # Accept both shorthand and default ruby hash style. Following DRY
      # principles, a Proc is used to assign the value to the current key
      #
      # key:
      # :key =>
      if (symbol = accept_stripped :hash_symbol)
        buffer += symbol
        value[]
      elsif (exp = expression false)
        buffer += exp[@value]
        if (assign = accept_stripped :hash_assignment)
          buffer += assign
          value[]
        else
          error :hash_assignment
        end
      end

      # Array ended prematurely with a trailing comma, therefore the current
      # parsing process will stop
      error :hash_elements_terminator if buffer.strip[-1] == ','

      buffer
    end
Check if it's possible to parse a ruby hash literal. First, try to see
 if the next sequence is a hash_open token: "{", and if it is, then a
 hash_close: "}" token is required next

 { hash_elements }

 Recursively gather expression attributions separated by a comma and add
 them to the expression buffer

 key1: experssion1, key2 => experssion2, :key3 => experssion3

 @param buffer [String] Accumulator for the hash elements