Hi list !
From the tests provided by Jason in his treetop experiment I started
to get the feeling that it can be very hard to write a token based
parser for textile since sometimes you need to know all the characters
of the current line to know if “**” actually start a bold sentence.
For example:
This **is not a bold sentence, even if you would think it is, it’s not
**. Believe me.
I had a look at the original implementation of textile in PHP and they
actually run tons of very complicated regexps. This is an extract to
parse inline elements (bold, em, …): gist:131486 · GitHub.
All this to say that I think I will abort my “move forward” parser
solution and will try another route: the “split” parser:
- split text into paragraphs/tables
- split paragraphs into inline elements (loop until no more split)
- split inline elements into links, etc
- continue spliting and replacing
This is the fastest way I can imagine to parse elegantly something like
textile.
I’ll let you know when I have a prototype…
Gaspard
PS: forget about my other message on word processing, I actually did
not understand that these specs were only related to some internal
word parser.