Class: Stupidedi::Parser::IdentifierStack::ST
- Inherits:
-
Object
- Object
- Stupidedi::Parser::IdentifierStack::ST
- Defined in:
- lib/stupidedi/parser/identifier_stack.rb
Instance Method Summary collapse
-
#count(builder) ⇒ Integer
Number of Included Segments (SE01).
- #hl
- #id
-
#initialize(parent, sequence) ⇒ ST
constructor
A new instance of ST.
- #lx
- #pop
- #pop_st
Constructor Details
Instance Method Details
#count(builder) ⇒ Integer
Number of Included Segments (SE01)
188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/stupidedi/parser/identifier_stack.rb', line 188 def count(builder) m = Either.success(builder.machine) while m.defined? if m.flatmap(&:segment).map{|s| s.node.id == :ST }.fetch(false) return m.flatmap{|n| n.distance(builder.machine) }.fetch(0) + 2 else m = m.flatmap(&:parent) end end end |
#hl
177 178 179 |
# File 'lib/stupidedi/parser/identifier_stack.rb', line 177 def hl HL.new(self, @hl_sequence.succ!, @lx_sequence) end |
#id
173 174 175 |
# File 'lib/stupidedi/parser/identifier_stack.rb', line 173 def id "%04d" % @id end |
#lx
181 182 183 |
# File 'lib/stupidedi/parser/identifier_stack.rb', line 181 def lx @lx_sequence.succ!.value end |
#pop
204 205 206 207 |
# File 'lib/stupidedi/parser/identifier_stack.rb', line 204 def pop warn "DEPRECATION WARNING: IdentifierStack#pop is deprecated, use pop_st (when removing an ST identifier from the stack)" pop_st end |
#pop_st
200 201 202 |
# File 'lib/stupidedi/parser/identifier_stack.rb', line 200 def pop_st @parent end |