Skip to content

Support multiple expressions in code blocks#98

Merged
istathar merged 6 commits intotechnique-lang:mainfrom
istathar:expressions
Apr 3, 2026
Merged

Support multiple expressions in code blocks#98
istathar merged 6 commits intotechnique-lang:mainfrom
istathar:expressions

Conversation

@istathar
Copy link
Copy Markdown
Member

Update the paresr of CodeBlocks to support multiple expressions (separated by newlines) and expressions sequenced on a single line (separated by ; characters).

Element::CodeBlock now holds Vec instead of single Expression.

New Expression::Separator variant, representing ; between expressions in a code block, capturing whether the document author used semicolons.

read_code_block() updated to return a Vec instead of a single Expression. This is done by looping over reading expressions until the block is consumed. After each expression it consumes an optional ; and pushes Expression::Separator if one is found. Errors on an empty block. The old leftover-detection heuristic is removed entirely.

Formatter updated accordingly.

@istathar istathar self-assigned this Mar 29, 2026
@istathar
Copy link
Copy Markdown
Member Author

Here's the example that was used while developing this
image
I do wonder how we should treat enum-like values that appear for example in navigate() here but that's a language design question for another day.

@istathar istathar merged commit 4169c1c into technique-lang:main Apr 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant