class Prism::LexCompat::Heredoc::DedentingHeredoc
Heredocs that are dedenting heredocs are a little more complicated. Ripper outputs on_ignored_sp tokens for the whitespace that is being removed from the output. prism only modifies the node itself and keeps the token the same. This simplifies prism, but makes comparing against Ripper much harder because there is a length mismatch.
Fortunately, we already have to pull out the heredoc tokens in order to insert them into the stream in the correct order. As such, we can do some extra manipulation on the tokens to make them match Ripperโs output by mirroring the dedent logic that Ripper uses.
Constants
- TAB_WIDTH
-
:nodoc:
Attributes
bool
Array[lex_compat_token]
Public Class Methods
() → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/lex_compat.rbs, line 127
def initialize: () -> void
: () -> void
Public Instance Methods
(lex_compat_token token) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-2.1.0-x86_64-linux-gnu/sig/generated/prism/lex_compat.rbs, line 134
def <<: (lex_compat_token token) -> void
As tokens are coming in, we track the minimum amount of common leading whitespace on plain string content tokens. This allows us to later remove that amount of whitespace from the beginning of each line.
: (lex_compat_token token) -> void