about summary refs log tree commit diff
path: root/src/libsyntax/parse/lexer
AgeCommit message (Collapse)AuthorLines
2015-01-21More test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-21rollup merge of #21258: aturon/stab-3-indexAlex Crichton-3/+3
Conflicts: src/libcore/ops.rs src/librustc_typeck/astconv.rs src/libstd/io/mem.rs src/libsyntax/parse/lexer/mod.rs
2015-01-21rollup merge of #21457: alexcrichton/issue-21436Alex Crichton-4/+4
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2015-01-21rollup merge of #21396: japaric/no-parens-in-rangeAlex Crichton-2/+2
Conflicts: src/libsyntax/parse/lexer/comments.rs
2015-01-21Fallout from stabilization.Aaron Turon-3/+3
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-4/+4
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-19remove unnecessary parentheses from range notationJorge Aparicio-2/+2
2015-01-18libsyntax: 0u -> 0us, 0i -> 0isPaul Collier-20/+20
2015-01-18libsyntax: int types -> isizePaul Collier-2/+2
2015-01-18libsyntax: int => i32 in appropriate placesPaul Collier-2/+2
2015-01-17libsyntax: rename functions from uint to usizePaul Collier-9/+9
2015-01-17libsyntax: uint types to usizePaul Collier-9/+9
2015-01-07use slicing sugarJorge Aparicio-16/+16
2015-01-06rollup merge of #19430: pczarn/interp_tt-cleanupAlex Crichton-1/+1
Conflicts: src/libsyntax/parse/parser.rs
2015-01-07Cleanup and followup to PR #17830: parsing changesPiotr Czarnecki-1/+1
Prevents breaking down `$name` tokens into separate `$` and `name`. Reports unknown macro variables. Fixes #18775 Fixes #18839 Fixes #15640
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-14/+14
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-14/+14
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-16/+16
2015-01-03Remove deprecated functionalityAlex Crichton-1/+2
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-4/+4
2015-01-02std: Stabilize the prelude moduleAlex Crichton-1/+2
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2014-12-21Fallout of std::str stabilizationAlex Crichton-17/+17
2014-12-19libsyntax: use `#[deriving(Copy)]`Jorge Aparicio-3/+1
2014-12-15Remove all shadowed lifetimes.Niko Matsakis-2/+2
2014-12-13libsyntax: use unboxed closuresJorge Aparicio-2/+6
2014-12-11Register new snapshotsAlex Crichton-8/+4
2014-12-09auto merge of #19644 : pcwalton/rust/oibit3, r=nikomatsakisbors-0/+2
2014-12-08Revert "Register new snapshots"Alex Crichton-3/+3
This reverts commit 9b443289cf32cbcff16768614340f0c844675340.
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+2
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-22/+20
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-06libsyntax: remove unnecessary `to_string()` callsJorge Aparicio-11/+11
2014-12-06libsyntax: remove unnecessary `as_slice()` callsJorge Aparicio-11/+9
2014-12-05Register new snapshotsAlex Crichton-3/+3
2014-12-03syntax: support ES6-style unicode escapesCorey Richardson-3/+78
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-11-30Adjust some error messages to start with a lowercase letter and not finish ↵P1start-1/+1
with a full stop
2014-11-25Deprecate MaybeOwned[Vector] in favor of CowJorge Aparicio-4/+4
2014-11-21unicode: Rename is_XID_start to is_xid_start, is_XID_continue to is_xid_continueBrian Anderson-3/+3
2014-11-21unicode: Add stability attributes to u_charBrian Anderson-2/+2
Free functions deprecated. UnicodeChar experimental pending final decisions about prelude.
2014-11-21core: Convert Char::escape_default, escape_unicode to iteratorsBrian Anderson-2/+2
[breaking-change]
2014-11-21Fix various deprecation warnings from char changesBrian Anderson-3/+3
2014-11-20Switch numeric suffix parsing to use the new system.Huon Wilson-70/+4
This moves errors and all handling of numeric suffixes into the parser rather than the lexer.
2014-11-20Parse and store suffixes on literals.Huon Wilson-28/+84
This adds an optional suffix at the end of a literal token: `"foo"bar`. An actual use of a suffix in a expression (or other literal that the compiler reads) is rejected in the parser. This doesn't switch the handling of numbers to this system, and doesn't outlaw illegal suffixes for them yet.
2014-11-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-20/+21
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+2
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-13Add error message specific to \<carriage return>.Huon Wilson-0/+7
This can crop-up with a misconfigured editor or an unexpected interaction between version control and certain operating systems. Closes #11669.
2014-11-05Register snapshots.Eduard Burtescu-6/+0
2014-11-04libsyntax: Forbid escapes in the inclusive range `\x80`-`\xff` inPatrick Walton-4/+19
Unicode characters and strings. Use `\u0080`-`\u00ff` instead. ASCII/byte literals are unaffected. This PR introduces a new function, `escape_default`, into the ASCII module. This was necessary for the pretty printer to continue to function. RFC #326. Closes #18062. [breaking-change]
2014-11-03Ignore whitespace tokens when re-computing spans in save_analysisNick Cameron-0/+13
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-6/+6
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-29Rename fail! to panic!Steve Klabnik-7/+7
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]