scala-subscript / subscript

9 stars 2 forks source link

Compile error on "script s =;+ body" #22

Open AndreVanDelft opened 8 years ago

AndreVanDelft commented 8 years ago

I tried to compile a slightly modified version of eyetest.app. That failed. This code

controlsIter = + [userIsSelected testBtn doTest]
                 [registerBtn doRegister  ]
                 [userIsSelected serializeBtn doSerialize]

was changed to

controlsIter =;+ userIsSelected testBtn doTest
                 registerBtn doRegister
                 userIsSelected serializeBtn doSerialize

That should work but it yielded:

java.lang.RuntimeException: Parse error File: /Users/andrevandelft/Documents/workspaces/scala-subscript/eye-test/src/main/scala/eyetest/app/Login.scala Error: ParseError(Position(1465,69,19), Position(1465,69,19), <24 traces>) controlsIter =;+ userIsSelected testBtn doTest ^ at scala.sys.package$.error(package.scala:27) at sbt.BuildCommon$$anonfun$toError$1.apply(Defaults.scala:1874) ... at java.lang.Thread.run(Thread.java:745) error Parse error [error] File: /Users/andrevandelft/Documents/workspaces/scala-subscript/eye-test/src/main/scala/eyetest/app/Login.scala [error] Error: ParseError(Position(1465,69,19), Position(1465,69,19), <24 traces>) [error] controlsIter =;+ userIsSelected testBtn doTest [error] ^ [error] Total time: 3 s, completed 29-jan-2016 18:23:45

Extra problem: the stack trace should not be displayed, IMO.

anatoliykmetyuk commented 8 years ago

This syntax is not implemented so far. I'll add it tomorrow.

AndreVanDelft commented 8 years ago

And the stack trace? Is this a result of using Parboiled2?

anatoliykmetyuk commented 8 years ago

I'm using toError method native to SBT to propagate the errors. Since it has a type of Nothing, apparently it throws an exception... I'll try to see whether it is possible to write directly to System.err from SBT>

anatoliykmetyuk commented 8 years ago

And the stack trace? Is this a result of using Parboiled2? It does not seem to be possible to remove the stack trace. The parser is run from an SBT plugin like a full fledged Java program. To stop it, an exception must be thrown, or else the compiler will invoke.

When run from an SBT console, however, there's no stack trace output:

> run
[trace] Stack trace suppressed: run last compile:managedSources for the full output.
[error] (compile:managedSources) Parse error
[error] File: /Users/anatolii/Projects/SubScript/playground/src/main/scala/Main.scala
[error] Error: ParseError(Position(163,11,13), Position(163,11,13), <6 traces>)
[error]     live = + + + +
[error]             ^
[error] Total time: 0 s, completed Jan 30, 2016 9:07:28 PM

It happens only when run via sbt run. I think we should make an sbt console a default way of working with SubScript.

AndreVanDelft commented 8 years ago

=;+ is parsed well, but nut with a space inserted after =:

[error] (compile:managedSources) Parse error
[error] File: /Users/andrevandelft/Documents/workspaces/scala-subscript/eye-test/src/main/scala/eyetest/app/Login.scala
[error] Error: ParseError(Position(1453,66,21), Position(1453,66,21), <24 traces>)
[error]     controlAction = ;+ userIsSelected      testBtn doTest
[error]                     ^