Fix hanlding of parse trees in loop.

Reset $BbCodesTree in a loop, and ensure _tagBBCodeFromTree validates it is working on a valid tree.