about summary refs log tree commit diff
path: root/src/libsyntax/parse/mod.rs
AgeCommit message (Collapse)AuthorLines
2019-01-24Remove quote_*! macros and associated APIsMark Simulacrum-22/+17
2019-01-20Auto merge of #57651 - JohnTitor:give-char-type, r=estebankbors-0/+1
Implement new literal type `Err` Fixes #57384 I removed `return Ok`, otherwise, two errors occur. Any solutions? r? @estebank
2019-01-20Mark incorrect recovered `char` literals as `TyErr` to avoid type errorsYuki Okushi-1/+1
2019-01-19Rollup merge of #57486 - nnethercote:simplify-TokenStream-more, r=petrochenkovMazdak Farrokhzad-3/+3
Simplify `TokenStream` some more These commits simplify `TokenStream`, remove `ThinTokenStream`, and avoid some clones. The end result is simpler code and a slight perf win on some benchmarks. r? @petrochenkov
2019-01-16Add new literal type ErrYuki Okushi-0/+1
2019-01-14Remove `ThinTokenStream`.Nicholas Nethercote-3/+3
`TokenStream` is now almost identical to `ThinTokenStream`. This commit removes the latter, replacing it with the former.
2019-01-11Add label for invalid literal suffixEsteban Küber-0/+2
2019-01-11Continue evaluating after incorrect float literalEsteban Küber-1/+5
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-17Tweak query code for performanceJohn Kåre Alsaker-0/+1
2018-12-17Auto merge of #56737 - nnethercote:TokenStream-improvements, r=petrochenkovbors-3/+3
`TokenStream` improvements Some `TokenStream` improvements: shrinking `TokenStream` and some other types, and some other code clean-ups.
2018-12-14Rollup merge of #56658 - Xanewok:non-panicking-file-parser, r=petrochenkovkennytm-8/+29
Add non-panicking `maybe_new_parser_from_file` variant Add (seemingly?) missing `maybe_new_parser_from_file` constructor variant. Disclaimer: I'm not certain this is the correct approach - just found out we don't have this when working on a Rustfmt PR to catch/prevent more Rust parser panics: https://github.com/rust-lang/rustfmt/pull/3240 and tried to make it work somehow.
2018-12-12Rename `TokenStream::concat` and remove `TokenStream::concat_rc_vec`.Nicholas Nethercote-3/+3
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
2018-12-10Remove `tokenstream::Delimited`.Nicholas Nethercote-32/+29
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
2018-12-09Add missing, non-panicking `maybe_new_parser_from_file` variantIgor Matuszewski-8/+29
2018-12-06Auto merge of #54517 - mcr431:53956-panic-on-include_bytes-of-own-file, ↵bors-4/+6
r=michaelwoerister 53956 panic on include bytes of own file fix #53956 When using `include_bytes!` on a source file in the project, compiler would panic on subsequent compilations because `expand_include_bytes` would overwrite files in the source_map with no source. This PR changes `expand_include_bytes` to check source_map and use the already existing src, if any.
2018-12-04adds DocTest filename variant, refactors doctest_offset out of source_map, ↵Matthew Russo-4/+6
fixes remaining test failures
2018-12-04Use iterator and pattern APIs instead of `char_at`Shotaro Yamada-9/+6
2018-11-14Clean up some non-mod-rs stuff.Eric Huss-4/+0
2018-11-04Auto merge of #54861 - rep-nop:find_main_in_doctest, r=estebankbors-8/+42
rustdoc: Replaces fn main search and extern crate search with proper parsing during doctests. Fixes #21299. Fixes #33731. Let me know if there's any additional changes you'd like made!
2018-11-02implement existing parser fns in terms of fallible fnsQuietMisdreavus-14/+4
2018-11-01buffer errors from initial tokenization when parsingQuietMisdreavus-2/+46
2018-10-29Rename other occs of (Code/File)Map to Source(Map/File) #51574David Lavati-4/+4
2018-10-26Avoid unnecessary allocations in `float_lit` and `integer_lit`.Nicholas Nethercote-4/+19
This commit avoids an allocation when parsing any float and integer literals that don't involved underscores. This reduces the number of allocations done for the `tuple-stress` benchmark by 10%, reducing its instruction count by just under 1%.
2018-10-21Fix a few tests with target-specific outputVadim Petrochenkov-1/+1
Enable one fully ignored test
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-3/+3
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-4/+4
2018-08-21Rollup merge of #53521 - alexcrichton:optimize-lit-token, r=michaelwoeristerkennytm-6/+4
syntax: Optimize some literal parsing Currently in the `wasm-bindgen` project we have a very very large crate that's procedurally generated, `web-sys`. To generate this crate we parse all of a browser's WebIDL and we then generate bindings for all of the APIs contained within. The resulting Rust file is 18MB large (wow!) and currently takes a very long time to compile in debug mode. On the nightly compiler a *debug* build takes 90s for the crate to finish. I was curious what was taking so long and upon investigating a *massive* portion of the time was spent in the `lit_token` method of the compiler, primarily formatting strings via `format!`. Upon some more investigation it looks like the `byte_str_lit` was allocating an error message once per byte, causing a very large number of allocations to happen for large literals, of which wasm-bindgen generates quite a few (some are MB large). This commit fixes the issue by lazily allocating the error message, only doing so if the error message is actually needed (which should be never). As a result, the debug mode compilation time for our `web-sys` crate decreased from 90s to 20s, a very nice improvement! (although we've still got some work to do).
2018-08-20syntax: Optimize some literal parsingAlex Crichton-6/+4
Currently in the `wasm-bindgen` project we have a very very large crate that's procedurally generated, `web-sys`. To generate this crate we parse all of a browser's WebIDL and we then generate bindings for all of the APIs contained within. The resulting Rust file is 18MB large (wow!) and currently takes a very long time to compile in debug mode. On the nightly compiler a *debug* build takes 90s for the crate to finish. I was curious what was taking so long and upon investigating a *massive* portion of the time was spent in the `lit_token` method of the compiler, primarily formatting strings via `format!`. Upon some more investigation it looks like the `byte_str_lit` was allocating an error message once per byte, causing a very large number of allocations to happen for large literals, of which wasm-bindgen generates quite a few (some are MB large). This commit fixes the issue by lazily allocating the error message, only doing so if the error message is actually needed (which should be never). As a result, the debug mode compilation time for our `web-sys` crate decreased from 90s to 20s, a very nice improvement! (although we've still got some work to do).
2018-08-19fix tidy errorsDonato Sciarra-2/+3
2018-08-19mv codemap source_mapDonato Sciarra-2/+2
2018-08-19mv codemap() source_map()Donato Sciarra-5/+5
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-19mv filemap source_fileDonato Sciarra-14/+14
2018-08-19mv FileMap SourceFileDonato Sciarra-4/+4
2018-08-19mv CodeMap SourceMapDonato Sciarra-5/+5
2018-07-23dump lints _after_ parsing macrosmark-3/+3
2018-07-23Extend ParseSess to support buffering lintsmark-2/+21
2018-07-14Remove some tests using AST comparisons, fix other testsVadim Petrochenkov-204/+26
2018-06-30Fortify dummy span checkingVadim Petrochenkov-3/+3
2018-06-23Auto merge of #51580 - cramertj:async-await, r=eddybbors-5/+8
async/await This PR implements `async`/`await` syntax for `async fn` in Rust 2015 and `async` closures and `async` blocks in Rust 2018 (tracking issue: https://github.com/rust-lang/rust/issues/50547). Limitations: non-`move` async closures with arguments are currently not supported, nor are `async fn` with multiple different input lifetimes. These limitations are not fundamental and will be removed in the future, however I'd like to go ahead and get this PR merged so we can start experimenting with this in combination with futures 0.3. Based on https://github.com/rust-lang/rust/pull/51414. cc @petrochenkov for parsing changes. r? @eddyb
2018-06-22Re-reexport some items that were recently made crate-private.Tim Kuehn-1/+1
2018-06-21Parse async fn header.Without Boats-5/+8
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-09Crate-ify and delete unused code in syntax::parseMark Simulacrum-20/+37
2018-05-20lexer: Fix span override for the first token in a stringVadim Petrochenkov-2/+1
2018-05-18Make `Directory::path` a `Cow`.Nicholas Nethercote-2/+3
Because we create a lot of these in the macro parser, but only very rarely modify them. This speeds up some html5ever runs by 2--3%.
2018-05-09Optimize string handling in lit_token().Nicholas Nethercote-6/+17
In the common case, the string value in a string literal Token is the same as the string value in a string literal LitKind. (The exception is when escapes or \r are involved.) This patch takes advantage of that to avoid calling str_lit() and re-interning the string in that case. This speeds up incremental builds for a few of the rustc-benchmarks, the best by 3%.
2018-05-03Remove parse::escape_default().Nicholas Nethercote-6/+2
str::escape_default() can be used instead.
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-1/+1
2018-04-19Avoid allocating when parsing \u{...} literals.Nicholas Nethercote-2/+10
`char_lit` uses an allocation in order to ignore '_' chars in \u{...} literals. This patch changes it to not do that by processing the chars more directly. This improves various rustc-perf benchmark measurements by up to 6%, particularly regex, futures, clap, coercions, hyper, and encoding.