lover icon indicating copy to clipboard operation
lover copied to clipboard

Syntax Errors Out of the Box

Open markpwns1 opened this issue 3 years ago • 4 comments

Hello, all I've done is wu create 3d and copy-pasted the sample code on the readme of this repo into src/init.wu, then git cloneed the repo into src and ran wu 3d and I get syntax errors (that make no sense) out of the box:

λ wu 3d
Compiling 3d\init.wu

wrong: expected `,` or newline, found `flush`
     --> 3d/src/lover/filesystem.wu
      │
   14 │ flush:          fun(self) -> (bool, str?)
      │ ^^^^^
Compiling 3d\src\init.wu

wrong: expected `,` or newline, found `flush`
     --> 3d\src/lover/filesystem.wu
      │
   14 │ flush:          fun(self) -> (bool, str?)
      │ ^^^^^
Compiling 3d\src\lover\audio.wu
Compiling 3d\src\lover\data.wu
Compiling 3d\src\lover\event.wu
Compiling 3d\src\lover\filesystem.wu

wrong: expected `,` or newline, found `flush`
     --> 3d\src\lover\filesystem.wu
      │
   14 │ flush:          fun(self) -> (bool, str?)
      │ ^^^^^
Compiling 3d\src\lover\font.wu
Compiling 3d\src\lover\graphics.wu

wrong: expected `,` or newline, found `type`
     --> 3d\src\lover/types.wu
      │
    5 │     type:    fun(self) -> str
      │     ^^^^
Compiling 3d\src\lover\image.wu
Compiling 3d\src\lover\init.wu

wrong: expected `,` or newline, found `flush`
     --> 3d\src\lover/filesystem.wu
      │
   14 │ flush:          fun(self) -> (bool, str?)
      │ ^^^^^
Compiling 3d\src\lover\joystick.wu

wrong: expected `,` or newline, found `getAxis`
     --> 3d\src\lover\joystick.wu
      │
   16 │     getAxis:                    fun(self, int) -> float
      │     ^^^^^^^
Compiling 3d\src\lover\keyboard.wu
Compiling 3d\src\lover\math.wu
Compiling 3d\src\lover\mouse.wu
Compiling 3d\src\lover\physics.wu

wrong: expected `,` or newline, found `getFixtures`
     --> 3d\src\lover\physics.wu
      │
   26 │     getFixtures: fun(self) -> ...Fixture
      │     ^^^^^^^^^^^
Compiling 3d\src\lover\sound.wu
Compiling 3d\src\lover\system.wu
Compiling 3d\src\lover\thread.wu

wrong: expected `,` or newline, found `isRunning`
     --> 3d\src\lover\thread.wu
      │
    9 │     isRunning:  fun(self) -> bool
      │     ^^^^^^^^^
Compiling 3d\src\lover\timer.wu
Compiling 3d\src\lover\touch.wu
Compiling 3d\src\lover\types.wu

wrong: expected `,` or newline, found `type`
     --> 3d\src\lover\types.wu
      │
    5 │     type:    fun(self) -> str
      │     ^^^^
Compiling 3d\src\lover\video.wu
Compiling 3d\src\lover\window.wu
  Finished things in 166ms

Obviously the source code already has newlines where it says it should have them. Adding newlines where it says to add them does not fix the error. Adding commas, however, does fix the error. I'm on 64-bit Windows 10 and have tried converting files to both LF line endings and CRLF, to no avail.

Does anyone know what's going on? Or is this likely a problem with the Wu language itself?

markpwns1 avatar Mar 04 '21 18:03 markpwns1

Hi! Thank you for pointing this out. I added some quick things to implement a feature request from the Discord a while back, and somewhy did not test it en this repo.

I believe this should be a simple fix, and will look into in later tonight. A fix is on its way.

Very cool, that you're trying to implement things in Wu! - and I am sorry that it this error made it less cool.

🥂🥂

nilq avatar Mar 05 '21 18:03 nilq

To answer your question; I believe you have discovered a bug in the actual parser, where something is triggering a check at the wrong moment.

A-tier detective work.

nilq avatar Mar 05 '21 18:03 nilq

is this fixed yet? I still can't use lover because of this exact bug, I'm even trying to fix the files myself and send a pull request...

thacuber2a03 avatar Jul 14 '22 02:07 thacuber2a03

@ThaCuber it hasn't been fixed yet unfortunately, we've been really busy for the past couple years. I will get some spare time in a few weeks I'll patch some bugs then.

If you manage to fix it by then we'll happily accept the PR :)

evolbug avatar Jul 14 '22 09:07 evolbug