# File lib/math_ml/latex.rb, line 87 def scan_block return nil unless scan(/\{/) block = "{" bpos = pos-1 nest = 1 while _scan(/(#{MBEC}*?)([\{\}])/) block << matched case self[2] when "{" nest+=1 when "}" nest-=1 break if nest==0 end end if nest>0 self.pos = bpos raise BlockNotClosed end self.pos = bpos _scan(/\A\{(#{Regexp.escape(block[RE::BLOCK, 1].to_s)})\}/) end