about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2014-07-09ast: make Name its own typeCorey Richardson-8/+12
2014-07-09lexer: lex WS/COMMENT/SHEBANG rather than skippingCorey Richardson-3/+17
Now, the lexer will categorize every byte in its input according to the grammar. The parser skips over these while parsing, thus avoiding their presence in the input to syntax extensions.
2014-07-09syntax: don't parse numeric literals in the lexerCorey Richardson-12/+7
This removes a bunch of token types. Tokens now store the original, unaltered numeric literal (that is still checked for correctness), which is parsed into an actual number later, as needed, when creating the AST. This can change how syntax extensions work, but otherwise poses no visible changes. [breaking-change]
2014-07-09syntax: don't process string/char/byte/binary litsCorey Richardson-6/+11
This shuffles things around a bit so that LIT_CHAR and co store an Ident which is the original, unaltered literal in the source. When creating the AST, unescape and postprocess them. This changes how syntax extensions can work, slightly, but otherwise poses no visible changes. To get a useful value out of one of these tokens, call `parse::{char_lit, byte_lit, bin_lit, str_lit}` [breaking-change]
2014-07-09syntax: doc comments all the thingsCorey Richardson-224/+225
2014-07-08carry self ident forward through re-parsingJohn Clements-30/+42
formerly, the self identifier was being discarded during parsing, which stymies hygiene. The best fix here seems to be to attach a self identifier to ExplicitSelf_, a change that rippled through the rest of the compiler, but without any obvious damage.
2014-07-08remove outdated commentJohn Clements-12/+0
I believe this comment is now irrelevant, as a result of commit 6757053cffb585249105fbd76f
2014-07-08get rid of keyword idents, replace with namesJohn Clements-2/+2
should prevent future bugs
2014-07-08preserve context in parsing of `self` varrefJohn Clements-9/+11
2014-07-08change if/else to matchJohn Clements-179/+197
2014-07-08auto merge of #15493 : brson/rust/tostr, r=pcwaltonbors-38/+38
This updates https://github.com/rust-lang/rust/pull/15075. Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path. Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage. Closes #15046.
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-38/+38
[breaking-change]
2014-07-08Change DST syntax: type -> Sized?Nick Cameron-18/+44
closes #13367 [breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g., ``` trait Tr for Sized? {} fn foo<Sized? X: Share>(x: X) {} ```
2014-07-05auto merge of #15428 : phildawes/rust/master, r=huonwbors-2/+3
Fix small bug introduced in e38cb972dcf: PatIdent span was incorrect because self.last_span was being used before the ident token was parsed.
2014-07-04Parser: fix PatIdent span bugPhil Dawes-2/+3
Fix small bug introduced in e38cb972dcf: PatIdent span was incorrect because self.last_span was being used before the ident token was parsed.
2014-07-04librustc: Remove the `&LIFETIME EXPR` production from the language.Patrick Walton-1/+0
This was parsed by the parser but completely ignored; not even stored in the AST! This breaks code that looks like: static X: &'static [u8] = &'static [1, 2, 3]; Change this code to the shorter: static X: &'static [u8] = &[1, 2, 3]; Closes #15312. [breaking-change]
2014-07-03Fix ICE with nested macro_rules!-style macrosKevin Ballard-2/+2
Fixes #10536.
2014-07-03Simplify PatIdent to contain an Ident rather than a PathJohn Clements-9/+14
Rationale: for what appear to be historical reasons only, the PatIdent contains a Path rather than an Ident. This means that there are many places in the code where an ident is artificially promoted to a path, and---much more problematically--- a bunch of elements from a path are simply thrown away, which seems like an invitation to some really nasty bugs. This commit replaces the Path in a PatIdent with a SpannedIdent, which just contains an ident and a span.
2014-06-25Register new snapshotsAlex Crichton-1/+5
This change starts denying `*T` in the parser. All code using `*T` should ensure that the FFI call does indeed take `const T*` on the other side before renaming the type to `*const T`. Otherwise, all code can rename `*T` to `*const T`. [breaking-change]
2014-06-24Make parse_expr_res publicKeegan McAllister-1/+1
2014-06-24auto merge of #14952 : alexcrichton/rust/const-unsafe-pointers, r=brsonbors-1/+14
This does not yet change the compiler and libraries from `*T` to `*const T` as it will require a snapshot to do so. cc #7362 --- Note that the corresponding RFC, https://github.com/rust-lang/rfcs/pull/68, has not yet been accepted. It was [discussed at the last meeting](https://github.com/rust-lang/rust/wiki/Meeting-weekly-2014-06-10#rfc-pr-68-unsafe-pointers-rename-t-to-const-t) and decided to be accepted, however. I figured I'd get started on the preliminary work for the RFC that will be required regardless.
2014-06-23libsyntax: Disallow struct literals after `if`, `while`, `match`, andPatrick Walton-14/+16
`for...in`. Closes #14803. If you used a structure literal after one of these keywords, surround it in parentheses. [breaking-change]
2014-06-22libsyntax: don't allow enum structs with no fieldsBenjamin Herr-0/+5
Unit-like structs are written as `struct Foo;`, but we erroneously accepted `struct Foo();` and took it to mean the same thing. Now we don't, so use the `struct Foo;` form! [breaking-change]
2014-06-21auto merge of #15062 : pcwalton/rust/trailing-plus, r=brsonbors-0/+6
This will break code that looks like `Box<Trait+>`. Change that code to `Box<Trait>` instead. Closes #14925. [breaking-change] r? @brson
2014-06-20libsyntax: Stop parsing `+` with no bounds after it.Patrick Walton-0/+6
This will break code that looks like `Box<Trait+>`. Change that code to `Box<Trait>` instead. Closes #14925. [breaking-change]
2014-06-20syntax: Parse GT tokens from `>=` and `>>=`Alex Crichton-1/+13
The parser already has special logic for parsing `>` tokens from `>>`, and this commit extends the logic to the acquiring a `>` from the `>=` and `>>=` tokens as well. Closes #15043
2014-06-17Add br##"xx"## raw byte string literals.Simon Sapin-0/+1
2014-06-17Add a b"xx" byte string literal of type &'static [u8].Simon Sapin-1/+2
2014-06-17Add a b'x' byte literal of type u8.Simon Sapin-1/+2
2014-06-16rustc: Improve span for error about using a method as a field.Kevin Butler-2/+3
libsyntax: ExprField now contains a SpannedIdent rather than Ident. [breaking-change]
2014-06-16rustc: Start accepting `*const T`Alex Crichton-1/+14
This does not yet change the compiler and libraries from `*T` to `*const T` as it will require a snapshot to do so. cc #7362
2014-06-15Register new snapshotsAlex Crichton-37/+4
2014-06-14rustc: Obsolete the `@` syntax entirelyAlex Crichton-2/+5
This removes all remnants of `@` pointers from rustc. Additionally, this removes the `GC` structure from the prelude as it seems odd exporting an experimental type in the prelude by default. Closes #14193 [breaking-change]
2014-06-13Fix all violations of stronger guarantees for mutable borrowsCameron Zwarich-55/+102
Fix all violations in the Rust source tree of the stronger guarantee of a unique access path for mutable borrows as described in #12624.
2014-06-13syntax: parse outer attributes in `quote_item!` calls.Huon Wilson-0/+5
Fixes #14857.
2014-06-13libsyntax: Allow `+` to separate trait bounds from objects.Patrick Walton-51/+86
RFC #27. After a snapshot, the old syntax will be removed. This can break some code that looked like `foo as &Trait:Send`. Now you will need to write `foo as (&Trait+Send)`. Closes #12778. [breaking-change]
2014-06-13librustc: Fix the issue with labels shadowing variable names by makingPatrick Walton-1/+1
the leading quote part of the identifier for the purposes of hygiene. This adopts @jbclements' solution to #14539. I'm not sure if this is a breaking change or not. Closes #12512. [breaking-change]
2014-06-13auto merge of #14831 : alexcrichton/rust/format-intl, r=brsonbors-4/+34
* 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]
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-4/+34
* 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]
2014-06-11rustc: Remove ~[T] from the languageAlex Crichton-6/+7
The following features have been removed * box [a, b, c] * ~[a, b, c] * box [a, ..N] * ~[a, ..N] * ~[T] (as a type) * deprecated_owned_vector lint All users of ~[T] should move to using Vec<T> instead.
2014-06-11rustc: Move the AST from @T to Gc<T>Alex Crichton-2/+2
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-117/+124
2014-06-10Fix more misspelled comments and strings.Joseph Crail-1/+1
2014-06-09librustc: Implement sugar for the `FnMut` traitPatrick Walton-13/+71
2014-06-05Fallout from the libcollections movementAlex Crichton-1/+1
2014-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-2/+2
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-05-30libsyntax: Fix snake_case errors.Kevin Butler-41/+37
A number of functions/methods have been moved or renamed to align better with rust standard conventions. syntax::ext::mtwt::xorPush => xor_push syntax::parse::parser::Parser => Parser::new [breaking-change]
2014-05-30auto merge of #14517 : lucy/rust/issue-14499, r=alexcrichtonbors-1/+1
Fixes #8537 Fixes #14499 (duplicate of #8537) Old: ```rust test.rs:2 pub extern "xxxxx" fn add(x: int, y: int) -> int { ^~ ``` New: ```rust test.rs:2 pub extern "xxxxx" fn add(x: int, y: int) -> int { ^~~~~~~ ```
2014-05-29auto merge of #14483 : ahmedcharles/rust/patbox, r=alexcrichtonbors-3/+3
2014-05-29syntax: Fix span on illegal ABI errorslucy-1/+1
Fixes #8537 Fixes #14499