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

only allow certain characters after interpolated vars #25234

Merged
merged 5 commits into from
Dec 25, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2073,7 +2073,7 @@
(string.join (string-split s a) b))

(define (ends-interpolated-atom? c)
(or (opchar? c) (never-identifier-char? c)))
(or (eof-object? c) (opchar? c) (never-identifier-char? c)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand this – is there a test case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the replcompletions test exercises this; the issue was that you need Base.incomplete_tag(Meta.parse("\"\$foo", raise=false)) to return :string.

If you don't check eof-object? here, then parsing the incomplete string "$foo will raise a syntax error for because $foo is terminated by an eof, instead of raising an incomplete error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we could add an explicit @test Base.incomplete_tag(Meta.parse("\"\$foo", raise=false)) == :string too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense. Can't hurt to have the explicit test here.


(define (parse-interpolate s)
(let* ((p (ts:port s))
Expand Down