@@ -197,7 +197,7 @@ module Interscript
197197 def convert_metadata_block
198198 # Find the opening brace and consume until matching close, transforming
199199 # `key: value` -> `key value` and `description: |` / `notes:` heredocs.
200- return unless @scanner . scan ( /\s *\{ / )
200+ return unless @scanner . scan ( /[ \t ] *\{ / )
201201
202202 @out << " {"
203203 depth = 1
@@ -332,9 +332,9 @@ module Interscript
332332 @out << "\n #{ indent } #{ field } { "
333333 convert_indented_block_until_dedent ( indent )
334334 @out << " }"
335+ elsif @scanner . scan ( /(?:\A |\n )([ \t ]+)([A-Za-z_][\w ]*)[ \t ]*:[ \t ]*/ )
335336 # key: value -> key value, only when the key is at the start of a
336- # (indented) line. Use [ \t] instead of \s to avoid eating newlines
337- # (which would merge `key:\n next:` into `key next:`).
337+ # (indented) line. Use [ \t] instead of \s to avoid eating newlines.
338338 @out << "\n #{ @scanner [ 1 ] } #{ @scanner [ 2 ] } "
339339 elsif @scanner . scan ( /"/ )
340340 @out << '"'
@@ -389,9 +389,8 @@ module Interscript
389389 # Hit the enclosing metadata `}` (possibly after blank lines).
390390 return
391391 elsif @scanner . scan ( /\n [ \t ]*\n / )
392- # Blank line(s) between items — preserve one newline. Do NOT
393- # consume the indent of the next item; the next-item regexes
394- # require the indent prefix.
392+ # Blank line(s) — preserve one newline. Do NOT consume the
393+ # indent of the next item.
395394 @out << "\n "
396395 elsif @scanner . scan ( /\n ([ \t ]+)-[ \t ]*\| [ \t ]*\n / )
397396 # `|` heredoc form
@@ -487,7 +486,7 @@ module Interscript
487486 end
488487
489488 def convert_tests_block
490- return unless @scanner . scan ( /\s *\{ / )
489+ return unless @scanner . scan ( /[ \t ] *\{ / )
491490 @out << " {"
492491 depth = 1
493492 until @scanner . eos? || depth == 0
@@ -519,7 +518,7 @@ module Interscript
519518 end
520519
521520 def convert_aliases_block
522- return unless @scanner . scan ( /\s *\{ / )
521+ return unless @scanner . scan ( /[ \t ] *\{ / )
523522 @out << " {"
524523 depth = 1
525524 until @scanner . eos? || depth == 0
@@ -588,7 +587,7 @@ module Interscript
588587 # `stage(translit) {` becomes `stage translit {`.
589588 if @scanner . scan ( /\s *\( ([A-Za-z_]\w *)\) \s *\{ / )
590589 @out << " #{ @scanner [ 1 ] } {"
591- elsif @scanner . scan ( /\s *\{ / )
590+ elsif @scanner . scan ( /[ \t ] *\{ / )
592591 @out << " main {"
593592 elsif @scanner . scan ( /\s +([A-Za-z_]\w *)\s *\{ / )
594593 @out << " #{ @scanner [ 1 ] } {"
0 commit comments