-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grammar execution oddity/bug #11
Comments
The formatting in your message seems broken, and without meaningful indent I can't tell what the problem is. This is the intended behavior:
|
I see the broken formatting now. I've edited that comment so that it renders properly. What you're describing is what I was expecting, but not what I was seeing. Let me try to give just a couple of grammar sections, and describe what I was seeing:
When the 'outside' grammar is invoked, and pattern4 is matched, Gelatin will output "i am before" and begin using the 'inside' grammar. When the inside grammar reaches pattern2, it returns as expected to the outside() grammar, but not to continuing to execute the rest of the statements under 'match pattern4:'. What I observe it doing is jumping back to the top of the outside() grammar (as if there were a "do.next()" immediately after the call to inside()) and start parsing again. The do.say('i am after') and the do.return() at the bottom of 'match pattern4:' are never executed. Does that help? |
There appears to be a bug or quirk about how functions are executed in a grammar match. Given the following Gelatin snippet:
When "bareword" is matched, everything goes as expected, until the addelement() grammar returns. At the time it returns, the next thing that happens is NOT the call to do.return(), but that the doset() grammar loops and starts again.
Context: I'm trying to parse a text snippet the following:
Into the following XML:
The number of parameters after "set dhcp-relay-ip ..." can be arbitrary.
I have a gelatin file that is close to what I want:
In looking through the source, it looks like "do.return()" can take a numeric parameter to indicate how many levels back to go. However, using "do.return(2)" in the addelement() grammar doesn't seem to work either.
Thoughts?
The text was updated successfully, but these errors were encountered: