123456789_123456789_123456789_123456789_123456789_

Class: IRB::SLex

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Exception2MessageMapper
Inherits: Object
Defined in: lib/irb/slex.rb

Constant Summary

Class Method Summary

Instance Method Summary

Constructor Details

.newSLex

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 31

def initialize
  @head = Node.new("")
end

Instance Method Details

#create(token, preproc = nil, postproc = nil)

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 66

def create(token, preproc = nil, postproc = nil)
  @head.create_subnode(token.split(//), preproc, postproc)
end

#def_rule(token, preproc = nil, postproc = nil, &block)

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 35

def def_rule(token, preproc = nil, postproc = nil, &block)
  D_DETAIL.pp token

  postproc = block if block_given?
  create(token, preproc, postproc)
end

#def_rules(*tokens, &block)

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 42

def def_rules(*tokens, &block)
  if block_given?
    p = block
  end
  for token in tokens
    def_rule(token, nil, p)
  end
end

#inspect

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 83

def inspect
  format("<SLex: @head = %s>", @head.inspect)
end

#match(token)

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 70

def match(token)
  case token
  when Array
  when String
    return match(token.split(//))
  else
    return @head.match_io(token)
  end
  ret = @head.match(token)
  D_DETAIL.exec_if{D_DETAIL.printf "match end: %s:%s\n", ret, token.inspect}
  ret
end

#postproc(token)

need a check?

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 57

def postproc(token)
  node = search(token, proc)
  node.postproc=proc
end

#preproc(token, proc)

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 51

def preproc(token, proc)
  node = search(token)
  node.preproc=proc
end

#search(token)

[ GitHub ]

  
# File 'lib/irb/slex.rb', line 62

def search(token)
  @head.search(token.split(//))
end