-
Notifications
You must be signed in to change notification settings - Fork 60
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
Unmatched BRACE_OPEN error when using ) in blocks #26
Comments
Yep, definitely a bug. Thanks for reporting it so clearly! I'll try to get to it tonight or tomorrow. In the meantime, you can prefix So your example could be:
|
I was able to make simpler test cases:
and
In both cases, that content should not be counted as ending the expression or block. Using
Since vash does not have a concept of "within a string" when in code mode. |
Thanks for replying that fast :-)! Great to have this workaround at hand! Thanks a lot! |
Hi, will this also fix an error I am having where there is an unclosed parenthesis in a javascript comment in a view? For instance, this view:
this will make the engine crash. If I close the parenthesis on the comment line, it works fine. |
Yes, if you prefix it with a |
My first thought was that comments were ignored in terms of matching document structure, like parenthesis and braces. Next time I'll surely spot that kind of error faster though. Shouldn't they (comments) be ignored when checking document structure integrity? |
Absolutely, and the next version of vash will! But the current version doesn't treat comments any differently, and unfortunately I made a bad decision on how to handle characters like |
Oh then I misunderstood your first answer, I thought the final solution was to prefix those chars (in comments too). Thanks for the follow up and for the module! |
Hi, It seems there still is an issue with text parentheses in code blocks. For example, this works: @if (model.flash_error) {
<p class="text-error">@model.flash_error happy face :-@)</p>
} But switching ) with (: @if (model.flash_error) {
<p class="text-error">@model.flash_error sad face :-@(</p>
} returns: |
Hey @v3rt1go! Have you tried removing the |
Hi! Thanks for coming back so fast. @if (model.flash_error) {
<p class="text-error">@model.flash_error sad face :-(</p>
} Output: |
@v3rt1go I'm definitely not getting that in the playground: http://codepen.io/anon/pen/nlxIJ What version of vash are you using? Is there more in the template than what you're sharing here? |
Hey @kirbysayshi I'm using vash 0.7.12-1 (installed from npm). I've played with what you've set up on codepen and indeed I cannot reproduce, however it's still reproducible on my end. I'm using VS2013 with Node Js tools for VS on the project, though it's a bit far fetched I'm trying to port the whole project in WebStorm or sublime to see if it's a freaky character encoding issue ... though it's far fetched. |
@v3rt1go it appears that once you add in the surrounding block the error manifests. The issue is also present in examples such as:
and
Thanks for sending the surrounding code, that helped. So yes, this is the same issue, and I don't have a great workaround at this time. Although one option is to use the reverse frowny face: |
@v3rt1go example: http://codepen.io/anon/pen/tlfEa I'm sorry, I know this is inadequate, but I don't want you to have to wait for a fix. |
This is one of few bugs we had found when using vash (the other a similar issue with xml style self terminating elements, such as When we looked into the code base we saw that parsing was doing a lot of balancing of braces/parenthesis and seemed like it could be quite a task to fix (although I'm sure you'll know better regarding this). One work around for this which is relatively clean is to balance the parenthesis out using comments, so your code would become:
Thanks. |
@meandmycode spectacular! And you're absolutely right: vash takes shortcuts that a parser should not really take by balancing tokens without context (like "is in string" or "is within markup tags"). I believe that it's definitely a non-trivial fix, although perhaps possible. I'd started to rewrite vash to be able to handle these cases on the stated branch, https://github.com/kirbysayshi/vash/tree/ksh/stated/experiments/stated, but got stalled due to other commitments. |
This is fixed as of >= 0.8.0! |
Supposed you have this file as
layout.vash
and this file as
index.vash
:Then rendering of
index.vash
crashes with the following error message:The problem is the
)
character in the text that shall be printed out. It does not matter whether it's a smiley or something else - as soon as there is a closing brace, the template can not be rendered.How to solve this?
PS: Of course, a similar problem happens when using the
}
character.The text was updated successfully, but these errors were encountered: