Skip to content

Added support for a \0 escape sequence #9248

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

Merged
merged 1 commit into from
Sep 18, 2013

Conversation

DanielRosenwasser
Copy link
Contributor

Since \0 is equivalent to \x00, this is a direct translation to the latter escape sequence.
Future builds will be able to compile using \0 directly.

This pull request is meant to address Issue #9143 .

@brson
Copy link
Contributor

brson commented Sep 17, 2013

This is a language change. Let's discuss before landing.

@alexcrichton
Copy link
Member

Hmm, I think that there's two things this should get before landing

  1. The documentation in doc/manual.md should get updated
  2. There should be a test to ensure the right behavior shows up.

@DanielRosenwasser
Copy link
Contributor Author

@alexcrichton

  1. Assuming you meant doc/tutorial.md, I chose not to make a change in the tutorial because I saw that \\, \xNN, \uNNNN and \UNNNNNNNN were not documented there. It's implied that the tutorial is not trying to be comprehensive on escape sequences, so I think it might be best to omit it.
  2. I agree, a test would probably be in order, but I will probably hold off on this until it's clear that making \0 an escape character is appropriate for the language.

@alexcrichton
Copy link
Member

Oh sorry about that, I meant doc/rust.md, I saw some documentation for the other escape sequences and this should probably go in with those.

We also agreed in the meeting today that this is fine to include, so no worries there (probably should have mentioned that too...).

@DanielRosenwasser
Copy link
Contributor Author

Gotcha - well I think I've addressed some of the concerns. How's it looking now?

@alexcrichton
Copy link
Member

Code looks good to me! Would you mind rebasing/squashing into one commit? That should also help get rid of the two merge commits that seem to have crept in.

This commit adds support for `\0` escapes in character and string literals.

Since `\0` is equivalent to `\x00`, this is a direct translation to the latter
escape sequence. Future builds will be able to compile using `\0` directly.

Also updated the grammar specification and added a test for NUL characters.
@DanielRosenwasser
Copy link
Contributor Author

You wouldn't know it, but I think I just learned a lot about git.

@alexcrichton
Copy link
Member

Thanks!

bors added a commit that referenced this pull request Sep 18, 2013
@bors bors closed this Sep 18, 2013
@bors bors merged commit 604667f into rust-lang:master Sep 18, 2013
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.

4 participants