| Class | IRB::SLex |
| In: |
lib/irb/slex.rb
|
| Parent: | Object |
| 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: ") |
# 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
# 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
# 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
# File lib/irb/slex.rb, line 83
83: def inspect
84: format("<SLex: @head = %s>", @head.inspect)
85: end
# 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憶兄ック?
# File lib/irb/slex.rb, line 57
57: def postproc(token)
58: node = search(token, proc)
59: node.postproc=proc
60: end
# File lib/irb/slex.rb, line 51
51: def preproc(token, proc)
52: node = search(token)
53: node.preproc=proc
54: end