mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00

The parser checks for incorrect 'else' nesting by tracking if/case/unless blocks in an internal stack. It was pushing to but never popping from this stack for 'unless' and 'case' blocks, leading to spurious syntax errors. Regression examples included.
45 lines
694 B
Text
45 lines
694 B
Text
%div
|
|
%h1 I can count!
|
|
- (1..20).each do |i|
|
|
= i
|
|
%h1 I know my ABCs!
|
|
%ul
|
|
- ('a'..'z').each do |i|
|
|
%li= i
|
|
%h1 I can catch errors!
|
|
- begin
|
|
- raise "foo"
|
|
- rescue RuntimeError => e
|
|
= "Oh no! \"#{e}\" happened!"
|
|
%p
|
|
"false" is:
|
|
- if false
|
|
= "true"
|
|
- else
|
|
= "false"
|
|
- if true
|
|
- 5.times do |i|
|
|
- if i % 2 == 1
|
|
Odd!
|
|
- else
|
|
Even!
|
|
- unless true
|
|
Testing else indent
|
|
- case 1
|
|
- when 2
|
|
Also testing else indent
|
|
- else
|
|
= "This can't happen!"
|
|
- 13 |
|
|
.foo
|
|
%strong foobar
|
|
- 5.times |
|
|
do |
|
|
|a| |
|
|
%strong= a
|
|
.test
|
|
- "foo |
|
|
bar |
|
|
baz" |
|
|
|
|
%p boom
|