Parsing TeX is definitely not for the faint-of-heart! You might try something like QuotedString('$', escQuote='$$') in pyparsing. (I've not poked at TeX or its ilk since the mid-80's so my TeXpertise is long rusted away.)
I know of two projects that have taken on the problem using pyparsing - one is the mathtext module in John Hunter's matplotlib, and Tim Arnold posted some questions on the subject a while back - try googling for "pyparsing tex" for further leads. -- Paul -- http://mail.python.org/mailman/listinfo/python-list