-
Notifications
You must be signed in to change notification settings - Fork 123
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
Cicero parse can't handle missing conditional at end of contract and beginning of line. #554
Comments
Thanks for the report. @jeromesimeon has a major project underway reimplementing the parsing stack — so we will retest that there. |
Thanks for the bug report @lambdafu. With the old parser the whitespace handling is a bit ad hoc, so I'm not sure how I would go at fixing it. With the new parser I think there is a clear answer to your question: the issue is that this template:
has always a soft break after While the corresponding sample when
which will never have a soft break. I think the clean way to do this is to place that soft break inside the conditional block like this:
Which now cleanly parses for Here is a run on the current development branch:
Does that make sense? |
The corresponding fixes supporting the examples above is now in Cicero version |
Thanks! |
Describe the bug
If the template grammar has a conditional at the very end of the contract, in its own line, the
cicero parse
command fails to parse the contract if the optional part is missing.To Reproduce
Grammar:
Model:
o Boolean flag
, sample.md:Hello
Output of cicero parse is:
Expected behavior
A data.json that has
{ "flag": false }
.It works if I put another static text after the conditional, so I think the parser gets stuck because it does not terminate the pending conditional at the EOF marker.
Comment
I like Markdown for this application, but this reminds me of very bad experiences I had parsing an extended Markdown in a product I worked on. The above bug is something that a fuzzer could find very quickly, so maybe consider that. Good luck, you'll need it! 🦸
The text was updated successfully, but these errors were encountered: