about summary refs log tree commit diff
path: root/src/libsyntax/parse/lexer.rs
AgeCommit message (Collapse)AuthorLines
2013-05-09Use a specialized string interner to reduce the need for owned stringsBjörn Steinbrink-22/+22
&str can be turned into @~str on demand, using to_owned(), so for strings, we can create a specialized interner that accepts &str for intern() and find() but stores and returns @~str.
2013-05-05Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freezeNiko Matsakis-10/+0
Conflicts: src/libcore/core.rc src/libcore/hashmap.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/num/float.rs src/libcore/num/int-template.rs src/libcore/num/num.rs src/libcore/num/strconv.rs src/libcore/num/uint-template.rs src/libcore/ops.rs src/libcore/os.rs src/libcore/prelude.rs src/libcore/rt/mod.rs src/libcore/unstable/lang.rs src/librustc/driver/session.rs src/librustc/middle/astencode.rs src/librustc/middle/borrowck/check_loans.rs src/librustc/middle/borrowck/gather_loans.rs src/librustc/middle/borrowck/loan.rs src/librustc/middle/borrowck/preserve.rs src/librustc/middle/liveness.rs src/librustc/middle/mem_categorization.rs src/librustc/middle/region.rs src/librustc/middle/trans/base.rs src/librustc/middle/trans/inline.rs src/librustc/middle/trans/reachable.rs src/librustc/middle/typeck/check/_match.rs src/librustc/middle/typeck/check/regionck.rs src/librustc/util/ppaux.rs src/libstd/arena.rs src/libstd/ebml.rs src/libstd/json.rs src/libstd/serialize.rs src/libstd/std.rc src/libsyntax/ast_map.rs src/libsyntax/parse/parser.rs src/test/compile-fail/borrowck-uniq-via-box.rs src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs src/test/run-pass/borrowck-nested-calls.rs
2013-05-02Remove 'Local Variable' commentsBrendan Zabarauskas-10/+0
2013-05-01syntax: fix up dynamic borrow errors in libsyntaxNiko Matsakis-2/+2
2013-04-28parser commentsJohn Clements-0/+2
2013-04-28remove unused functions, fix tiny lexing bugJohn Clements-10/+1
before this change, the parser would parse 14.a() as a method call, but would parse 14.ø() as the floating-point number 14. followed by a function call. This is because it was checking is_alpha, rather than ident_start, and was therefore wrong with respect to unicode.
2013-04-27only use #[no_core] in libcoreDaniel Micay-7/+0
2013-04-18core: replace unicode match exprs with bsearch in const arrays, minor perf win.Graydon Hoare-2/+2
2013-04-16libcore,std,syntax,rustc: move tests into `mod tests`, make them private (no ↵Huon Wilson-1/+1
pub mod or pub fn).
2013-04-08auto merge of #5787 : alexcrichton/rust/less-mut-fields, r=catamorphismbors-6/+4
This removes some of the easier instances of mutable fields where the explicit self can just become `&mut self` along with removing some unsafe blocks which aren't necessary any more now that purity is gone. Most of #4568 is done, except for [one case](https://github.com/alexcrichton/rust/blob/less-mut-fields/src/libcore/vec.rs#L1754) where it looks like it has to do with it being a `const` vector. Removing the unsafe block yields: ``` /Users/alex/code/rust2/src/libcore/vec.rs:1755:12: 1755:16 error: illegal borrow unless pure: creating immutable alias to const vec content /Users/alex/code/rust2/src/libcore/vec.rs:1755 for self.each |e| { ^~~~ /Users/alex/code/rust2/src/libcore/vec.rs:1757:8: 1757:9 note: impure due to access to impure function /Users/alex/code/rust2/src/libcore/vec.rs:1757 } ^ error: aborting due to previous error ``` I also didn't delve too much into removing mutable fields with `Cell` or `transmute` and friends.
2013-04-08Removing no longer needed unsafe blocksAlex Crichton-6/+4
2013-04-08libsyntax: fail lexing with an error message on an int literal larger than 2^64.Huon Wilson-2/+9
Stops an ICE. Closes #5544.
2013-04-03auto merge of #5559 : jbclements/rust/change-to-tt-based-parsing, r=jbclementsbors-1/+6
Changes the parser to parse all streams into token-trees before hitting the parser proper, in preparation for hygiene. As an added bonus, it appears to speed up the parser (albeit by a totally imperceptible 1%). Also, many comments in the parser. Also, field renaming in token-trees (readme->forest, cur->stack).
2013-03-29librustc: Remove `fail_unless!`Patrick Walton-2/+2
2013-03-29commenting parserJohn Clements-1/+6
2013-03-22librustc: Remove `pure` from libsyntax and librustc.Patrick Walton-5/+5
2013-03-22syntax: replace uses of old deriving attribute with new oneAndrew Paseltiner-1/+1
2013-03-21auto merge of #5407 : jbclements/rust/add-assert-eq-macro, r=jbclementsbors-10/+9
Adds an assert_eq! macro that asserts that its two arguments are equal. Error messages can therefore be somewhat more informative than a simple assert, because the error message includes "expected" and "given" values.
2013-03-21back-renamed slice_DBG_BRWD, slice_V_DBG_BRWD -> slice, slice_DBG_UNIQ -> ↵Marvin Löbel-1/+1
slice_unique
2013-03-21renamed str::view -> slice_DBG_BRWDMarvin Löbel-2/+2
renamed str::slice -> slice_DBG_UNIQ changed vec slice method -> to_owned() renamed vec view method -> slice_V_DBG_BRWD
2013-03-20change some uses of fail_unless to assert_eqJohn Clements-10/+9
2013-03-18librustc: Make the compiler ignore purity.Patrick Walton-2/+2
For bootstrapping purposes, this commit does not remove all uses of the keyword "pure" -- doing so would cause the compiler to no longer bootstrap due to some syntax extensions ("deriving" in particular). Instead, it makes the compiler ignore "pure". Post-snapshot, we can remove "pure" from the language. There are quite a few (~100) borrow check errors that were essentially all the result of mutable fields or partial borrows of `@mut`. Per discussions with Niko I think we want to allow partial borrows of `@mut` but detect obvious footguns. We should also improve the error message when `@mut` is erroneously reborrowed.
2013-03-13librustc: Don't accept `as Trait` anymore; fix all occurrences of it.Patrick Walton-9/+9
2013-03-07librustc: Convert all uses of `assert` over to `fail_unless!`Patrick Walton-6/+6
2013-03-04Adding missing imports for tests, and gate off othersAlex Crichton-1/+0
2013-03-04Remove unused imports throughout src/Alex Crichton-1/+0
2013-03-01Merge remote-tracking branch 'remotes/origin/incoming' into incomingErick Tryzelaar-2/+6
2013-02-28Fix implicit leaks of imports throughout librariesAlex Crichton-2/+6
Also touch up use of 'pub' and move some tests around so the tested functions don't have to be 'pub'
2013-02-27Merge remote-tracking branch 'remotes/origin/incoming' into incomingErick Tryzelaar-1/+49
2013-02-27librustc: Forbid `pub` or `priv` before trait implementationsPatrick Walton-1/+1
2013-02-26Macros now leave scopeJohn Clements-0/+48
Macro scope is now delimited by function, block, and module boundaries, except for modules that are marked with #[macro_escape], which allows macros to escape.
2013-02-25libsyntax: make lexer vecs_implicitly_copyable-freeErick Tryzelaar-8/+17
2013-02-15librustc: Stop parsing `impl Type : Trait` and fix several declarations that ↵Patrick Walton-1/+1
slipped through. r=tjc
2013-02-14auto merge of #4911 : lifthrasiir/rust/comment-exemptions, r=catamorphismbors-11/+26
This is a natural extension of #4887, and handles the following three cases: ~~~~ a line with only /s //////////////////////////////////////////// a line with only /s followed by whitespace //////////////////////////////////////////// a block comment with only *s between two /s /********************************/ ~~~~
2013-02-14librustc: Replace `impl Type : Trait` with `impl Trait for Type`. ↵Patrick Walton-1/+1
rs=implflipping
2013-02-13Remove die!, raplace invocations with fail! Issue #4524 pt 3Nick Desaulniers-1/+1
2013-02-13libsyntax: don't parse ////, /***/ as doc commentsKang Seonghoon-11/+26
2013-02-08Add and lex LIFETIME tokensNiko Matsakis-16/+81
cc #4846
2013-02-07librustc: Lots of de-muting. rs=demutingPatrick Walton-79/+78
2013-02-07auto merge of #4791 : jbclements/rust/demodeing-and-deGCing, r=jbclements,brsonbors-44/+45
r? It looks to me like the string_reader and tt_reader structs are GC pointers only because they predate the modern borrow system. This commit leaves the type names string_reader and tt_reader alone (they still refer to GC-ed pointers), but internally the functions now use borrowed pointers to refer to these structures. My guess would be that it's possible to move this change outward and not use the GCed pointers at all, but that change looks like it could be a larger one. Actually, I'm delighted at how quick this change was.
2013-02-06libsyntax: no binary/hex float literalsKang Seonghoon-0/+7
2013-02-04demodeing, un-gc-ingJohn Clements-44/+45
It looks to me like the string_reader and tt_reader structs are GC pointers only because they predate the modern borrow system. This commit leaves the type names string_reader and tt_reader alone (they still refer to GC-ed pointers), but internally the functions now use borrowed pointers to refer to these structures. My guess would be that it's possible to move this change outward and not use the GCed pointers at all, but that change looks like it could be a larger one. Actually, I'm delighted at how quick this change was.
2013-02-03Converted libcore/uint-template.rs to the new string functions.Marvin Löbel-2/+2
- Moved ToStr implementation of unsigned integers to uint-template.rs. - Marked the `str()` function as deprecated. - Forwarded all conversion functions to `core::num::to_str_common()` and `core::num::from_str_common()`. - Fixed most places in the codebase where `to_str()` is being used. - Added uint-template to_str and from_str overflow tests.
2013-01-31test cases, cleanupJohn Clements-32/+81
2013-01-31Replace most invocations of fail keyword with die! macroNick Desaulniers-1/+1
2013-01-29libsyntax: De-export a lot of libsyntax. rs=deëxportingPatrick Walton-20/+17
2013-01-29libstd: Remove "dual impls" from the language and enforce coherence rules. ↵Patrick Walton-1/+1
r=brson "Dual impls" are impls that are both type implementations and trait implementations. They can lead to ambiguity and so this patch removes them from the language. This also enforces coherence rules. Without this patch, records can implement traits not defined in the current crate. This patch fixes this, and updates all of rustc to adhere to the new enforcement. Most of this patch is fixing rustc to obey the coherence rules, which involves converting a bunch of records to structs.
2013-01-23libsyntax: Remove `fn() unsafe { ... }`. r=graydonPatrick Walton-5/+7
2013-01-08librustc: Make unqualified identifier searches terminate at the nearest ↵Patrick Walton-1/+3
module scope. r=tjc
2013-01-08Revert "librustc: Make unqualified identifier searches terminate at the ↵Patrick Walton-3/+1
nearest module scope. r=tjc" This reverts commit a8d37af2473da79be704c9ce2374f278c47177b6.