Semantics can be seen as the face value of a text, as in what the text, if taken literally, would mean.
Pragmatics however, can be seen as the "hidden meaning" to what a text is saying. Sarcasm is seen as a form of pragmatics.
Lexis can also be a contributing factor as to how something can be interpreted and whether the semantic of pragmatic meaning of a text should be the dominant reading.