class Sass::Script::Parser

def square_list

def square_list
  start_pos = source_position
  return paren unless try_tok(:lsquare)
  without_stop_at do
    space_start_pos = source_position
    e = interpolation(inner: :or_expr)
    separator = nil
    if e
      elements = [e]
      while (e = interpolation(inner: :or_expr))
        elements << e
      end
      # If there's a comma after a space-separated list, it's actually a
      # space-separated list nested in a comma-separated list.
      if try_tok(:comma)
        e = if elements.length == 1
              elements.first
            else
              node(
                Sass::Script::Tree::ListLiteral.new(elements, separator: :space),
                space_start_pos)
            end
        elements = [e]
        while (e = space)
          elements << e
          break unless try_tok(:comma)
        end
        separator = :comma
      else
        separator = :space if elements.length > 1
      end
    else
      elements = []
    end
    assert_tok(:rsquare)
    end_pos = source_position
    node(Sass::Script::Tree::ListLiteral.new(elements, separator: separator, bracketed: true),
         start_pos, end_pos)
  end
end