I had a dream that I nearly got eaten by a shark and was stranded on a rock and couldn't escape.
Sharks are generally a sign of danger or threat. Perhaps you should ask yourself what you feel threatened by right now in your waking life.
It could also be symbolic of your emotions- perhaps you are afraid to look deeper into your feelings and where they have originated from.
You might recognise a certain aggressiveness or impulsiveness in yourself that you need to have more control over as others may be threatened by your tunnel vision style of approach.
If the shark tried to attack you then maybe you feel that someone is attacking you or trying to take something away from you in your waking life.
If you saw a number of sharks in the water then it's possible that you should not trust anyone around you right now. The good thing is that you can see them for what they are.
As you were being pursued by the shark in your dream this could represent a danger you've put yourself in by disturbing someone or something in some way- perhaps in their home or natural surroundings.
As you were still alive in the dream even if you were stranded- this could be telling that you try your hardest to escape or get over danger. It may be that you see an enemy making their way towards you-someone you're trying to stay clear of.
On the flip side, if you could see no way out, this could be mimicing how you feel about a situation you are in right now.
As the shark didn't eat you, you might find that you are able to get out of a difficult situation in the near future or have recently. It could also act as a warning to you not to hurt others.