Methods
Included Modules
Attributes
[R] machine
[RW] mode
[RW] offset
[R] stack
[R] text
[R] tkstack
Public Class methods
new( text, machine )
# File lib/facets/more/stateparser.rb, line 222
  def initialize( text, machine )
    @text = text.dup.freeze
    @machine = machine

    @offset = 0
    @stack = []
    @tkstack = []
    @current = {}
    @mode = nil
    #@info = OpenStruct.new
  end
Public Instance methods
clear_current()
# File lib/facets/more/stateparser.rb, line 272
  def clear_current
    @mode = nil
    @current = {}
  end
current_begins()
# File lib/facets/more/stateparser.rb, line 278
  def current_begins ; @current[:begins] ; end
current_ends()
# File lib/facets/more/stateparser.rb, line 279
  def current_ends   ; @current[:ends]   ; end
current_info()
# File lib/facets/more/stateparser.rb, line 281
  def current_info   ; @current[:info]   ; end
current_match()
# File lib/facets/more/stateparser.rb, line 280
  def current_match  ; @current[:match]  ; end
current_token()
# File lib/facets/more/stateparser.rb, line 277
  def current_token  ; @current[:token]  ; end
end_trigger()
# File lib/facets/more/stateparser.rb, line 303
  def end_trigger
    machine.send("#{current_token}_#{ENDCALLBACK}", current_match, self)
  end
mock( current )
# File lib/facets/more/stateparser.rb, line 283
  def mock( current )
    mock = StateParser::Marker.new
    mock.token = current_token
    mock.begins = current_begins
    mock.ends = current_ends
    mock.match = current_match
    mock.info = current_info
    mock.parent = current
    mock
  end
next_end( index )
# File lib/facets/more/stateparser.rb, line 253
  def next_end( index )
    token = @stack.last.token
    match = @stack.last.match
    re = machine.send( "#{token}_#{ENDMATCH}", match, self ) #machine.tokens[token].stop(match,self)
    i = text.index( re, offset )
    m = $~ if i
    e = m.end(0) if i
    if i and i < index # what comes first?
      @mode = :END
      @current[:token] = token
      @current[:begins] = i
      @current[:ends] = e
      @current[:match] = m
      #@current[:info] = f
      return i
    end
    return index
  end
next_offset()

increment the offset

# File lib/facets/more/stateparser.rb, line 295
  def next_offset
    @offset = current_ends
  end
next_start( token, index )
# File lib/facets/more/stateparser.rb, line 234
  def next_start( token, index )
    re = machine.send( "#{token}_#{MATCH}", self )
    i = text.index( re, offset )
    if i
      m = $~
      e = m.end(0)
      if i < index # what comes first?
        @mode = machine.tokenIsUnit?[token] ? :UNIT : :START
        @current[:token] = token
        @current[:begins] = i
        @current[:ends] = e
        @current[:match] = m
        #@current[:info] = f
        return i
      end
    end
    return index
  end
trigger()
# File lib/facets/more/stateparser.rb, line 299
  def trigger
    machine.send("#{current_token}_#{CALLBACK}", current_match, self)
  end
trigger_finish()
# File lib/facets/more/stateparser.rb, line 311
  def trigger_finish
    machine.send("finish", self) #if machine.respond_to?(:finish)
  end
trigger_flush( text )
# File lib/facets/more/stateparser.rb, line 307
  def trigger_flush( text )
    machine.send("flush", text, self) #if machine.respond_to?(:flush)
  end