Introduces a string_content named node, so as to clearly indicate which parts of a string make up the content, and which parts are interpolations.
Adds a bunch of convenient fields for accessing parts of strings and interpolations.
Basically, with the old setup there was no convenient way to extract the string content of a string node. Its source text would encompass also the interpolations contained therein.
With what's contained in this change, the source text of the string_content node is now exactly the string content for that part of the string.
Note that this required the addition of a few instances of token.immediate. Without this, something like
f"foo {0}"
(that is, _string_content followed by an interpolation) would get the whitespace before the interpolation gobbled up as extras. By requiring an immediate token, we ensure that the whitespaces ends up with the preceding string content, as desired.
Does a few things:
string_content
named node, so as to clearly indicate which parts of a string make up the content, and which parts are interpolations.Basically, with the old setup there was no convenient way to extract the string content of a
string
node. Its source text would encompass also the interpolations contained therein.With what's contained in this change, the source text of the
string_content
node is now exactly the string content for that part of the string.Note that this required the addition of a few instances of
token.immediate
. Without this, something like(that is,
_string_content
followed by aninterpolation
) would get the whitespace before the interpolation gobbled up asextras
. By requiring an immediate token, we ensure that the whitespaces ends up with the preceding string content, as desired.