You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started working on Issue #615 recently and even submitted a pull request (#854) for it.
During the process, I realized that the root problem was something different; something definitely not addressed by my pull request.
I believe the root problem is that we are not parsing interpolations correctly.
Throughout the code, there are quite a few very similar blocks like the following:
p = find_first_in_interval< exactly<hash_lbrace> >(i, end_of_selector);
if (p) {
// accumulate the preceding segment if there is one
if (i < p) (*schema) << new (ctx.mem) String_Constant(pstate, Token(i, p, Position(0, 0)));
// find the end of the interpolant and parse it
const char* j = find_first_in_interval< exactly<rbrace> >(p, end_of_selector);
If I read the code correctly, the block is looking for the beginning of an interpolation, then it’s trying to seek to the end of it (seeking the closing right-brace).
But there could be many kinds of expressions between the two braces, including nested interpolations (my pull request was trying to fix that), quoted strings (with or without escaped characters), etc., etc.
The right way, I think, is that we should recursively parse whatever in-between the braces - like going back to the main Parser::parse() loop.
The question is: in our parser, do we have some mechanism that we can push any expressions onto a stack of some sort, then parse them recursively?
Please advise. Thanks!
The text was updated successfully, but these errors were encountered:
@mgreter are you thinking of parsing interpolations recursively? without recursion, we might end up chasing lots of edge cases and having boilerplate code...
Since interpolants can be nested, this is kind of the key point. I already merged some improvements in the prelexer and currently working on extracting more stuff from my WIP branch, which includes a lot more of these improvements, but there are also a lot of places where those need to be applied correctly.
I started working on Issue #615 recently and even submitted a pull request (#854) for it.
During the process, I realized that the root problem was something different; something definitely not addressed by my pull request.
I believe the root problem is that we are not parsing interpolations correctly.
Throughout the code, there are quite a few very similar blocks like the following:
If I read the code correctly, the block is looking for the beginning of an interpolation, then it’s trying to seek to the end of it (seeking the closing right-brace).
But there could be many kinds of expressions between the two braces, including nested interpolations (my pull request was trying to fix that), quoted strings (with or without escaped characters), etc., etc.
The right way, I think, is that we should recursively parse whatever in-between the braces - like going back to the main
Parser::parse()
loop.The question is: in our parser, do we have some mechanism that we can push any expressions onto a stack of some sort, then parse them recursively?
Please advise. Thanks!
The text was updated successfully, but these errors were encountered: