Struct yash_syntax::syntax::HereDoc
source · pub struct HereDoc {
pub delimiter: Word,
pub remove_tabs: bool,
pub content: OnceCell<Text>,
}
Expand description
Here-document.
Fields§
§delimiter: Word
Token that marks the end of the content of the here-document.
remove_tabs: bool
Whether leading tab characters should be removed from each line of the
here-document content. This value is true
for the <<-
operator and
false
for <<
.
content: OnceCell<Text>
Content of the here-document.
The content ends with a newline unless it is empty. If the delimiter is
quoted, the content must be all literal. If remove_tabs
is true
,
each content line does not start with tabs as they are removed when
parsed.
This value is wrapped in OnceCell
because the here-doc content is
parsed separately from the here-doc operator. When the operator is
parsed, the HereDoc
instance is created with an empty content. The
content is filled to the cell when it is parsed later. When accessing
the parsed content, you can safely unwrap the cell.