aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge #67bors[bot]2018-09-151-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | 67: Salsa r=matklad a=matklad The aim of this PR is to transition from rather ad-hock FileData and ModuleMap caching strategy to something resembling a general-purpose red-green engine. Ideally, we shouldn't recompute ModuleMap at all, unless the set of mod decls or files changes. Co-authored-by: Aleksey Kladov <[email protected]>
| * add deps trackingAleksey Kladov2018-09-151-1/+1
| |
* | Merge #69bors[bot]2018-09-153-123/+359
|\ \ | |/ |/| | | | | | | | | | | 69: Incremental reparsing for single tokens r=matklad a=darksv Implement incremental reparsing for `WHITESPACE`, `COMMENT`, `DOC_COMMENT`, `IDENT`, `STRING` and `RAW_STRING`. This allows to avoid reparsing whole blocks when a change was made only within these tokens. Co-authored-by: darksv <[email protected]>
| * independent tests for incremental reparsing of blocks and leavesdarksv2018-09-151-48/+68
| |
| * move reparsing testsdarksv2018-09-152-0/+139
| |
| * create separated mod for reparsing functionalitydarksv2018-09-153-170/+200
| |
| * correctly handle IDENTs when changed to contextual keywordsdarksv2018-09-141-1/+15
| |
| * create leaf directly without calling the parserdarksv2018-09-141-23/+2
| |
| * Incremental reparsing for single tokens (WHITESPACE, COMMENT, DOC_COMMENT, ↵darksv2018-09-131-13/+67
| | | | | | | | IDENT, STRING, RAW_STRING)
* | Support for unionsdarksv2018-09-142-7/+30
|/
* don't get stuck in slice patternsAleksey Kladov2018-09-121-21/+16
|
* Do not reparse token tree when it is not delimited by bracesdarksv2018-09-101-1/+1
|
* Implement reparsing for remaining blocksdarksv2018-09-108-13/+47
|
* Merge #65bors[bot]2018-09-081-1/+1
|\ | | | | | | | | | | | | | | 65: simplify r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
| * simplifyAleksey Kladov2018-09-081-1/+1
| |
* | Fix yet another parser infinite loopAleksey Kladov2018-09-082-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.
* move fuzz-invariants to the libraryAleksey Kladov2018-09-082-37/+43
|
* Fix block structure in enumsAleksey Kladov2018-09-082-6/+15
|
* simplifyAleksey Kladov2018-09-085-9/+14
|
* Don't get stuck in tuple exprsAleksey Kladov2018-09-081-0/+4
|
* Don't get stuck in macrosAleksey Kladov2018-09-081-1/+6
|
* fix stuck parserAleksey Kladov2018-09-082-2/+11
|
* fix labled expressionsAleksey Kladov2018-09-081-6/+16
|
* nested mod completionAleksey Kladov2018-09-073-24/+21
|
* Remove dyn dispatchAleksey Kladov2018-09-073-21/+65
|
* Moved TokenSet into it's own file.Zac Winter2018-09-064-37/+41
|
* Added tests for Ptr.Zach Lute2018-09-051-0/+78
|
* Updated Ptr methods to better match Parser method names.Zach Lute2018-09-055-45/+59
|
* simplifyAleksey Kladov2018-09-041-5/+5
|
* for types in boundsAleksey Kladov2018-09-042-12/+21
|
* accidentally quadraticAleksey Kladov2018-09-041-16/+35
|
* extern blocksAleksey Kladov2018-09-032-1/+3
|
* faster text lenAleksey Kladov2018-09-031-1/+1
|
* completion for trait paramsAleksey Kladov2018-09-032-0/+2
|
* Complete paramsAleksey Kladov2018-09-035-14/+43
|
* method call scopeAleksey Kladov2018-09-033-6/+18
|
* match scopeAleksey Kladov2018-09-022-6/+36
|
* Type aliases to scopeAleksey Kladov2018-09-012-1/+4
|
* complete selfAleksey Kladov2018-08-312-0/+23
|
* default method name to type nameAleksey Kladov2018-08-313-83/+47
|
* tweak extend selectionAleksey Kladov2018-08-311-0/+12
|
* start item recoveryAleksey Kladov2018-08-315-9/+17
|
* break/continue completionAleksey Kladov2018-08-303-16/+13
|
* complete importsAleksey Kladov2018-08-302-5/+106
|
* Complete typesAleksey Kladov2018-08-302-1/+20
|
* add impl works with lifetimesAleksey Kladov2018-08-284-8/+119
|
* simplifyAleksey Kladov2018-08-281-0/+3
|
* be more careful with adding semisAleksey Kladov2018-08-281-0/+6
|
* Add ret typeAleksey Kladov2018-08-284-0/+29
|
* better pattern recoveryAleksey Kladov2018-08-283-2/+12
|