Open thiloplanz opened 12 years ago
I'm able to get a switch statement out of Eco when I remove when
from the dedent regular expression in scanner.coffee
, then create a template that expresses a switch statement on a single line, with no text between the switch
and when
statements.
There would have to be logic added to the scanner or preprocessors that turns off text gathering while in a switch. The first when
would have to not dedent.
Picking at this. It's not pretty. Because when
is in the dedent regex, I imagine that supporting switch
is desired, but not there yet. I can implement it if is desired, or create an implementation and @sstephenson can decide if it is worth adding the clutter to scanner.
An example implementation can be found in this branch.
https://github.com/bigeasy/eco/commit/337c9e12a8d0c2b312f912875b6b8f28033cebbf
Any progress on this? Is no one else interested in switch statements?
I am. Having switch
available in eco would be nice!
It seems that you cannot have a Coffeescript switch statement in an eco template:
http://stackoverflow.com/questions/8920981/can-i-use-a-coffeescript-switch-block-in-eco
Or if you can, it is not obvious how.