Module: YARP::LexCompat::Heredoc

Defined in:
lib/yarp/lex_compat.rb

Overview

A heredoc in this case is a list of tokens that belong to the body of the heredoc that should be appended onto the list of tokens when the heredoc closes.

Defined Under Namespace

Classes: DashHeredoc, DedentingHeredoc, PlainHeredoc

Class Method Summary collapse

Class Method Details

.build(opening) ⇒ Object

Here we will split between the two types of heredocs and return the object that will store their tokens.



532
533
534
535
536
537
538
539
540
541
# File 'lib/yarp/lex_compat.rb', line 532

def self.build(opening)
  case opening.value[2]
  when "~"
    DedentingHeredoc.new
  when "-"
    DashHeredoc.new(opening.value[3] != "'")
  else
    PlainHeredoc.new
  end
end