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

Whitespace or comments following "\" character in multiline statement causes parse error #41654

Open
Tracked by #40488
WalkingPlaces opened this issue Aug 31, 2020 · 1 comment

Comments

@WalkingPlaces
Copy link

Godot version:

3.2.2.stable.official

OS/device including version:

Windows 10

Issue description:

White-space or comments following "\" character in multiline statement causes parse error.

Steps to reproduce:
Example code:

if flag1 \  # first flag
and flag2:  # second flag
		pass

Causes parse error: Expected newline after '\'.

Minimal reproduction project:

(This is just a gdscript file showing the error. I can format it into a proper project if needed, but I didn't feel that it was necessary as this is simple to reproduce.)
newline_error.zip

@WalkingPlaces WalkingPlaces changed the title [3.2.2] Whitespace or comments following "\" character in multiline statement causes parse error Whitespace or comments following "\" character in multiline statement causes parse error Aug 31, 2020
@Calinou
Copy link
Member

Calinou commented Aug 31, 2020

I think this is expected. The same code snippet also fails in Python 3.8 (and 2.7):

flag1 = True
flag2 = True

if flag1 \  # first flag
and flag2:  # second flag
		pass

Running that file results in:

  File "example.py", line 4
    if flag1 \  # first flag
                           ^
SyntaxError: unexpected character after line continuation character

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

No branches or pull requests

2 participants