about summary refs log tree commit diff
path: root/src/libsyntax/parse/mod.rs
AgeCommit message (Collapse)AuthorLines
2019-09-12Box `DiagnosticBuilder`.Nicholas Nethercote-0/+7
It's a large type -- 176 bytes on 64-bit. And it's passed around and returned from a lot of functions, including within PResult. This commit boxes it, which reduces memory traffic. In particular, `PResult` shrinks to 16 bytes in the best case; this reduces instruction counts by up to 2% on various workloads.
2019-09-07Rollup merge of #64226 - alexreg:rush-pr-3, r=centrilMazdak Farrokhzad-26/+27
Aggregation of cosmetic changes made during work on REPL PRs: libsyntax Factored out from hacking on rustc for work on the REPL. r? @Centril
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: libsyntaxAlexander Regueiro-26/+27
2019-09-05Replace diagnostic plugins with macro_rulesMark Rousskov-4/+0
2019-08-20Use dedicated type for spans in pre-expansion gating.Mazdak Farrokhzad-14/+18
2019-08-17initial implementation of or-pattern parsingDan Robertson-0/+3
Initial implementation of parsing or-patterns e.g., `Some(Foo | Bar)`. This is a partial implementation of RFC 2535.
2019-08-16Feature gate 'yield ?' pre-expansion.Mazdak Farrokhzad-0/+3
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-1/+1
For naming consistency with everything else in this area
2019-08-15syntax_pos: Remove the duplicate global editionVadim Petrochenkov-1/+2
It was introduced to avoid going through `hygiene_data`, but now it's read only once, when `ParseSess` is created, so going through a lock is ok.
2019-08-02Auto merge of #63207 - petrochenkov:outest2, r=Mark-Simulacrumbors-292/+4
Unconfigure compiler unit test files during normal build I haven't touched libstd though, it had a lot of tests and I'm not sure the people maintaining it want this. Closes https://github.com/rust-lang/rust/issues/61097 r? @Mark-Simulacrum
2019-08-02libsyntax: Unconfigure tests during normal buildVadim Petrochenkov-292/+4
2019-08-02Fix typos in doc comments.Bruce Mitchener-1/+1
2019-07-27Move standard library injection into libsyntax_extVadim Petrochenkov-1/+4
2019-07-21move unescape module to rustc_lexerAleksey Kladov-1/+0
2019-07-06Rollup merge of #62329 - matklad:no-peeking, r=petrochenkovMazdak Farrokhzad-1/+1
Remove support for 1-token lookahead from the lexer `StringReader` maintained `peek_token` and `peek_span_src_raw` for look ahead. `peek_token` was used only by rustdoc syntax coloring. After moving peeking logic into highlighter, I was able to remove `peek_token` from the lexer. I tried to use `iter::Peekable`, but that wasn't as pretty as I hoped, due to buffered fatal errors. So I went with hand-rolled peeking. After that I've noticed that the only peeking behavior left was for raw tokens to test tt jointness. I've rewritten it in terms of trivia tokens, and not just spans. After that it became possible to simplify the awkward constructor of the lexer, which could return `Err` if the first peeked token contained error.
2019-07-04cleanup lexer constructorsAleksey Kladov-1/+1
2019-07-03Add separate 'async_closure' feature gate.Mazdak Farrokhzad-0/+3
2019-06-23let_chains: Move feature gating to pre-expansion.Mazdak Farrokhzad-1/+4
2019-06-12Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkovbors-0/+2
Allow attributes in formal function parameters Implements https://github.com/rust-lang/rust/issues/60406. This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made. **TODO** - [x] Forbid some built-in attributes. - [x] Expand cfg/cfg_attr
2019-06-12Rollup merge of #61654 - Electron-libre:use_slice_patterns_in_rustc, ↵Mazdak Farrokhzad-37/+27
r=oli-obk,Centril use pattern matching for slices destructuring refs #61542 Use slices pattern where it seems to make sense .
2019-06-09Allow attributes in formal function parametersCaio-0/+2
2019-06-08syntax: Remove `Deref` impl from `Token`Vadim Petrochenkov-2/+2
2019-06-08fix libsyntax testCedric-4/+4
2019-06-08cast vec to slicesCedric-5/+5
2019-06-08use default binding mode in match clausesCedric-5/+5
2019-06-08fix bad style for structsCedric-8/+8
2019-06-08improve styleCedric-13/+10
2019-06-08use pattern matching for slices destructuringCedric-31/+24
2019-06-07parser: `self.span` -> `self.token.span`Vadim Petrochenkov-2/+2
2019-06-06Some code cleanup and tidy/test fixesVadim Petrochenkov-6/+13
2019-06-06syntax: Switch function parameter order in `TokenTree::token`Vadim Petrochenkov-7/+7
2019-06-06syntax: Remove duplicate span from `token::Ident`Vadim Petrochenkov-19/+12
2019-06-06syntax: Use `Token` in `Parser`Vadim Petrochenkov-1/+1
2019-06-06syntax: Use `Token` in `TokenTree::Token`Vadim Petrochenkov-15/+16
2019-06-06syntax: Rename `Token` into `TokenKind`Vadim Petrochenkov-2/+2
2019-06-06Always use token kinds through `token` module rather than `Token` typeVadim Petrochenkov-1/+1
2019-05-24Fix rebaseEsteban Küber-4/+6
2019-05-24review commentsEsteban Küber-3/+3
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-4/+8
- Add detail on origin of current parser when reaching EOF and stop saying "found <eof>" and point at the end of macro calls - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error
2019-05-22Rollup merge of #60995 - topecongiro:parser-from-stream-and-base-dir, ↵Mazdak Farrokhzad-0/+17
r=michaelwoerister Add stream_to_parser_with_base_dir This PR adds `stream_to_parser_with_base_dir`, which creates a parser from a token stream and a base directory. Context: I would like to parse `cfg_if!` macro and get a list of modules defined inside it from rustfmt so that rustfmt can format those modules (cc https://github.com/rust-lang/rustfmt/issues/3253). To do so, I need to create a parser from `TokenStream` and set the directory of `Parser` to the same directory as the parent directory of a file which contains `cfg_if!` invocation. AFAIK there is no way to achieve this, and hence this PR. Alternatively, I could change the visibility of `Parser.directory` from `crate` to `pub` so that the value can be modified after initializing a parser. I don't have a preference over either approach (or others, as long as it works).
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-12/+15
2019-05-21Fix tidy: remove a trailing whitespacetopecongiro-1/+1
2019-05-21Add doc commenttopecongiro-0/+10
2019-05-21Add stream_to_parser_with_base_dirtopecongiro-0/+7
2019-05-16Auto merge of #60763 - matklad:tt-parser, r=petrochenkovbors-6/+6
Move token tree related lexer state to a separate struct Just a types-based refactoring. We only used a bunch of fields when tokenizing into a token tree, so let's move them out of the base lexer
2019-05-13move span and token to tt readerAleksey Kladov-2/+1
2019-05-13Move token tree related lexer state to a separate structAleksey Kladov-4/+5
We only used a bunch of fields when tokenizing into a token tree, so let's move them out of the base lexer
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-7/+9
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-2/+4
2019-05-11Move literal parsing code into a separate fileVadim Petrochenkov-345/+7
Remove some dead code