Class: Prism::ParseLexResult

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

Overview

This is a result specific to the ‘parse_lex` and `parse_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

#code_units_cache, #encoding, #failure?, #success?

Constructor Details

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

Create a new parse lex result object with the given values.



787
788
789
790
# File 'lib/prism/parse_result.rb', line 787

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)

A tuple of the syntax tree and the list of tokens that were parsed from the source code.



784
785
786
# File 'lib/prism/parse_result.rb', line 784

def value
  @value
end

Instance Method Details

#deconstruct_keys(keys) ⇒ Object

Implement the hash pattern matching interface for ParseLexResult.



793
794
795
# File 'lib/prism/parse_result.rb', line 793

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