Le 2008-05-13 à 10:02, John MacFarlane a écrit :

No, PEG can't do this. But there is a different approach that works
(described in my earlier email).

You're right, and I'm quite familiar with this approach for parsing nested blocks as it is what Markdown.pl and PHP Markdown do. I may switch back to that solution if problems arise with the current approach or if it proves to be more useful.

By not choosing a grammar early, I'm less constrained about what I can do in the spec, and I think that's desirable at this early stage.


By the way: if I understand it correctly, your description of "Code
block" would parse the following as two code blocks, not one code block
containing a blank line:

   some code

   more code

(Note: there is no tab on the middle line.)  I don't think that's the
desired behavior.

Indeed. Fixed, but please read the new thread about the subject.


Here's the markdown-peg version (and remember, this is "runnable"):

verbatim <- newRule $
  many1 (doesNotMatch blankline ->> indentedLine) <++>
  (many (many1 (optional indent ->> blankline) <++>
many1 (doesNotMatch blankline ->> indentedLine)) ## concat) <<-
  many blankline ## Verbatim . concat

And I was under the impression that you had given me a nearly complete cheatsheet of the PEG grammar in that previous email. What does $, - >>, <++>, and ## mean?


Michel Fortin
[EMAIL PROTECTED]
http://michelf.com/


_______________________________________________
Markdown-Discuss mailing list
[email protected]
http://six.pairlist.net/mailman/listinfo/markdown-discuss

Reply via email to