Brandon Lucas
f670bd2659
feat: implement string interpolation
Add support for string interpolation with {expr} syntax:
"Hello, {name}!" becomes "Hello, " + toString(name) + "!"
Lexer changes:
- Add StringPart enum (Literal/Expr) and InterpolatedString token
- Detect {expr} in strings and capture expression text
- Support escaped braces with \{ and \}
Parser changes:
- Add desugar_interpolated_string() to convert to concatenation
- Automatically wrap expressions in toString() calls
Interpreter changes:
- Fix toString() to not add quotes around strings
Tests added:
- 4 lexer tests for interpolation tokenization
- 4 integration tests for full interpolation pipeline
Add examples/interpolation.lux demonstrating:
- Variable interpolation
- Number interpolation (auto toString)
- Expression interpolation ({a + b})
- Escaped braces
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 09:30:37 -05:00
..
2026-02-13 09:05:06 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:20:36 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:30:37 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:05:06 -05:00
2026-02-13 09:05:06 -05:00