Class: MarshalParser::Parser::SymbolLinkNode

Inherits:
Node
  • Object
show all
Includes:
Annotatable
Defined in:
lib/marshal-parser/parser.rb

Instance Method Summary collapse

Methods inherited from Node

#always_leaf?, #children, #tokens

Methods included from Assertable

#assert

Constructor Details

#initialize(marker_token, index_token) ⇒ SymbolLinkNode

Returns a new instance of SymbolLinkNode.



568
569
570
571
572
573
574
575
# File 'lib/marshal-parser/parser.rb', line 568

def initialize(marker_token, index_token)
  super()
  assert_token_type marker_token, Lexer::SYMBOL_LINK_PREFIX
  assert_token_type index_token, Lexer::INTEGER

  @marker_token = marker_token
  @index_token = index_token
end

Instance Method Details

#annotationObject



581
582
583
# File 'lib/marshal-parser/parser.rb', line 581

def annotation
  "link to symbol ##{@index_token.value}"
end

#attributesObject



593
594
595
596
597
# File 'lib/marshal-parser/parser.rb', line 593

def attributes
  {
    @index_token => { name: :index, value: @index_token.value }
  }
end

#child_entitiesObject



577
578
579
# File 'lib/marshal-parser/parser.rb', line 577

def child_entities
  [@marker_token, @index_token]
end

#decoded_valueObject



585
586
587
# File 'lib/marshal-parser/parser.rb', line 585

def decoded_value
  @index_token.value
end

#literal_tokenObject



589
590
591
# File 'lib/marshal-parser/parser.rb', line 589

def literal_token
  @index_token
end