Re: [PATCH 1/2] test-lib: allow test snippets as here-docs
- From
Jeff King <peff@peff.net>
- Date
- Jul 6, 2024, 05:33 UTC
- Message-ID
- <20240706053359.GA698567@coredump.intra.peff.net>
- In-Reply-To
- <20240706053105.GB698153@coredump.intra.peff.net>
On Sat, Jul 06, 2024 at 01:31:05AM -0400, Jeff King wrote:
Show 12 quoted lines
> > > And then ScriptParser::parse_cmd() just has to recognize that any "<<" > > > token isn't interesting, and that "-" means "read the here-doc". > > > > In my implementation, the `<<` token is "interesting" because the > > heredoc tag is attached to it, and the tag is needed to pluck the > > heredoc body from the set of saved bodies (since my implementation > > doesn't assume most-recently-seen body is the correct one). > > Ah, OK. So it would probably not be that big of a deal to record a > single bit for "this heredoc is interpolated". But until we have > anything useful to do with that information, let's not worry about it > for now.
Oh, oops. I attached this response to the wrong message (I read them all through before starting to respond). My response here was about the fact that "<<\EOT" does not record the "\" anywhere from the lexer.
But yes, for your implementation, we do need to recognize "<<\EOT", etc, to pull out "EOT".
-Peff