Does Simeon use a known idiom/metaphor in his blessing, as a "Sympathetic Prophecy": that Mary's own Soul would be "Pierced" by the Agony of Grief?
Or, does the Prophecy regarding Mary indicate that at some point, even she would be held accountable and convicted of some "secret intent of her heart"?
Note: The actual question is regarding a textual basis for the metaphor -- which this response does not entirely answer.
Regardless if (A.) the Prophecy is Sympathetic towards Mary, (B.) or is actually a prophecy that even Mary would be convicted --
At the very least -- the phrase, "
and also you-r own soul`" indicates the "Unconditional and Impartial" nature of that purpose.
Perhaps in Mary's case, Grief would be the mechanism to examine the intents of her heart; or like Peter, perhaps she too would stumble at some point.
But regardless if Mary would become "guilty minded" in some way, or whether or not she faithfully maintained "perfect intent" -- the text suggests that even she would not be exempt from examination.
The Context and Idiomatic Use in the New Testament
This context is pervasive of metaphors that clearly indicate judgment, and examination.
At first glance, the metaphor "Sword Piercing the Soul" is consistent with the purpose to reveal the "Hidden thoughts and intents of the heart".
Outside of this metaphor, "Grief" is not within this context, nor a foreshadowing of Jesus' death.
Rather, it is used in the context of impartial justice, to demonstrate the "Sword revealing the deepest secrets of the heart.
Confirmation in the New Testament:
Hebrews 4:12, NASB - For the word of God is living and active and sharper than any two-edged sword, and piercing, [διϊκνούμενος, odd Greek word] as far as the division of soul and spirit, of both joints and marrow, and able to judge the thoughts and intentions of the heart.
Note, Limitation: This is not representative of Greek or Semitic texts, and is only one example from the New Testament -- but perhaps sufficient.
The Text - Luke 2:34-35
Luke 2:34, NASB - And Simeon blessed them and said to Mary His mother, “Behold, this Child is appointed for the fall and rise1 of many in Israel, and for a sign to be opposed2—
Luke 2:35, NASB - and a sword3, will pierce4 even your own soul5—to the end that thoughts6 from many hearts7, may be revealed8.”
Luke 2:34, Byz - Καὶ εὐλόγησεν αὐτοὺς Συμεών, καὶ εἴπεν πρὸς Μαριὰμ τὴν μητέρα αὐτοῦ, Ἰδού, οὗτοςκεῖται εἰς πτῶσιν καὶ ἀνάστασιν1* πολλῶν ἐν τῷ Ἰσραήλ, καὶ εἰς σημεῖον ἀντιλεγόμενον2·
Luke 2:35, Byz - καὶ σοῦ δὲ αὐτῆς τὴν ψυχὴν5 διελεύσεται4 ῥομφαία3· ὅπως ἂν ἀποκαλυφθῶσιν8 ἐκ πολλῶν καρδιῶν7 διαλογισμοί6.
Literary Exhaustive Searches for this Metaphor
Lexemes & Lemmas for Exhaustive Searches, (just Greek):
- πτῶσιν καὶ ἀνάστασιν: Should this connote a political sense, and insurrections?
- σημεῖον ἀντιλεγόμενον: Should this be interpreted to connote a "Courtroom Sense" -- Evidence that will be Refuted.
- ῥομφαία, From: ῥομφαία - "Sword"
- διελεύσεται, From: διέρχομαι - "Inquiries, Reasonings"
- ψυχὴν, Lemma: ψυχή - "Soul"
- διαλογισμοί, From: διαλογισμός - "To go through"
- καρδιῶν, From: καρδιόω, καρδία, or καρδιάω - "Heart"
- ἀποκαλυφθῶσιν, From: ἀποκαλύπτω - "To Reveal"
Falsification - Untrue if the Metaphors Exist to Indicate Grief
This limited context suggests that the metaphor: "Pierce your own Soul" indicates an examination of thoughts and intents of the heart.
However, this would be proven false and "Grief" could be inferred -- if there are other texts where this metaphor is used to portray Grief.
As an observation: Matthew 2's account of Herod's Massacre of the Innocents does not apply the "Soul Pierced" metaphor, but is extremely analogous in concept.
... The original question is in hope of finding any basis for that Metaphor ...