Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free newlines in string constants without margin character #2081

Open
jurgenvinju opened this issue Nov 18, 2024 · 0 comments
Open

Free newlines in string constants without margin character #2081

jurgenvinju opened this issue Nov 18, 2024 · 0 comments

Comments

@jurgenvinju
Copy link
Member

jurgenvinju commented Nov 18, 2024

#2079 triggered this.

lexical StringCharacter
	= "\\" [\" \' \< \> \\ b f n r t] 
	| UnicodeEscape 
	| ![\" \' \< \> \\]
	| [\n][\ \t \u00A0 \u1680 \u2000-\u200A \u202F \u205F \u3000]* [\'] // margin 
	;

Proposal to change ![\" \' \< \> \\] to ![\" \' \< \> \\ \n] such that every newline in a string constant requires a margin continuation character.

This would not be backward compatible, but 99% of the cases already use this and for the other 1% it is a bug. If you don't want to end your template with a new line you can close the string constant with a " on the previous line.

Without this parse error issue like the referenced one pop-up unnoticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant