Class: Prism::LexResult

Inherits:
Result
  • Object
show all
Defined in:
lib/prism/parse_result.rb,
ext/prism/extension.c

Overview

This is a result specific to the ‘lex` and `lex_file` methods.

Instance Attribute Summary collapse

Attributes inherited from Result

#comments, #data_loc, #errors, #magic_comments, #source, #warnings

Instance Method Summary collapse

Methods inherited from Result

#encoding, #failure?, #success?

Constructor Details

#initialize(value, comments, magic_comments, data_loc, errors, warnings, source) ⇒ LexResult

Create a new lex result object with the given values.



632
633
634
635
# File 'lib/prism/parse_result.rb', line 632

def initialize(value, comments, magic_comments, data_loc, errors, warnings, source)
  @value = value
  super(comments, magic_comments, data_loc, errors, warnings, source)
end

Instance Attribute Details

#valueObject (readonly)

The list of tokens that were parsed from the source code.



629
630
631
# File 'lib/prism/parse_result.rb', line 629

def value
  @value
end

Instance Method Details

#deconstruct_keys(keys) ⇒ Object

Implement the hash pattern matching interface for LexResult.



638
639
640
# File 'lib/prism/parse_result.rb', line 638

def deconstruct_keys(keys)
  super.merge!(value: value)
end