Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | rename all things | Aleksey Kladov | 2018-09-16 | 15 | -2720/+0 |
| | |||||
* | Support for unions | darksv | 2018-09-14 | 2 | -7/+30 |
| | |||||
* | don't get stuck in slice patterns | Aleksey Kladov | 2018-09-12 | 1 | -21/+16 |
| | |||||
* | Implement reparsing for remaining blocks | darksv | 2018-09-10 | 7 | -13/+32 |
| | |||||
* | 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. | ||||
* | Fix block structure in enums | Aleksey Kladov | 2018-09-08 | 2 | -6/+15 |
| | |||||
* | simplify | Aleksey Kladov | 2018-09-08 | 4 | -9/+9 |
| | |||||
* | Don't get stuck in tuple exprs | Aleksey Kladov | 2018-09-08 | 1 | -0/+4 |
| | |||||
* | Don't get stuck in macros | Aleksey Kladov | 2018-09-08 | 1 | -1/+6 |
| | |||||
* | fix stuck parser | Aleksey Kladov | 2018-09-08 | 2 | -2/+11 |
| | |||||
* | fix labled expressions | Aleksey Kladov | 2018-09-08 | 1 | -6/+16 |
| | |||||
* | Moved TokenSet into it's own file. | Zac Winter | 2018-09-06 | 1 | -1/+2 |
| | |||||
* | for types in bounds | Aleksey Kladov | 2018-09-04 | 2 | -12/+21 |
| | |||||
* | extern blocks | Aleksey Kladov | 2018-09-03 | 1 | -0/+1 |
| | |||||
* | Complete params | Aleksey Kladov | 2018-09-03 | 2 | -2/+5 |
| | |||||
* | start item recovery | Aleksey Kladov | 2018-08-31 | 4 | -6/+14 |
| | |||||
* | add impl works with lifetimes | Aleksey Kladov | 2018-08-28 | 1 | -3/+4 |
| | |||||
* | Add ret type | Aleksey Kladov | 2018-08-28 | 1 | -0/+2 |
| | |||||
* | better pattern recovery | Aleksey Kladov | 2018-08-28 | 1 | -1/+5 |
| | |||||
* | better recovery for exprs | Aleksey Kladov | 2018-08-28 | 1 | -1/+4 |
| | |||||
* | Fix error blocks | Aleksey Kladov | 2018-08-27 | 4 | -0/+17 |
| | |||||
* | move scopes to file | Aleksey Kladov | 2018-08-27 | 1 | -2/+2 |
| | |||||
* | Support if-let in scopes | Aleksey Kladov | 2018-08-27 | 1 | -1/+3 |
| | |||||
* | fix curly braces parsing | Aleksey Kladov | 2018-08-26 | 1 | -2/+9 |
| | |||||
* | scope based comletion | Aleksey Kladov | 2018-08-26 | 1 | -2/+2 |
| | |||||
* | fix stray curly | Aleksey Kladov | 2018-08-26 | 1 | -1/+6 |
| | |||||
* | Require semi after exprs | Aleksey Kladov | 2018-08-25 | 1 | -3/+8 |
| | |||||
* | incremental reparse | Aleksey Kladov | 2018-08-25 | 1 | -3/+3 |
| | |||||
* | fix assertione error on block parsing | Aleksey Kladov | 2018-08-25 | 3 | -9/+8 |
| | |||||
* | start incremental reparse | Aleksey Kladov | 2018-08-25 | 4 | -3/+9 |
| | |||||
* | rename file -> root | Aleksey Kladov | 2018-08-25 | 1 | -1/+1 |
| | |||||
* | parameter parsing does not destroy blocks | Aleksey Kladov | 2018-08-24 | 7 | -3/+34 |
| | |||||
* | nodes for blocks | Aleksey Kladov | 2018-08-24 | 8 | -133/+203 |
| | |||||
* | Labeled expressions | Aleksey Kladov | 2018-08-24 | 2 | -17/+46 |
| | |||||
* | break&continue | Aleksey Kladov | 2018-08-24 | 1 | -1/+38 |
| | |||||
* | renames | Aleksey Kladov | 2018-08-24 | 11 | -28/+28 |
| | |||||
* | better self-types | Aleksey Kladov | 2018-08-23 | 4 | -9/+11 |
| | |||||
* | Simplify | Aleksey Kladov | 2018-08-23 | 1 | -28/+26 |
| | |||||
* | rename | Aleksey Kladov | 2018-08-23 | 3 | -4/+4 |
| | |||||
* | Allow arbitrary self-types | Aleksey Kladov | 2018-08-23 | 1 | -13/+26 |
| | |||||
* | allow field attrs | Aleksey Kladov | 2018-08-16 | 1 | -3/+9 |
| | |||||
* | tt-attrs | Aleksey Kladov | 2018-08-16 | 2 | -56/+7 |
| | |||||
* | full range expr | Aleksey Kladov | 2018-08-14 | 1 | -1/+5 |
| | |||||
* | Qualified paths | Aleksey Kladov | 2018-08-13 | 4 | -19/+32 |
| | |||||
* | Fix some more bugs | Aleksey Kladov | 2018-08-13 | 2 | -2/+8 |
| | |||||
* | Optional patterns in trait methods | Aleksey Kladov | 2018-08-13 | 3 | -10/+19 |
| | |||||
* | More renames | Aleksey Kladov | 2018-08-13 | 4 | -12/+12 |
| | |||||
* | Safer errors | Aleksey Kladov | 2018-08-13 | 2 | -6/+3 |
| | |||||
* | renames | Aleksey Kladov | 2018-08-13 | 1 | -7/+7 |
| | |||||
* | Fix some parser bugs | Aleksey Kladov | 2018-08-13 | 4 | -5/+17 |
| |