def parse_block_text(column, rule, path, uniq_table)
_linenum = @linenum
_column = @column
indicator = scan(/[|>]/)
chomping = scan(/[-+]/)
num = scan(/\d+/)
indent = num ? column + num.to_i - 1 : nil
unless scan(/[ \t]*(.*?)(\#.*)?\r?\n/)
raise _syntax_error("Syntax Error (line break or comment are expected)", path)
end
s = group(1)
is_folded = false
while match?(/( *)(.*?)(\r?\n)/)
spaces = group(1)
text = group(2)
nl = group(3)
if indent.nil?
if spaces.length >= column
indent = spaces.length
elsif text.empty?
s << nl
scan(/.*?\n/)
next
else
@diagnostic = 'text indent in block text may be shorter than that of first line or specified column.'
break
end
else
if spaces.length < indent && !text.empty?
@diagnostic = 'text indent in block text may be shorter than that of first line or specified column.'
break
end
end
scan(/.*?\n/)
if indicator == '|'
s << spaces[indent..-1] if spaces.length >= indent
s << text << nl
else
if !text.empty? && spaces.length == indent
if s.sub!(/\r?\n((\r?\n)+)\z/, '\1')
nil
elsif is_folded
s.sub!(/\r?\n\z/, ' ')
end
is_folded = true
else
is_folded = false
s << spaces[indent..-1] if spaces.length > indent
end
s << text << nl
end
end
if chomping == '+'
nil
elsif chomping == '-'
s.sub!(/(\r?\n)+\z/, '')
else
s.sub!(/(\r?\n)(\r?\n)+\z/, '\1')
end
skip_spaces_and_comments()
val = s
return val
end