class SyntaxTree::Parser

def on_string_literal(string)

Experimental RBS support (using type sampling data from the type_fusion project).

def on_string_literal: (SyntaxTree::StringContent string) -> untyped

This signature was generated using 9 samples from 1 application.

on_string_literal: (String string) -> Heredoc | StringLiteral
:call-seq:
def on_string_literal(string)
  heredoc = @heredocs[-1]
  if heredoc&.ending
    heredoc = @heredocs.pop
    Heredoc.new(
      beginning: heredoc.beginning,
      ending: heredoc.ending,
      dedent: heredoc.dedent,
      parts: string.parts,
      location: heredoc.location
    )
  else
    tstring_beg = consume_token(TStringBeg)
    tstring_end = consume_tstring_end(tstring_beg.location)
    location =
      Location.new(
        start_line: tstring_beg.location.start_line,
        start_char: tstring_beg.location.start_char,
        start_column: tstring_beg.location.start_column,
        end_line: [
          tstring_end.location.end_line,
          string.location.end_line
        ].max,
        end_char: tstring_end.location.end_char,
        end_column: tstring_end.location.end_column
      )
    StringLiteral.new(
      parts: string.parts,
      quote: tstring_beg.value,
      location: location
    )
  end
end