StringScanner
# File lib/math_ml/latex.rb, line 59 59: def check(re) 60: skip_space_and(true){_check(re)} 61: end
# File lib/math_ml/latex.rb, line 110 110: def check_any(remain_space=false) 111: skip_space_and(true){scan_any(remain_space)} 112: end
# File lib/math_ml/latex.rb, line 83 83: def check_block 84: skip_space_and(true){scan_block} 85: end
# File lib/math_ml/latex.rb, line 71 71: def check_command 72: check(RE::COMMANDS) 73: end
# File lib/math_ml/latex.rb, line 147 147: def check_option 148: skip_space_and(true){scan_option} 149: end
# File lib/math_ml/latex.rb, line 37 37: def done 38: self.string[0, pos] 39: end
# File lib/math_ml/latex.rb, line 67 67: def eos? 68: _eos? || _check(/#{RE::SPACE}+\z/) 69: end
# File lib/math_ml/latex.rb, line 79 79: def peek_command 80: check_command ? self[1] : nil 81: end
# File lib/math_ml/latex.rb, line 63 63: def scan(re) 64: skip_space_and(false){_scan(re)} 65: end
# File lib/math_ml/latex.rb, line 114 114: def scan_any(remain_space=false) 115: p = pos 116: scan_space 117: r = remain_space ? matched.to_s : "" 118: case 119: when s = scan_block 120: when s = scan_command 121: else 122: unless _scan(/./) || remain_space 123: self.pos = p 124: return nil 125: end 126: s = matched.to_s 127: end 128: r << s 129: end
# File lib/math_ml/latex.rb, line 87 87: def scan_block 88: return nil unless scan(/\{/) 89: block = "{" 90: bpos = pos-1 91: nest = 1 92: while _scan(/(#{MBEC}*?)([\{\}])/) 93: block << matched 94: case self[2] 95: when "{" 96: nest+=1 97: when "}" 98: nest-=1 99: break if nest==0 100: end 101: end 102: if nest>0 103: self.pos = bpos 104: raise BlockNotClosed 105: end 106: self.pos = bpos 107: _scan(/\A\{(#{Regexp.escape(block[RE::BLOCK, 1].to_s)})\}/) 108: end
# File lib/math_ml/latex.rb, line 75 75: def scan_command 76: scan(RE::COMMANDS) 77: end
# File lib/math_ml/latex.rb, line 131 131: def scan_option 132: return nil unless scan(/\[/) 133: opt = "[" 134: p = pos-1 135: until (s=scan_any(true)) =~ /\A#{RE::SPACE}*\]\z/ 136: opt << s 137: if eos? 138: self.pos = p 139: raise OptionNotClosed 140: end 141: end 142: opt << s 143: self.pos = p 144: _scan(/\A\[(#{Regexp.escape(opt[RE::OPTION, 1].to_s)})\]/) 145: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.