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

[WIP] Skip comment only lines in the scala interpreter. #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

poplav
Copy link
Contributor

@poplav poplav commented May 10, 2016

@chipsenkbeil
Copy link
Contributor

chipsenkbeil commented May 10, 2016

We also need to consider multi-line comments (/*) if we're going to filter out that way. Might be a better idea to use regex to remove comments from the full code blob before splitting. // matches to newline and /* matches until */. E.g.

val x = 3 /*
some comment
*/ val y = 4
// another comment
z = 5 // final comment?
// no, this is the final comment

becomes

val x = 3
val y = 4
val z = 5

Would also be a good idea to have some sort of test (maybe system?) that can verify that providing comments does not provide an empty syntax error like you've seen.

@Lull3rSkat3r, @lbustelo, feel free to chime in on this one with your own thoughts.

@Lull3rSkat3r
Copy link
Member

agreed 🎐

@lbustelo
Copy link
Contributor

I wonder is there is code in some Apache package to do this rather than rely on regex or string lookups directly.

@lbustelo
Copy link
Contributor

@poplav Can you rename this into a [WIP]? I think there is more work to do here.

@poplav poplav changed the title Skip comment only lines in the scala interpreter. [WIP] Skip comment only lines in the scala interpreter. May 11, 2016
@gotoariel
Copy link

I'm not sure if this is the right place to comment, but having just switched to Toree it seems like this is just a symptom of the lack of :paste mode, along with having to use braces to give companion objects the same scope as their class, and not being able to do method chaining with dots at the beginnings of lines.

I know there are line magics, but I wonder if there's a way (maybe through a notebook magic) to make each cell be sent to the interpreter in :paste mode and disable the line-by-line functionality. This would bring things much more in line experientially with other REPLs.

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