I had tried using the tautologistics node-htmlparser, which handles javascript fine, but it chokes on php tags. I only need to parse the html and the php tags. Not within the php tags themselves. Is there an existing library that can do this?
Here are some examples that it should handle:
<span id="<?="1"?>" <?php print \'class="2"\'?>><?php print "3"?></span>
<p><?php print "?>";?></p>
Ideally it would produce an abstract syntax tree of html and php nodes. But I would not need the code inside the php tags to also be parsed into a php AST.
Edit: A tokenizer that does not go on to build an AST would also suffice.