Class: MaRuKu::In::Markdown::SpanLevelParser::CharSourceStrscan

### Home Classes Methods

### In Files

- lib/maruku/input/charsource.rb

### Parent

Object

### Methods

- ::new
- #consume_whitespace
- #cur_char
- #cur_chars
- #cur_chars_are
- #current_remaining_buffer
- #describe
- #ignore_char
- #ignore_chars
- #next_char
- #next_matches
- #read_regexp
- #shift_char

### Included Modules

- MaRuKu::In::Markdown::SpanLevelParser
- MaRuKu::Strings

### Class/Module Index

Quicksearch

- MaRuKu
- MaRuKu::Errors
- MaRuKu::Exception
- MaRuKu::Helpers
- MaRuKu::In
- MaRuKu::In::Markdown
- MaRuKu::In::Markdown::BlockLevelParser
- MaRuKu::In::Markdown::BlockLevelParser::BlockContext
- MaRuKu::In::Markdown::BlockLevelParser::LineSource
- MaRuKu::In::Markdown::SpanExtension
- MaRuKu::In::Markdown::SpanLevelParser
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceDebug
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceManual
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceStrscan
- MaRuKu::In::Markdown::SpanLevelParser::HTMLHelper
- MaRuKu::In::Markdown::SpanLevelParser::SpanContext
- MaRuKu::MDDocument
- MaRuKu::MDElement
- MaRuKu::Out
- MaRuKu::Out::HTML
- MaRuKu::Out::Latex
- MaRuKu::Out::Latex::LatexEntity
- MaRuKu::Out::Markdown
- MaRuKu::Section
- MaRuKu::Strings
- MaRuKu::Tests
- Array
- Hash
- Maruku
- Module
- NilClass
- Object
- String
- Textile2Signature

No matching classes.

# MaRuKu::In::Markdown::SpanLevelParser::CharSourceStrscan

a wrapper around StringScanner

### Public Class Methods

new(s, parent=nil) click to toggle source

    # File lib/maruku/input/charsource.rb, line 208
    def initialize(s, parent=nil)
            @s = StringScanner.new(s)
            @parent = parent
    end

### Public Instance Methods

consume_whitespace() click to toggle source

    # File lib/maruku/input/charsource.rb, line 264
    def consume_whitespace
            @s.scan(/\s+/)
            nil
    end

cur_char() click to toggle source

Return current char as a FixNum (or nil).

    # File lib/maruku/input/charsource.rb, line 214
    def cur_char
             @s.peek(1)[0]
    end

cur_chars(n) click to toggle source

Return the next n chars as a String.

    # File lib/maruku/input/charsource.rb, line 219
    def cur_chars(n);
            @s.peek(n)
    end

cur_chars_are(string) click to toggle source

    # File lib/maruku/input/charsource.rb, line 246
    def cur_chars_are(string)
            cur_chars(string.size) == string
    end

current_remaining_buffer() click to toggle source

    # File lib/maruku/input/charsource.rb, line 242
    def current_remaining_buffer
            @s.rest #nil #@buffer[@buffer_index, @buffer.size-@buffer_index]
    end

describe() click to toggle source

    # File lib/maruku/input/charsource.rb, line 269
    def describe
            describe_pos(@s.string, @s.pos)
    end

ignore_char() click to toggle source

    # File lib/maruku/input/charsource.rb, line 232
    def ignore_char
            @s.get_byte
            nil
    end

ignore_chars(n) click to toggle source

    # File lib/maruku/input/charsource.rb, line 237
    def ignore_chars(n)
            n.times do @s.get_byte end
            nil
    end

next_char() click to toggle source

Return the char after current char as a FixNum (or nil).

    # File lib/maruku/input/charsource.rb, line 224
    def next_char;
            @s.peek(2)[1]
    end

next_matches(r) click to toggle source

    # File lib/maruku/input/charsource.rb, line 250
    def next_matches(r)
            len = @s.match?(r)
            return !!len
    end

read_regexp(r) click to toggle source

    # File lib/maruku/input/charsource.rb, line 255
    def read_regexp(r)
            string = @s.scan(r)
            if string
                    return r.match(string)
            else
                    return nil
            end
    end

shift_char() click to toggle source

    # File lib/maruku/input/charsource.rb, line 228
    def shift_char
            (@s.get_byte)[0]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.