Skip to content

Conversation

@som-snytt
Copy link
Contributor

When getting the next part of an interpolation,
consisting of the literal part followed by the interpolated
identifier or expression, defer fetching the identifier
to postProcessToken. This ensures that lookahead at an
interpolation looks ahead only one token.

Fixes #15514

When getting the next part of an interpolation,
consisting of the literal part followed by the interpolated
identifier or expression, defer fetching the identifier
to postProcessToken. This ensures that lookahead at an
interpolation looks ahead only one token.
If there is already a next token, don't overwrite it.

Give a pass to lookahead scanner as a hedge, assuming
lookahead results are merely a probe and are discarded,
and may be looking at erroneous input.
@som-snytt
Copy link
Contributor Author

Added the assert on reset from the sibling PR.

@som-snytt som-snytt requested a review from odersky June 24, 2022 13:35
@som-snytt som-snytt marked this pull request as ready for review June 24, 2022 13:38
case EOF =>
if !source.maybeIncomplete then closeIndented()
case STRINGPART =>
finishStringPart()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Finnish string part would be the violins in Sibelius's Finlandia.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must admit I found this hard to follow, and a bit unsystematic, since postProcess usually does not fiddle with token details like that.

I believe it's best to simply forbid looking ahead beyond an INTERPOLATIONID. It turned out forbidding this revealed a bug in Parser where the real problem lied.

@odersky odersky mentioned this pull request Jun 25, 2022
@som-snytt som-snytt closed this Jun 27, 2022
@som-snytt som-snytt deleted the issue/15514-postprocess branch February 6, 2023 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String interpolation followed by a dot is missing string literals

2 participants