@@ -416,11 +416,11 @@ def visit_tag(node)
416416 def continuation? ( node , child )
417417 return false if child . type != :silent_script
418418
419- case [ node . value [ :keyword ] , child . value [ :keyword ] ]
420- in [ "case" , "in" | "when" | "else" ]
421- true
422- in [ "if" | "unless" , "elsif" | "else" ]
423- true
419+ case node . value [ :keyword ]
420+ when "case"
421+ %w[ in when else ] . include? ( child . value [ :keyword ] )
422+ when "if" , "unless"
423+ %w[ elsif else ] . include? ( child . value [ :keyword ] )
424424 else
425425 false
426426 end
@@ -438,11 +438,12 @@ def escaped?(text)
438438 # Take a source string and attempt to parse it into a set of attributes
439439 # that can be used to format the source.
440440 def parse_attributes ( source )
441- case Ripper . sexp ( source )
442- in [ :program , [ [ :hash , *] , *] ] if parsed =
443- ::Haml ::AttributeParser . parse ( source )
441+ program = Ripper . sexp ( source )
442+ type = program && program [ 1 ] [ 0 ] [ 0 ]
443+
444+ if type == :hash && ( parsed = ::Haml ::AttributeParser . parse ( source ) )
444445 parsed . to_h { |key , value | [ key , parse_attributes ( value ) ] }
445- in [ :program , [ [ :string_literal , * ] , * ] ]
446+ elsif type == :string_literal
446447 SyntaxTree . parse ( source ) . statements . body [ 0 ]
447448 else
448449 LiteralHashValue . new ( source )
0 commit comments