Actually it's quite simple. We parse from left to right. When we hit EOL, we return to the beginning of line and increase Y by one.
Blocks are parsed in the following way: when we get the beginning count of block opening characters, we move Y by one, loop right while whitespace, until we encounter ending count of block characters.
In transposed block, we just switch X and Y, it is easily done with pointers, and use the same code.
Not sure if that example helps. You can make any programming language hard to read without some basic formatting. The way I would write the sexpr would be:
(impl
(impl
p
(impl q r))
(impl
(impl p q)
(impl p r)))
It's clear when each section begins and ends and doesn't require complex parsing rules.
It is true that I plan a custom renderer with scripting support, to replace the HTML version. From the tests I performed by now, it can be smoother and faster than the current version. But it is yet to be seen how well would a substitution to HTML catch up with the current state of art CSS+HTML+JS.
At some moment I had a version with cached bitmaps that simply flew fast and smooth. But, since HTML has some serious issues with rendering to bitmap from js, I had to pick the slower version with native real time HTML rendering.
Blocks are parsed in the following way: when we get the beginning count of block opening characters, we move Y by one, loop right while whitespace, until we encounter ending count of block characters.
In transposed block, we just switch X and Y, it is easily done with pointers, and use the same code.