Replies: 1 comment
-
I recently published a post about nested TLDRHere's a minimalistic/naive set of pest configurations that should allow for nested blocks of code begin/end tags that may, or may not, contain raw text too.
Example inputouter before
\begin{foo}
foo before
\begin{bar}
inner bar
\end{bar}
foo after
\end{foo}
outer after Parser result
Check the previously linked post for line-by-line explanations of, what I currently understand, of Pest's behaviors. And one warning regarding the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
First of all, thanks a lot for the work on Pest, it's a pleasure to work with!
I'm relatively new to writing PEGs, and I'm encountering a hurdle in parsing nested blocks.
Specifically, I would like to parse ( a small, defined subset of) LaTeX, and I'm having an issue at properly parsing nested
\begin{}
and\end{}
pairs:The expected parse tree would be something along the lines of:
But what I get instead is the second
\begin{quote}
block gets parsed as a command statement, rather than as a block statement:Here's the grammar:
I'm guessing it has something to do with PUSH/PEEK. When I remove them, only the inner block gets parsed as an environment, the outer one is parsed as a control statement.
Could someone please point me towards what I'm doing wrong?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions