# class MathML::LaTeX::Scanner

### Public Instance Methods

_check(re)
Alias for: check
_eos?()
Alias for: eos?
_scan(re)
Alias for: scan
check(re) click to toggle source

       # File lib/math_ml/latex.rb
    59 def check(re)
    60   skip_space_and(true) { _check(re) }
    61 end

Also aliased as: _check
check_any(remain_space = false) click to toggle source

        # File lib/math_ml/latex.rb
    111 def check_any(remain_space = false)
    112   skip_space_and(true) { scan_any(remain_space) }
    113 end

check_block() click to toggle source

       # File lib/math_ml/latex.rb
    83 def check_block
    84   skip_space_and(true) { scan_block }
    85 end

check_command() click to toggle source

       # File lib/math_ml/latex.rb
    71 def check_command
    72   check(RE::COMMANDS)
    73 end

check_option() click to toggle source

        # File lib/math_ml/latex.rb
    149 def check_option
    150   skip_space_and(true) { scan_option }
    151 end

done() click to toggle source

       # File lib/math_ml/latex.rb
    37 def done
    38   string[0, pos]
    39 end

eos?() click to toggle source

       # File lib/math_ml/latex.rb
    67 def eos?
    68   _eos? || _check(/#{RE::SPACE}+\z/)
    69 end

Also aliased as: _eos?
peek_command() click to toggle source

       # File lib/math_ml/latex.rb
    79 def peek_command
    80   check_command ? self[1] : nil
    81 end

scan(re) click to toggle source

       # File lib/math_ml/latex.rb
    63 def scan(re)
    64   skip_space_and(false) { _scan(re) }
    65 end

Also aliased as: _scan
scan_any(remain_space = false) click to toggle source

        # File lib/math_ml/latex.rb
    115 def scan_any(remain_space = false)
    116   p = pos
    117   scan_space
    118   r = remain_space ? matched.to_s : ''
    119   case
    120   when s = scan_block
    121   when s = scan_command
    122   else
    123     unless _scan(/./) || remain_space
    124       self.pos = p
    125       return nil
    126     end
    127     s = matched.to_s
    128   end
    129   r + s
    130 end

scan_block() click to toggle source

        # File lib/math_ml/latex.rb
     87 def scan_block
     88   return nil unless scan(/\{/)
     89
     90   block = '{'
     91   bpos = pos - 1
     92   nest = 1
     93   while _scan(/(#{MBEC}*?)([{}])/)
     94     block << matched
     95     case self[2]
     96     when '{'
     97       nest += 1
     98     when '}'
     99       nest -= 1
    100       break if nest == 0
    101     end
    102   end
    103   if nest > 0
    104     self.pos = bpos
    105     raise BlockNotClosed
    106   end
    107   self.pos = bpos
    108   _scan(/\A\{(#{Regexp.escape(block[RE::BLOCK, 1].to_s)})\}/)
    109 end

scan_command() click to toggle source

       # File lib/math_ml/latex.rb
    75 def scan_command
    76   scan(RE::COMMANDS)
    77 end

scan_option() click to toggle source

        # File lib/math_ml/latex.rb
    132 def scan_option
    133   return nil unless scan(/\[/)
    134
    135   opt = '['
    136   p = pos - 1
    137   until (s = scan_any(true)) =~ /\A#{RE::SPACE}*\]\z/
    138     opt << s
    139     if eos?
    140       self.pos = p
    141       raise OptionNotClosed
    142     end
    143   end
    144   opt << s
    145   self.pos = p
    146   _scan(/\A\[(#{Regexp.escape(opt[RE::OPTION, 1].to_s)})\]/)
    147 end

scan_space() click to toggle source

       # File lib/math_ml/latex.rb
    41 def scan_space
    42   _scan(/#{RE::SPACE}+/)
    43 end

skip_space_and(check_mode) { || ... } click to toggle source

       # File lib/math_ml/latex.rb
    45 def skip_space_and(check_mode)
    46   opos = pos
    47   scan_space
    48   r = yield
    49   self.pos = opos if check_mode || !r
    50   r
    51 end