StringScanner
# File lib/math_ml/latex.rb, line 59 def check(re) skip_space_and(true){_check(re)} end
# File lib/math_ml/latex.rb, line 110 def check_any(remain_space=false) skip_space_and(true){scan_any(remain_space)} end
# File lib/math_ml/latex.rb, line 83 def check_block skip_space_and(true){scan_block} end
# File lib/math_ml/latex.rb, line 71 def check_command check(RE::COMMANDS) end
# File lib/math_ml/latex.rb, line 147 def check_option skip_space_and(true){scan_option} end
# File lib/math_ml/latex.rb, line 67 def eos? _eos? || _check(/#{RE::SPACE}+\z/) end
# File lib/math_ml/latex.rb, line 79 def peek_command check_command ? self[1] : nil end
# File lib/math_ml/latex.rb, line 63 def scan(re) skip_space_and(false){_scan(re)} end
# File lib/math_ml/latex.rb, line 114 def scan_any(remain_space=false) p = pos scan_space r = remain_space ? matched.to_s : "" case when s = scan_block when s = scan_command else unless _scan(/./) || remain_space self.pos = p return nil end s = matched.to_s end r << s end
# 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
# File lib/math_ml/latex.rb, line 75 def scan_command scan(RE::COMMANDS) end
# File lib/math_ml/latex.rb, line 131 def scan_option return nil unless scan(/\[/) opt = "[" p = pos-1 until (s=scan_any(true)) =~ /\A#{RE::SPACE}*\]\z/ opt << s if eos? self.pos = p raise OptionNotClosed end end opt << s self.pos = p _scan(/\A\[(#{Regexp.escape(opt[RE::OPTION, 1].to_s)})\]/) end
Generated with the Darkfish Rdoc Generator 2.