Markus Westerlind
b69e679d5b
fix: Don't accidentally cast a reduce action to usize
...
This caused panics in certain error recovery scenarios as a reduce action represented by a negative number would get casted to `usize` which then caused an index out of bounds panic.
The added tests were extracted and minimized from [gluon's grammar](abd06a4f6e/parser/src/grammar.lalrpop
) with the test case below being a minimal reproduction.
Panicking
```
type Test = a ->
```
Valid expression
```
type Test = a -> a
in 1
```
2017-01-28 16:22:37 +01:00
Niko Matsakis
333aaef2e8
Merge pull request #178 from Marwes/expected_tokens
...
feat: Add the expected successor tokens to UnrecognizedToken errors
2017-01-06 04:26:14 -05:00
Markus Westerlind
77c82c0cd4
feat: Add the expected successor tokens to UnrecognizedToken errors
...
This just adds the terminal strings defined in the grammar which is not the best possible information but it is better than no information.
Partial fix for #58
2016-12-28 19:31:06 +01:00
Niko Matsakis
5731a3f582
Merge pull request #175 from paupino/feature/fix-readme
...
Fixes typo in README.md for Configuration object
2016-12-04 03:46:10 -08:00
Paul Mason
54bad3c5f7
Fixes typo in README.md for Configuration object
2016-12-03 17:51:09 -08:00
Niko Matsakis
81efcba748
Merge pull request #174 from nikomatsakis/release-0.12.4
...
Release 0.12.4
0.12.4
2016-11-30 02:10:53 -08:00
Niko Matsakis
a3144a1b88
publish 0.12.4
2016-11-29 14:47:11 -05:00
Niko Matsakis
1e9e96be61
update RELEASES.md to talk about 0.12.4
2016-11-29 14:41:27 -05:00
Niko Matsakis
fa1c31eac8
bump version number to 0.12.4
2016-11-29 13:51:41 -05:00
Niko Matsakis
ec63b4e8a7
publish 0.12.3
2016-11-29 13:51:21 -05:00
Niko Matsakis
9c0d597afb
update releases to mention 0.12.3
2016-11-29 13:51:21 -05:00
Niko Matsakis
9b4d5d588d
update version numbers to 0.12.3
2016-11-29 13:51:21 -05:00
Niko Matsakis
5841facb69
fix parentheses
2016-11-29 13:51:21 -05:00
Niko Matsakis
69acad349d
release 0.12.2
2016-11-29 13:51:21 -05:00
Niko Matsakis
49ea2b4795
remove main.rs from lalrpop-snap
...
it interferes with publish
2016-11-29 13:51:21 -05:00
Niko Matsakis
a3745f4878
update version numbers for 0.12.2
2016-11-29 13:51:21 -05:00
Niko Matsakis
6b446e8831
Merge pull request #173 from Marwes/fix_clone
...
fix: Actually avoid all clones when not using error recovery
2016-11-29 10:39:54 -08:00
Markus Westerlind
bf7c7901e9
fix: Actually avoid all clones when not using error recovery
2016-11-29 17:54:37 +01:00
Niko Matsakis
47308d0d9d
Merge pull request #170 from Marwes/fix_clone_token
...
Only generate code for error recovery if it is used
2016-11-25 06:38:34 -08:00
Markus Westerlind
7a9b6e7117
Only generate code for error recovery if it is used
...
Since error recovery requires cloneable tokens we avoid emitting the error recovery code unless it is actually needed. Note that this change still keeps the error terminal in the generated tables.
2016-11-23 19:44:51 +01:00
Niko Matsakis
d710c1f3f0
Merge pull request #168 from nikomatsakis/snapshot
...
New snapshot
2016-11-23 01:55:08 -08:00
Niko Matsakis
99962ccb49
create new snapshot
2016-11-23 04:32:17 -05:00
Niko Matsakis
fd88178922
remove profile entries
2016-11-23 04:30:03 -05:00
Niko Matsakis
82cf10d5ba
update RELEASES.md with new activity
2016-11-23 04:21:44 -05:00
Niko Matsakis
a73ca78c89
Merge pull request #160 from Marwes/symbol_error
...
feat: Implement error recovery
2016-11-23 01:16:01 -08:00
Markus Westerlind
1fe5cf46c4
Add missing path dependency on the pascal demo
2016-11-22 23:20:04 +01:00
Markus Westerlind
18b179660b
Use !
instead of error
to indicate error recovery
2016-11-22 23:03:56 +01:00
Markus Westerlind
6bf1c9e940
Store the tokens dropped during error recovery in the produced type
2016-11-22 22:37:19 +01:00
Niko Matsakis
c07833ab31
improve docs and various nits in parse_table.rs
2016-11-22 22:36:10 +01:00
Niko Matsakis
fe854cc7fc
update tutorial wording, rm calculator6
2016-11-22 22:36:10 +01:00
Markus Westerlind
352ed58dce
Fix nits
2016-11-22 22:36:10 +01:00
Markus Westerlind
0a7f46cfde
Don't generate the ERROR table anymore
...
The information in the `ERROR` table is now encoded in `ACTION` under the error terminal.
2016-11-22 22:36:10 +01:00
Markus Westerlind
0811555dd4
Add basic documentation for error recovery
2016-11-22 22:36:10 +01:00
Markus Westerlind
ea31f3cdda
Merge the generation of error recovery as much as possible
...
The generated code is still duplicated but overall it is a miniscule
amount of code.
2016-11-22 22:36:10 +01:00
Markus Westerlind
80603e1e28
fix: Perform all reductions before shifting in error recovery
...
This fixes a problem in the newly added calculator7 test where error recovery would remove everything before the comma in `22 * 44 + 66, *3` as there would be no shift at that point. By first reducing the first expression the parser ends up in a state which properly has recovery installed and parsing can resume
2016-11-22 22:36:10 +01:00
Markus Westerlind
5c4c0d0f8a
Only generate a parse_table parser when testing error recovery
2016-11-22 22:36:10 +01:00
Markus Westerlind
4400e74cd6
Display a friendly error if using error recovery in a recursive ascent parser
2016-11-22 22:36:10 +01:00
Markus Westerlind
9ceaa09e0f
Add comments and fix nits
2016-11-22 22:36:10 +01:00
Markus Westerlind
0000be244f
Infer the type of error symbols
2016-11-22 22:36:10 +01:00
Markus Westerlind
6f6db1ec2f
Allow underscores to be part of LALRPOP identifiers
2016-11-22 22:36:10 +01:00
Markus Westerlind
1e3a543881
Fix compile error when running cargo test on the main crate
2016-11-22 22:36:10 +01:00
Markus Westerlind
39a033c477
Don't drop the token that caused an error
...
If we end up dropping some states in the first part of error recovery we may not need to skip any tokens at all.
2016-11-22 22:36:10 +01:00
Markus Westerlind
9dd99ce436
Don't enter an infinite loop if no recovery exists at EOF
2016-11-22 22:36:10 +01:00
Markus Westerlind
137e015f43
Add issue_55.rs to .gitignore
2016-11-22 22:36:10 +01:00
Markus Westerlind
99004de261
Only emit an ERRORS table if error recovery is used
2016-11-22 22:36:10 +01:00
Markus Westerlind
e68c2605c8
Revert accidental style change to the grammar
2016-11-22 22:36:10 +01:00
Markus Westerlind
00c78e5e2e
Add some comments
2016-11-22 22:36:10 +01:00
Markus Westerlind
9cd4f30319
Make the error available for error recovery actions
2016-11-22 22:36:10 +01:00
Markus Westerlind
fd2a5f04ce
Treat error as a terminal when it comes to example generation
2016-11-22 22:36:10 +01:00
Markus Westerlind
28f689c9df
Implement error recovery on EOF
2016-11-22 22:36:10 +01:00