jgm/CommonMark — pull request #204 by nwellnhof (2014-11-18 01:07:09+00:00)
Title: Unify block and inline nodes

This intrusive pull request unifies blocks and inlines into a single `struct cmark_node` which all live in a single tree structure. It also shuffles some code around in what I think is a more logical way. The biggest change is that inlines now get `prev`, `parent`, and `last_child` pointers. The rationale is that a usable tree manipulation API should allow to insert and remove inline nodes which would be hard without these changes. It also allows for a single interface to traverse and manipulate the parse tree without distinguishing between blocks and inlines. This should result in a cleaner API.

The most interesting commit is probably "Set prev, parent and last_child for inlines". I had to dig deep into innards of the inlines parser to get this to work and I think it has negligible impact on performance. On the downside, it makes some of the hairiest parts of the code even more hairier.

The changes also result in a larger memory footprint for inline nodes. But most of that can be reduced later.