Class: StackPath
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #add_link(link) ⇒ Object
- #add_path(aStackPath) ⇒ Object
- #includes_link?(link) ⇒ Boolean
-
#initialize(from, links = []) ⇒ StackPath
constructor
A new instance of StackPath.
- #inspect ⇒ Object
Constructor Details
#initialize(from, links = []) ⇒ StackPath
Returns a new instance of StackPath.
368 369 370 371 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 368 def initialize(from, links = []) @from, @links = from, Array.new links.each {|link| self.add_link(link)} end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
365 366 367 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 365 def from @from end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
366 367 368 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 366 def links @links end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
365 366 367 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 365 def to @to end |
Instance Method Details
#add_link(link) ⇒ Object
373 374 375 376 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 373 def add_link(link) @links.push link @to = link.stack end |
#add_path(aStackPath) ⇒ Object
378 379 380 381 382 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 378 def add_path(aStackPath) @links.concat aStackPath.links @to = @links.last.stack self end |
#includes_link?(link) ⇒ Boolean
384 385 386 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 384 def includes_link?(link) @links.detect {|l| l==link} end |
#inspect ⇒ Object
388 389 390 391 |
# File 'lib/rpdf2txt-rockit/glr_parser.rb', line 388 def inspect "#{from.state}(#{from.lexer.position.char_position}) " + @links.map {|l| "-#{l.tree.inspect}-> #{l.stack.state} (#{l.stack.lexer.position.char_position}) "}.join end |