diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-28 09:24:28 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-11 16:04:24 -0700 |
| commit | cac7a2053aba7be214d5e58e13867089638a8f50 (patch) | |
| tree | 8c0af42bd2ab5237a19c04e9777e433805d600df /src/libsyntax/parse | |
| parent | f9260d41d6e37653bf71b08a041be0310098716a (diff) | |
| download | rust-cac7a2053aba7be214d5e58e13867089638a8f50.tar.gz rust-cac7a2053aba7be214d5e58e13867089638a8f50.zip | |
std: Remove i18n/l10n from format!
* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'
Closes #14810
[breaking-change]
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 38 |
2 files changed, 41 insertions, 4 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 64766b5013c..112cdb26131 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -89,11 +89,18 @@ impl<'a> ParserAttr for Parser<'a> { let hi = self.span.hi; (mk_sp(lo, hi), meta_item, style) } + #[cfg(stage0)] _ => { let token_str = self.this_token_to_str(); self.fatal(format!("expected `\\#` but found `{}`", token_str).as_slice()); } + #[cfg(not(stage0))] + _ => { + let token_str = self.this_token_to_str(); + self.fatal(format!("expected `#` but found `{}`", + token_str).as_slice()); + } }; if permit_inner && self.eat(&token::SEMI) { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8083bf41706..282f4065e4f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1208,11 +1208,18 @@ impl<'a> Parser<'a> { }) } + #[cfg(stage0)] _ => { let token_str = p.this_token_to_str(); p.fatal((format!("expected `;` or `\\{` but found `{}`", token_str)).as_slice()) } + #[cfg(not(stage0))] + _ => { + let token_str = p.this_token_to_str(); + p.fatal((format!("expected `;` or `{{` but found `{}`", + token_str)).as_slice()) + } } }) } @@ -2738,7 +2745,7 @@ impl<'a> Parser<'a> { self.bump(); if self.token != token::RBRACE { let token_str = self.this_token_to_str(); - self.fatal(format!("expected `\\}`, found `{}`", + self.fatal(format!("expected `{}`, found `{}`", "}", token_str).as_slice()) } etc = true; @@ -3148,6 +3155,7 @@ impl<'a> Parser<'a> { // consuming more tokens). let (bra, ket) = match token::close_delimiter_for(&self.token) { Some(ket) => (self.token.clone(), ket), + #[cfg(stage0)] None => { // we only expect an ident if we didn't parse one // above. @@ -3161,6 +3169,20 @@ impl<'a> Parser<'a> { ident_str, tok_str).as_slice()) } + #[cfg(not(stage0))] + None => { + // we only expect an ident if we didn't parse one + // above. + let ident_str = if id == token::special_idents::invalid { + "identifier, " + } else { + "" + }; + let tok_str = self.this_token_to_str(); + self.fatal(format!("expected {}`(` or `{{`, but found `{}`", + ident_str, + tok_str).as_slice()) + } }; let tts = self.parse_unspanned_seq( @@ -4040,8 +4062,8 @@ impl<'a> Parser<'a> { fields = Vec::new(); } else { let token_str = self.this_token_to_str(); - self.fatal(format!("expected `\\{`, `(`, or `;` after struct \ - name but found `{}`", + self.fatal(format!("expected `{}`, `(`, or `;` after struct \ + name but found `{}`", "{", token_str).as_slice()) } @@ -4068,12 +4090,20 @@ impl<'a> Parser<'a> { self.bump(); } token::RBRACE => {} + #[cfg(stage0)] _ => { let token_str = self.this_token_to_str(); self.span_fatal(self.span, format!("expected `,`, or `\\}` but found `{}`", token_str).as_slice()) } + #[cfg(not(stage0))] + _ => { + let token_str = self.this_token_to_str(); + self.span_fatal(self.span, + format!("expected `,`, or `}}` but found `{}`", + token_str).as_slice()) + } } a_var } @@ -4683,7 +4713,7 @@ impl<'a> Parser<'a> { let token_str = self.this_token_to_str(); self.span_fatal(self.span, - format!("expected `\\{` or `fn` but found `{}`", + format!("expected `{}` or `fn` but found `{}`", "{", token_str).as_slice()); } |
