Class IRB::SLex
In: lib/irb/slex.rb
Parent: Object

Methods

create   def_rule   def_rules   inspect   match   new   postproc   preproc   search  

Classes and Modules

Class IRB::SLex::Node

Constants

DOUT = Notifier::def_notifier("SLex::")
D_WARN = DOUT::def_notifier(1, "Warn: ")
D_DEBUG = DOUT::def_notifier(2, "Debug: ")
D_DETAIL = DOUT::def_notifier(4, "Detail: ")

Public Class methods

[Source]

    # File lib/irb/slex.rb, line 31
31:     def initialize
32:       @head = Node.new("")
33:     end

Public Instance methods

[Source]

    # File lib/irb/slex.rb, line 66
66:     def create(token, preproc = nil, postproc = nil)
67:       @head.create_subnode(token.split(//), preproc, postproc)
68:     end

[Source]

    # File lib/irb/slex.rb, line 35
35:     def def_rule(token, preproc = nil, postproc = nil, &block)
36:       D_DETAIL.pp token
37: 
38:       postproc = block if block_given?
39:       node = create(token, preproc, postproc)
40:     end

[Source]

    # File lib/irb/slex.rb, line 42
42:     def def_rules(*tokens, &block)
43:       if block_given?
44:         p = block
45:       end
46:       for token in tokens
47:         def_rule(token, nil, p)
48:       end
49:     end

[Source]

    # File lib/irb/slex.rb, line 83
83:     def inspect
84:       format("<SLex: @head = %s>", @head.inspect)
85:     end

[Source]

    # File lib/irb/slex.rb, line 70
70:     def match(token)
71:       case token
72:       when Array
73:       when String
74:         return match(token.split(//))
75:       else
76:         return @head.match_io(token)
77:       end
78:       ret = @head.match(token)
79:       D_DETAIL.exec_if{D_DEATIL.printf "match end: %s:%s\n", ret, token.inspect}
80:       ret
81:     end

要チウ8憶兄ック?

[Source]

    # File lib/irb/slex.rb, line 57
57:     def postproc(token)
58:       node = search(token, proc)
59:       node.postproc=proc
60:     end

[Source]

    # File lib/irb/slex.rb, line 51
51:     def preproc(token, proc)
52:       node = search(token)
53:       node.preproc=proc
54:     end

[Source]

    # File lib/irb/slex.rb, line 62
62:     def search(token)
63:       @head.search(token.split(//))
64:     end

[Validate]