Repository navigation
Support implicit concatenation of adjacent string literals - #28
Open
florianvoss-commit wants to merge 1 commit into
Open
florianvoss-commit wants to merge 1 commit into
florianvoss-commit wants to merge 1 commit into
Conversation
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for implicit concatenation of adjacent string literals in Minja expressions.
This allows valid Jinja expressions such as:
{{ raise_exception( "first part " "second part " "third part" ) }}The implementation extends Minja's existing constant parser to consume adjacent quoted literals separated by whitespace and combine them into a single string value.
Fixes #27
Motivation
Google's canonical Gemma 4 chat template uses adjacent string literals inside a
raise_exception()call:https://huggingface.co/google/gemma-4-E2B-it/blob/main/chat_template.jinja#L257-L260
The template was published by the Google Gemma Engineering Team and is used by the public
google/gemma-4-E2B-itmodel.Minja currently parses the first literal and then expects a comma or closing parenthesis. It therefore fails on the second literal with:
This prevents runtimes using Minja from loading the canonical Gemma 4 template.
Implementation
Value.Tests
Added native C++ syntax coverage for:
raise_exception()structure used by Gemma 4.Validation performed:
test-syntaxsuite passes.-Wall -Wextra -pedantic -Werror.Scope
This adds syntax that is actively used by a publicly available LLM chat
template, consistent with Minja's restricted contribution scope.