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

Use string parsing for command literals #18644

Merged
merged 1 commit into from
Sep 26, 2016

Conversation

TotalVerb
Copy link
Contributor

@TotalVerb TotalVerb commented Sep 23, 2016

This changes command literals to be parsed the same way (raw) string literals are.

Consequences:

  • Multiline command literals with ``` now supported
  • xcmd parsing to @x_cmd "cmd" now supported
  • \r\n within command literals translated to \n
  • \\ within command literals now means two backslashes, instead of one. Note that this means it is no longer possible to end a command literal with a single backslash. I don't think this is a big deal, since it can just be quoted. never mind, this is actually the same behaviour as before. the Cmd constructor just special-cased it.

This implements the less breaking and less controversial (I think) part of #12139.

@tkelman
Copy link
Contributor

tkelman commented Sep 23, 2016

Should we give single quotes the same treatment while at it? Figure we can get more use out of them than we're doing right now.

@StefanKarpinski
Copy link
Sponsor Member

Should we give single quotes the same treatment while at it?

Let's make that a separate PR instead of holding this up with it.

(let* ((str (begin (take-token s)
(parse-string-literal s #t)))
;; custom string and command literals; x"s" => @x_str "s"
(let* ((macstr (begin (take-token s)
Copy link
Member

@stevengj stevengj Sep 24, 2016

Choose a reason for hiding this comment

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

Shouldn't this be (car (begin ....)) since the previous version of macstr also took the car?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No; it calls parse-raw-literal which wraps the car call.

@stevengj
Copy link
Member

LGTM.

@kshyatt
Copy link
Contributor

kshyatt commented Sep 26, 2016

This has been open for a while, passed CI, thumbs up from a bunch of folks. Going to merge.

@kshyatt kshyatt merged commit 0a04242 into JuliaLang:master Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants