canjs / can-compile

Compile CanJS Mustache and EJS views for lightning fast production apps
http://daffl.github.com/can-compile
MIT License
35 stars 15 forks source link

Break and continue statements are considered illegal #6

Closed DaQuirm closed 11 years ago

DaQuirm commented 11 years ago

Using break and continue statements in templates produces the following error upon compilation:

Fatal error: Illegal break statement

Example:

<% while(true) { %>
    <li>item</li>
    <% if (true) { %>
        <p>end</p>
        <% break; %>
    <% } %>
<% } %>
daffl commented 11 years ago

This should also be a CanJS problem then. Could you try creating a Fiddle with an EJS template that breaks?

DaQuirm commented 11 years ago

Yes, I got the same error message: http://jsfiddle.net/qYdwR/908/ I wonder why CanJS EJS doesn't support these statements. I'm using Steal.js and all such templates compile alright... In any case, I should probably create a CanJS issue, right?

daffl commented 11 years ago

I saw your forum post. It will probably help to create a CanJS issue as well to better keep track of it. Closing this issue though as any fix will make it automatically into can-compile (at least 0.3.0).