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

Fix bad SyntaxError into CompileError

This commit is contained in:
Takashi Kokubun 2015-03-30 01:13:28 +09:00
parent a7834ccc55
commit e167703ba3
2 changed files with 9 additions and 1 deletions

View file

@ -11,6 +11,10 @@ module Hamlit
[:code, code]
end
def assert!(message)
raise CompileError.new(message)
end
def assert_scan!(scanner, regexp)
result = scanner.scan(regexp)
unless result

View file

@ -1,6 +1,10 @@
require 'hamlit/concerns/error'
module Hamlit
module Concerns
module Indentable
include Concerns::Error
EOF = -1
def reset_indent
@ -26,7 +30,7 @@ module Hamlit
width = line[/\A +/].to_s.length
return (width + 1) / 2 unless strict
raise SyntaxError if width.odd?
assert!('Expected to count even-width indent') if width.odd?
width / 2
end