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

[SR-1743] REPL doesn't handle multiline comments #4522

Open
swift-ci opened this issue Jun 13, 2016 · 2 comments
Open

[SR-1743] REPL doesn't handle multiline comments #4522

swift-ci opened this issue Jun 13, 2016 · 2 comments
Labels
bug Something isn't working LLDB for Swift REPL

Comments

@swift-ci
Copy link

Previous ID SR-1743
Radar None
Original Reporter amasad (JIRA User)
Type Bug
Environment

Linux ubuntu 15
Swift version 3.0-dev (LLVM b361b0fc05, Clang 11493b0f62, Swift 24a0c3d)

Additional Detail from JIRA
Votes 3
Component/s LLDB for Swift
Labels Bug, REPL
Assignee None
Priority Medium

md5: 2215125dbc4176bab8cc45b90b06d4ca

Issue Description:

To reproduce:

In test.swift:

/*
hello world
*/
print("hello world")

Run:

cat test.swift | swift

Output:

Welcome to Swift version 3.0-dev (LLVM b361b0fc05, Clang 11493b0f62, Swift 24a0c3de75). Type :help for assistance.
<REPL>:3:6: error: unterminated '/*' comment
#line
     ^
     */
<REPL>:2:1: note: comment started here
/*
^

repl.swift:1:6: error: consecutive statements on a line must be separated by ';'
hello world
     ^
     ;

<REPL>:2:1: error: unexpected end of block comment
*/
^

hello world

Notice the errors about the comment.

The reason I'm piping into the REPL is because I use it programmatically (As a child process from another program) and that means it's not in TTY mode. Everything else work (including multiline code).

@belkadan
Copy link

Do you need to use the REPL, or can you just use the script interpreter?

cat test.swift | swift -

@swift-ci
Copy link
Author

Comment by Amjad Masad (JIRA)

As briefly mentioned in the description: I'm using the REPL programmatically, I'm starting the process from my program and writing code through stdin to it and parsing the output. This is because I'm adding support for swift it on my online REPL website: https://repl.it

So I need this to be interactive and stateful. The script interpreter exits after it finishes running the current script.

Let me know if there is a better way of doing this. It works pretty well, and I'm hacking around this issue by stripping multiline comments.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift REPL
Projects
None yet
Development

No branches or pull requests

2 participants