google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.31k stars 209 forks source link

syntax: unexpected NEWLINE token is reported on following line #532

Closed ortsaboy closed 6 months ago

ortsaboy commented 6 months ago

Two cases ---

1) Correct

╭─root at devenv in /handjob
╰─○ bat error.star
───────┬──────────────────────────────────────────────────────────────
       │ File: error.star
───────┼──────────────────────────────────────────────────────────────
   1   │ print("Hello World")
   2   │
   3   │ x, y = None
   4   │
   5   │ print("Aloha")
───────┴──────────────────────────────────────────────────────────────
╭─root at devenv in /handjob
╰─○ starlark -recursion -globalreassign error.star
Hello World
Traceback (most recent call last):
  error.star:3:6: in <toplevel>
Error: got NoneType in sequence assignment

2) Incorrect --- should be line 3 as well, it got line 4

╭─root at devenv in /handjob
╰─○ bat error2.star
───────┬──────────────────────────────────────────────────────────────
       │ File: error2.star
───────┼──────────────────────────────────────────────────────────────
   1   │ print("Hello World")
   2   │
   3   │ x++
   4   │
   5   │ print("Aloha")
───────┴──────────────────────────────────────────────────────────────
╭─root at devenv in /handjob
╰─○ starlark -recursion -globalreassign error2.star
error2.star:4:1: got newline, want primary expression

Can you guys please fix it?