-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
ApiNfun syntax is not changed, but C# syntax isNfun syntax is not changed, but C# syntax isSyntaxSyntactic and semantic improvements and sugarsSyntactic and semantic improvements and sugars
Description
Problem
Currently NFun accidentally allows newlines inside single-quoted strings. QuotationReader scans until a closing quote and doesn't check for \n (0x0A), so multiline content silently passes through.
This is undocumented and inconsistent — NFun is an expression-per-line language where \n is an expression separator.
Proposal
Add a dialect enum:
enum SingleLineString
{
DenyLineBreak, // '...' with real \n → compile error (recommended)
AllowLineBreak, // '...' with real \n → legacy behavior
}Default: DenyLineBreak for new code. AllowLineBreak for backward compatibility.
This is needed before introducing triple-quoted strings ('''...''') so that single-quoted strings have well-defined single-line semantics.
Implementation notes
QuotationReader.ReadQuotation()— add check: ifcurrent == '\n'andSingleLineString.DenyLineBreak→ return errorTokenizer— pass dialect flag toReadText/QuotationReader- Escape
\nand\rinside single-quoted strings remain valid (they produce the character, not a real newline)
Related
- Part of multiline strings feature (see Triple-quoted multiline strings with trim margin: '''...''' #98, Escape level prefix for string interpolation: $'...' $$'...' #99)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ApiNfun syntax is not changed, but C# syntax isNfun syntax is not changed, but C# syntax isSyntaxSyntactic and semantic improvements and sugarsSyntactic and semantic improvements and sugars