14e86eb7d9
This PR detects misspelled keywords using two heuristics: 1. Lowercasing the unexpected identifier. 2. Using edit distance to find a keyword similar to the unexpected identifier. However, it does not detect each and every misspelled keyword to minimize false positives and ambiguities. More details about the implementation can be found in the comments.
25 lines
589 B
Plaintext
25 lines
589 B
Plaintext
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `a`
|
|
--> $DIR/let.rs:2:9
|
|
|
|
|
LL | Let a = 10;
|
|
| ^ expected one of 8 possible tokens
|
|
|
|
|
help: write keyword `let` in lowercase
|
|
|
|
|
LL | let a = 10;
|
|
| ~~~
|
|
|
|
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `a`
|
|
--> $DIR/let.rs:7:10
|
|
|
|
|
LL | lett a = 10;
|
|
| ^ expected one of 8 possible tokens
|
|
|
|
|
help: there is a keyword `let` with a similar name
|
|
|
|
|
LL | let a = 10;
|
|
| ~~~
|
|
|
|
error: aborting due to 2 previous errors
|
|
|