123456789_123456789_123456789_123456789_123456789_

Class: Prism::LexCompat::Result

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Prism::Result
Defined in: lib/prism/lex_compat.rb

Overview

A result class specialized for holding tokens produced by the lexer.

Class Method Summary

::Prism::Result - Inherited

.new

Create a new result object with the given values.

Instance Attribute Summary

  • #value readonly

    The list of tokens that were produced by the lexer.

::Prism::Result - Inherited

#comments

The list of comments that were encountered during parsing.

#data_loc

An optional location that represents the location of the __END__ marker and the rest of the content of the file.

#errors

The list of errors that were generated during parsing.

#failure?

Returns true if there were errors during parsing and false if there were not.

#magic_comments

The list of magic comments that were encountered during parsing.

#source

A Source instance that represents the source code that was parsed.

#success?

Returns true if there were no errors during parsing and false if there were.

#warnings

The list of warnings that were generated during parsing.

Instance Method Summary

::Prism::Result - Inherited

#deconstruct_keys

Implement the hash pattern matching interface for Result.

#encoding

Returns the encoding of the source code that was parsed.

Constructor Details

.new(value, comments, magic_comments, data_loc, errors, warnings, source) ⇒ Result

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

[ GitHub ]

  
# File 'lib/prism/lex_compat.rb', line 19

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

#value (readonly)

The list of tokens that were produced by the lexer.

[ GitHub ]

  
# File 'lib/prism/lex_compat.rb', line 16

attr_reader :value

Instance Method Details

#deconstruct_keys(keys)

Implement the hash pattern matching interface for Result.

[ GitHub ]

  
# File 'lib/prism/lex_compat.rb', line 25

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