Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | | add missing files with inline tests | darksv | 2018-09-14 | 2 | -0/+13 | |
| | | ||||||
* | | Support for unions | darksv | 2018-09-14 | 4 | -7/+161 | |
|/ | ||||||
* | don't get stuck in slice patterns | Aleksey Kladov | 2018-09-12 | 2 | -21/+122 | |
| | ||||||
* | correctly setup path-map for fs-changes | Aleksey Kladov | 2018-09-12 | 1 | -23/+24 | |
| | ||||||
* | Merge #68 | bors[bot] | 2018-09-11 | 9 | -28/+98 | |
|\ | | | | | | | | | | | | | | | 68: Implement incremental reparsing for remaining braced blocks r=matklad a=darksv Fixes #66 Co-authored-by: darksv <[email protected]> | |||||
| * | Do not reparse token tree when it is not delimited by braces | darksv | 2018-09-10 | 2 | -1/+6 | |
| | | ||||||
| * | Implement reparsing for remaining blocks | darksv | 2018-09-10 | 9 | -28/+93 | |
| | | ||||||
* | | store file rsovler | Aleksey Kladov | 2018-09-10 | 7 | -116/+146 | |
|/ | ||||||
* | Merge #65 | bors[bot] | 2018-09-08 | 1 | -1/+1 | |
|\ | | | | | | | | | | | | | | | 65: simplify r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]> | |||||
| * | simplify | Aleksey Kladov | 2018-09-08 | 1 | -1/+1 | |
| | | ||||||
* | | Fix yet another parser infinite loop | Aleksey Kladov | 2018-09-08 | 2 | -8/+10 | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is an example of fixing a common parser error: infinite loop due to error recovery. This error typically happens when we parse a list of items and fail to parse a specific item at the current position. One choices is to skip a token and try to parse a list item at the next position. This is a good, but not universal, default. When parsing a list of arguments in a function call, you, for example, don't want to skip over `fn`, because it's most likely that it is a function declaration, and not a mistyped arg: ``` fn foo() { quux(1, 2 fn bar() { } ``` Another choice is to bail out of the loop immediately, but it isn't perfect either: sometimes skipping over garbage helps: ``` quux(1, foo:, 92) // should skip over `:`, b/c that's part of `foo::bar` ``` In general, parser tries to balance these two cases, though we don't have a definitive strategy yet. However, if the parser accidentally neither skips over a token, nor breaks out of the loop, then it becomes stuck in the loop infinitely (there's an internal counter to self-check this situation and panic though), and that's exactly what is demonstrated by the test. To fix such situation, first of all, add the test case to tests/data/parser/{err,fuzz-failures}. Then, run ``` RUST_BACKTRACE=short cargo test --package libsyntax2 ```` to verify that parser indeed panics, and to get an idea what grammar production is the culprit (look for `_list` functions!). In this case, I see ``` 10: libsyntax2::grammar::expressions::atom::match_arm_list at crates/libsyntax2/src/grammar/expressions/atom.rs:309 ``` and that's look like it might be a culprit. I verify it by adding `eprintln!("loopy {:?}", p.current());` and indeed I see that this is printed repeatedly. Diagnosing this a bit shows that the problem is that `pattern::pattern` function does not consume anything if the next token is `let`. That is a good default to make cases like ``` let let foo = 92; ``` where the user hasn't typed the pattern yet, to parse in a reasonable they correctly. For match arms, pretty much the single thing we expect is a pattern, so, for a fix, I introduce a special variant of pattern that does not do recovery. | |||||
* | | Add fuzz failures dir | Aleksey Kladov | 2018-09-08 | 2 | -4/+213 | |
|/ | ||||||
* | move fuzz-invariants to the library | Aleksey Kladov | 2018-09-08 | 3 | -41/+44 | |
| | ||||||
* | Add trivial fuzzer for parser | Pascal Hertleif | 2018-09-08 | 3 | -0/+38 | |
| | | | | | | | | | | | | | As described in #61, fuzz testing some parts of this would be ~~fun~~ helpful. So, I started with the most trivial fuzzer I could think of: Put random stuff into File::parse and see what happens. To speed things up, I also did cp src/**/*.rs fuzz/corpus/parser/ in the `crates/libsyntax2/` directory (running the fuzzer once will generate the necessary directories). | |||||
* | Don't overflow when limiting symbol search | Aleksey Kladov | 2018-09-08 | 1 | -3/+2 | |
| | ||||||
* | Some abstraction around workers | Aleksey Kladov | 2018-09-08 | 5 | -74/+92 | |
| | ||||||
* | Deal with deadlocks in a more principaled way | Aleksey Kladov | 2018-09-08 | 6 | -27/+39 | |
| | ||||||
* | fix deadlock | Aleksey Kladov | 2018-09-08 | 1 | -14/+18 | |
| | ||||||
* | Fix block structure in enums | Aleksey Kladov | 2018-09-08 | 5 | -25/+274 | |
| | ||||||
* | simplify | Aleksey Kladov | 2018-09-08 | 5 | -9/+14 | |
| | ||||||
* | Don't get stuck in tuple exprs | Aleksey Kladov | 2018-09-08 | 4 | -96/+484 | |
| | ||||||
* | Don't get stuck in macros | Aleksey Kladov | 2018-09-08 | 3 | -1/+54 | |
| | ||||||
* | fix stuck parser | Aleksey Kladov | 2018-09-08 | 7 | -2/+719 | |
| | ||||||
* | fix labled expressions | Aleksey Kladov | 2018-09-08 | 9 | -14/+313 | |
| | ||||||
* | nested mod completion | Aleksey Kladov | 2018-09-07 | 5 | -46/+68 | |
| | ||||||
* | Remove dyn dispatch | Aleksey Kladov | 2018-09-07 | 3 | -21/+65 | |
| | ||||||
* | Separete API from IMPL | Aleksey Kladov | 2018-09-07 | 1 | -14/+14 | |
| | | | | | | Looks like there's a rule of thumb: don't call API functions from an implementation! In this case, following this rule of thumb saves us an Arc-bump! | |||||
* | Moved TokenSet into it's own file. | Zac Winter | 2018-09-06 | 4 | -37/+41 | |
| | ||||||
* | better introduce | Aleksey Kladov | 2018-09-05 | 1 | -8/+26 | |
| | ||||||
* | introduce variable | Aleksey Kladov | 2018-09-05 | 6 | -10/+72 | |
| | ||||||
* | use correct workdir for the server | Aleksey Kladov | 2018-09-05 | 2 | -10/+19 | |
| | ||||||
* | even less hacks | Aleksey Kladov | 2018-09-05 | 1 | -18/+16 | |
| | ||||||
* | less hacky paths | Aleksey Kladov | 2018-09-05 | 1 | -12/+9 | |
| | ||||||
* | Merge #56 | bors[bot] | 2018-09-05 | 5 | -45/+137 | |
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 56: Unify lookahead naming between parser and lexer. r=matklad a=zachlute Resolves Issue #26. I wanted to play around with libsyntax2, and fixing a random issue seemed like a good way to mess around in the code. This PR mostly does what's suggested in that issue. I elected to go with `at` and `at_str` instead of trying to do any fancy overloading shenanigans, because...uh, well, frankly I don't really know how to do any fancy overloading shenanigans. The only really questionable bit is `nth_is_p`, which could also have potentially been named `nth_at_p`, but `is` seemed more apropos. I also added simple tests for `Ptr` so I could be less terrified I broke something. Comments and criticisms very welcome. I'm still pretty new to Rust. Co-authored-by: Zach Lute <[email protected]> | |||||
| * | Added tests for Ptr. | Zach Lute | 2018-09-05 | 1 | -0/+78 | |
| | | ||||||
| * | Updated Ptr methods to better match Parser method names. | Zach Lute | 2018-09-05 | 5 | -45/+59 | |
| | | ||||||
* | | fix tests on windows | Aleksey Kladov | 2018-09-05 | 1 | -4/+11 | |
|/ | ||||||
* | switch to rayon threadpool | Aleksey Kladov | 2018-09-04 | 3 | -8/+10 | |
| | ||||||
* | simplify | Aleksey Kladov | 2018-09-04 | 1 | -5/+5 | |
| | ||||||
* | better extend selection | Aleksey Kladov | 2018-09-04 | 1 | -24/+59 | |
| | ||||||
* | for types in bounds | Aleksey Kladov | 2018-09-04 | 17 | -192/+311 | |
| | ||||||
* | dont change readonly files | Aleksey Kladov | 2018-09-04 | 2 | -22/+34 | |
| | ||||||
* | micro-optimize | Aleksey Kladov | 2018-09-04 | 1 | -2/+3 | |
| | ||||||
* | accidentally quadratic | Aleksey Kladov | 2018-09-04 | 1 | -16/+35 | |
| | ||||||
* | work | Aleksey Kladov | 2018-09-04 | 4 | -12/+15 | |
| | ||||||
* | extern blocks | Aleksey Kladov | 2018-09-03 | 8 | -8/+1032 | |
| | ||||||
* | switch to internal feedback | Aleksey Kladov | 2018-09-03 | 6 | -79/+35 | |
| | ||||||
* | fix the test | Aleksey Kladov | 2018-09-03 | 1 | -2/+2 | |
| | ||||||
* | faster text len | Aleksey Kladov | 2018-09-03 | 2 | -2/+2 | |
| | ||||||
* | index libraies off the main thread | Aleksey Kladov | 2018-09-03 | 5 | -13/+39 | |
| |