### Home Classes Methods

### In Files

- lib/math_ml/latex.rb

### Parent

StringScanner

### Methods

- #_check
- #_eos?
- #_scan
- #check
- #check_any
- #check_block
- #check_command
- #check_option
- #done
- #eos?
- #peek_command
- #scan
- #scan_any
- #scan_block
- #scan_command
- #scan_option
- #scan_space
- #skip_space_and

### Class/Module Index

Quicksearch

- MathML
- MathML::Align
- MathML::Element
- MathML::Error
- MathML::Fenced
- MathML::Frac
- MathML::Identifier
- MathML::LaTeX
- MathML::LaTeX::BlockNotClosed
- MathML::LaTeX::Builtin
- MathML::LaTeX::Builtin::Symbol
- MathML::LaTeX::BuiltinCommands
- MathML::LaTeX::BuiltinEnvironments
- MathML::LaTeX::BuiltinGroups
- MathML::LaTeX::BuiltinGroups::CircularReferenceEnvironment
- MathML::LaTeX::EndMismatchToBegin
- MathML::LaTeX::EnvironmentNotEnd
- MathML::LaTeX::Font
- MathML::LaTeX::Macro
- MathML::LaTeX::Macro::Command
- MathML::LaTeX::Macro::Environment
- MathML::LaTeX::NeedParameter
- MathML::LaTeX::NotEnvironment
- MathML::LaTeX::OptionNotClosed
- MathML::LaTeX::ParseError
- MathML::LaTeX::Parser
- MathML::LaTeX::Parser::CircularReferenceCommand
- MathML::LaTeX::RE
- MathML::LaTeX::Scanner
- MathML::Line
- MathML::Math
- MathML::None
- MathML::Number
- MathML::Operator
- MathML::Over
- MathML::Root
- MathML::Row
- MathML::Space
- MathML::Sqrt
- MathML::String
- MathML::SubSup
- MathML::Symbol
- MathML::Symbol::CharacterReference
- MathML::Symbol::EntityReference
- MathML::Table
- MathML::Td
- MathML::Text
- MathML::Tr
- MathML::Under
- MathML::Util
- MathML::Util::MathData
- MathML::Util::SimpleLaTeX
- MathML::Variant
- MathML::XMLElement
- String

No matching classes.

# MathML::LaTeX::Scanner

### Public Instance Methods

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

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

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

    # File lib/math_ml/latex.rb, line 110
    def check_any(remain_space=false)
            skip_space_and(true){scan_any(remain_space)}
    end

check_block() click to toggle source

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

check_command() click to toggle source

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

check_option() click to toggle source

    # File lib/math_ml/latex.rb, line 147
    def check_option
            skip_space_and(true){scan_option}
    end

done() click to toggle source

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

eos?() click to toggle source

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

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

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

scan(re) click to toggle source

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

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

    # 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

scan_block() click to toggle source

    # 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

scan_command() click to toggle source

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

scan_option() click to toggle source

    # 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

scan_space() click to toggle source

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

skip_space_and(check_mode) click to toggle source

    # File lib/math_ml/latex.rb, line 45
    def skip_space_and(check_mode)
            opos = pos
            scan_space
            r = yield
            self.pos = opos if check_mode || !r
            r
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.