Class: TheFox::Range::Lexer::Base
- Inherits:
-
Object
- Object
- TheFox::Range::Lexer::Base
show all
- Defined in:
- lib/thefox-ext/range/lexer/base.rb
Constant Summary
collapse
- @@instance_id =
0
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(symbole = nil) ⇒ Base
Returns a new instance of Base.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 8
def initialize(symbole = nil)
@@instance_id += 1
@instance_id = @@instance_id
@nonce = Base.generate_nonce()
@symbole = symbole
@prev_item = nil
@org_prev_item = nil
@next_item = nil
@parent_item = nil
@children = []
end
|
Class Method Details
.generate_nonce ⇒ Object
111
112
113
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 111
def generate_nonce()
rand(10 ** 3).to_s.rjust(3, '0')
end
|
.keep_instance_id_on_dup ⇒ Object
117
118
119
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 117
def keep_instance_id_on_dup()
false
end
|
.keep_nonce_on_dup ⇒ Object
114
115
116
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 114
def keep_nonce_on_dup()
false
end
|
Instance Method Details
#add_child(child) ⇒ Object
90
91
92
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 90
def add_child(child)
@children.push(child)
end
|
#chain(prev_item) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 44
def chain(prev_item)
self.prev_item = prev_item
if !prev_item.nil?
prev_item.next_item = self
end
end
|
#children ⇒ Object
87
88
89
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 87
def children()
@children
end
|
#dup ⇒ Object
97
98
99
100
101
102
103
104
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 97
def dup()
o = super()
o.nonce = Base.generate_nonce()
o.prev_item = nil
o.next_item = nil
o
end
|
#has_children ⇒ Object
93
94
95
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 93
def has_children()
@children.length > 0
end
|
#has_parent_item ⇒ Object
83
84
85
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 83
def has_parent_item()
!@parent_item.nil?
end
|
#inspect ⇒ Object
25
26
27
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 25
def inspect()
'Base'
end
|
#instance_id ⇒ Object
30
31
32
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 30
def instance_id()
@instance_id
end
|
#instance_id=(instance_id) ⇒ Object
33
34
35
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 33
def instance_id=(instance_id)
@instance_id = instance_id
end
|
#next_item ⇒ Object
70
71
72
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 70
def next_item()
@next_item
end
|
#next_item=(next_item) ⇒ Object
73
74
75
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 73
def next_item=(next_item)
@next_item = next_item
end
|
#nonce ⇒ Object
37
38
39
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 37
def nonce()
@nonce
end
|
#nonce=(nonce) ⇒ Object
40
41
42
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 40
def nonce=(nonce)
@nonce = nonce
end
|
#org_prev_item ⇒ Object
56
57
58
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 56
def org_prev_item()
@org_prev_item
end
|
#org_prev_item=(org_prev_item) ⇒ Object
59
60
61
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 59
def org_prev_item=(org_prev_item)
@org_prev_item = org_prev_item
end
|
#parent_item ⇒ Object
77
78
79
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 77
def parent_item()
@parent_item
end
|
#parent_item=(parent_item) ⇒ Object
80
81
82
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 80
def parent_item=(parent_item)
@parent_item = parent_item
end
|
#prev_item ⇒ Object
63
64
65
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 63
def prev_item()
@prev_item
end
|
#prev_item=(prev_item) ⇒ Object
66
67
68
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 66
def prev_item=(prev_item)
@prev_item = prev_item
end
|
#resolve ⇒ Object
106
107
108
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 106
def resolve()
puts '-> Base.resolve'
end
|
#symbole ⇒ Object
52
53
54
|
# File 'lib/thefox-ext/range/lexer/base.rb', line 52
def symbole()
@symbole
end
|