Backport "Ignore ending $
when looking at end marker names" to 3.3 LTS
#337
+23
−3
$
when looking at end marker names" to 3.3 LTS
#337