Steven - Thanks for giving pyparsing a try! To see whether your input text consumes the whole string, add a StringEnd() element to the end of your BNF. Then if there is more text after the parsed text, parseString will throw a ParseException.
I notice you call leaveWhitespace on several of your parse elements, so you may have to rstrip() the input text before calling parseString. I am curious whether leaveWhitespace is really necessary for your grammar. If it is, you can usually just call leaveWhitespace on the root element, and this will propagate to all the sub elements. Lastly, you may get caught up with operator precedence, I think your node assignment statement may need to change from node << start + (branch_node | leaf_node) + end to node << (start + (branch_node | leaf_node) + end) HTH, -- Paul -- http://mail.python.org/mailman/listinfo/python-list