Skip to content

Don't allow invalid interpolations to occur#1925

Open
Rangi42 wants to merge 1 commit intogbdev:masterfrom
Rangi42:invalid-interpolation
Open

Don't allow invalid interpolations to occur#1925
Rangi42 wants to merge 1 commit intogbdev:masterfrom
Rangi42:invalid-interpolation

Conversation

@Rangi42
Copy link
Copy Markdown
Contributor

@Rangi42 Rangi42 commented Apr 10, 2026

Fixes #1921

@Rangi42 Rangi42 added this to the 1.0.2 milestone Apr 10, 2026
@Rangi42 Rangi42 added bug Unexpected behavior / crashes; to be fixed ASAP! rgbasm This affects RGBASM labels Apr 10, 2026
@Rangi42 Rangi42 requested a review from ISSOtm April 10, 2026 01:58
Comment on lines +1343 to +1344
// Don't allow invalidly formatted interpolation to occur
skipChars([&endsEarly](int d) { return d != '}' && !endsEarly(d); });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bad idea, this fails to take into account nesting, or any other special cases we might introduce. Better let the interpolation be processed normally, and only check the format's validity when that's done.

error("Missing '}'");
break;
} else if (int c = peek(); endsEarly(c)) {
error("Unterminated interpolation");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This explains the cause better, but not the symptom. Idk which is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior / crashes; to be fixed ASAP! rgbasm This affects RGBASM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open brace without a closing brace does interpolation anyway

2 participants