Volker Mische
daaad78583
Allow match definition if no custom tokens are defined
...
`extern` is not only used for custom lexers/tokens, but also to define
custom types for `Error` and `Location`. It should be possible to
have custom error types while having `match` dedefinitions as issue #261
shows.
Fixes #261 .
2018-01-24 05:18:21 -05:00
Niko Matsakis
226cb536c8
Merge pull request #279 from vmx/issue-278
...
Return grammar errors first
2018-01-24 04:41:24 -05:00
Niko Matsakis
88b4e65c22
Merge pull request #281 from gwenn/category
...
Specify `parsing` category in Cargo.toml
2018-01-24 04:19:32 -05:00
Niko Matsakis
c3f810704d
Merge pull request #286 from nikomatsakis/issue-240
...
Rework error recovery mechanism
2018-01-24 04:18:36 -05:00
Niko Matsakis
2e0d114793
add new style error recovery function and adjust tests
...
Also, add some detailed tests covering all the cases for error spans.
2018-01-23 13:14:50 -05:00
Niko Matsakis
1d36900d66
remove LALR annotation, not crucial
2018-01-23 12:49:26 -05:00
Niko Matsakis
dae7c1db35
make last_location
into an &mut
so we can thread it around
2018-01-23 12:49:26 -05:00
Niko Matsakis
004187aa86
make next_token
and token_to_integer
more hygienic
2018-01-23 12:49:26 -05:00
Niko Matsakis
3f4ed1e1af
add a test for EOF loop
2018-01-23 12:49:26 -05:00
Niko Matsakis
b62a3fc095
make a test demonstrating the lock-in phenomena
2018-01-23 12:49:26 -05:00
Niko Matsakis
3eeb66c93d
make unrecognized_token_error
more hygienic
2018-01-23 12:49:26 -05:00
Niko Matsakis
a40cd3d0ff
rework error recovery to drop tokens and handle EOF more gracefully
2018-01-23 12:49:26 -05:00
Niko Matsakis
94fa24c4a6
add more useful info when DEBUG_PRINT is enabled
2018-01-23 12:49:26 -05:00
Niko Matsakis
3d49e9cffd
use lane-table even on LR(0) grammars
...
This is needed to avoid infinite loops in error recovery.
2018-01-23 12:49:26 -05:00
Markus Westerlind
08728df48a
Add a test case for issue #240
2018-01-23 12:49:26 -05:00
gwenn
92c3400010
Specify parsing
category in Cargo.toml
...
https://crates.io/categories/parsing
> Crates to help create parsers of binary and text formats.
2017-11-26 18:17:32 +01:00
Volker Mische
f309406335
Return grammar errors first
...
If some production in the grammar returns an error, give it priority
over built-in errors.
Fixes #278 .
2017-11-23 00:43:31 +01:00
Niko Matsakis
01ccd43789
Merge pull request #254 from joerivanruth/transform-parse-error
...
Make ParseError Displayable
2017-10-15 05:47:15 -04:00
Niko Matsakis
0645c0aada
Merge pull request #268 from notriddle/patch-1
...
Fix the "no-brackets" example code
2017-10-15 05:42:36 -04:00
Joeri van Ruth
5c7f81b821
Move internal token to __intern_token.
...
Re-export it at the toplevel because client visible types
use it.
2017-10-05 16:54:45 +02:00
Joeri van Ruth
9d38aa4722
Use a Display'able token type in the internal tokenizer
2017-10-05 16:54:45 +02:00
Joeri van Ruth
517acc3543
Suppress some warnings
2017-10-05 16:54:45 +02:00
Joeri van Ruth
d4669c1226
Change one more () into &'static str
2017-10-05 16:54:45 +02:00
Joeri van Ruth
f71329d454
Make default user error &'static str instead of ()
...
Because () doesn't implement fmt::Display, which is inconvenient.
2017-10-05 16:54:45 +02:00
Joeri van Ruth
e51a157122
Also rename map_err to map_error and map_loc to map_location
2017-10-05 16:54:45 +02:00
Joeri van Ruth
564cc5c066
Fix minor nits
...
- rename `map_tok` to `map_token`
- Add backticks about unrecognized token
2017-10-05 16:54:45 +02:00
Joeri van Ruth
27b4b05720
Modify comment
...
To trigger Travis rebuild.
2017-10-05 16:54:45 +02:00
Joeri van Ruth
65d26ae20f
Replace expect_err with unwrap_err
...
to make it work on older Rust versions.
2017-10-05 16:54:45 +02:00
Joeri van Ruth
7bdb7126b0
Add utility methods to ParseError
...
Add three methods .map_loc(), .map_tok() and .map_err()
that transform the locations, tokens and user error values
inside the ParseError.
2017-10-05 16:54:45 +02:00
Michael Howell
424e22c5fb
Fix the "no-commas" example code
...
It translated `<e:T?>` into `e?`, when it should've been `T?`.
`<e:T?>` is a nonterminal bound to the name, `T?` is a nonterminal bound to no name, and `e?` is meaningless.
2017-10-01 21:25:10 -07:00
Niko Matsakis
08bb4c98b9
Merge pull request #263 from fitzgen/support-associated-types
...
Allow actions to return a grammar's type parameter's associated type
2017-09-21 09:25:36 -04:00
Nick Fitzgerald
b3d667e679
Allow actions to return a grammar's type parameter's associated type
...
Supporting this requires determining which `where` clauses apply to the used
type parameters for the nonterminal and symbol types, so that we can bound the
type parameters in such a way that we get access to their associated types.
2017-09-18 10:15:28 -07:00
Niko Matsakis
ff250d40a0
Merge pull request #264 from fitzgen/where-clauses
...
Create an explicit structure for `where` clauses
2017-09-18 05:01:34 -04:00
Nick Fitzgerald
1cb7716c3b
Create an explicit structure for where
clauses
...
This commit parses a grammar's `where` clauses into a structure that allows us
to see what type parameters are being bound and in what ways.
2017-09-12 14:25:13 -07:00
Niko Matsakis
4176ff6313
Merge pull request #259 from nikomatsakis/issue-249
...
avoid out-of-bounds error in error classification
2017-08-30 06:25:24 -04:00
Niko Matsakis
7acc771eee
avoid out-of-bounds error in error classification
...
We still don't get optimal results here, but that's
a separate issue.
Fixes #249 .
2017-08-30 06:04:19 -04:00
Niko Matsakis
1026ef82cd
Merge pull request #258 from nikomatsakis/issue-253
...
error out with extra tokens, even in parse table mode
2017-08-30 05:34:20 -04:00
Niko Matsakis
9b7bf48fd8
in lane table mode, run algorithm even with just one reduce
...
Otherwise, we get errors in the existing error recovery tests.
cc #240 -- possible fix
2017-08-29 05:49:53 -04:00
Niko Matsakis
920ee76fec
even in parse table, error out if we hit EOF early
2017-08-29 05:46:22 -04:00
Niko Matsakis
f7d274a76a
Merge pull request #251 from nick70/master
...
Add missing back-tick in tutorial.
2017-08-29 04:32:50 -04:00
Nicholas Farshidmehr
59d152fa59
Add missing back-tick in tutorial.
2017-08-01 15:54:26 -04:00
Niko Matsakis
9a343f7a04
Merge pull request #245 from mchesser/master
...
Embed LALRPOP version in generated files, and check it on rebuild
2017-07-17 05:27:11 -04:00
Niko Matsakis
690db010be
Merge pull request #246 from fitzgen/unrecognized-token-with-expected
...
Ignore the possible expected token when we find an unrecognized token
2017-07-11 13:37:01 -04:00
Nick Fitzgerald
b50124ea54
Ignore the possible expected token when we find an unrecognized token
...
This will at least print an error message with the location, rather than
panicking, which is a lot more user-friendly :)
2017-07-02 09:55:04 -07:00
Michael Chesser
f0a88a823e
Embed LARPOP version in generated files, and check it when rebuilding files.
2017-07-01 14:51:40 +09:30
Niko Matsakis
92055a1e2c
gah fix regex version
2017-06-16 17:52:36 -04:00
Niko Matsakis
09d333ba11
Merge pull request #239 from nikomatsakis/release-0.13.1
...
Release 0.13.1
v0.13.1
v0.14.0
2017-06-16 15:56:22 -04:00
Niko Matsakis
735eb8779f
update README and tutorial
2017-06-16 15:54:50 -04:00
Niko Matsakis
dcce320a88
bump version number to 0.13.1
2017-06-16 15:49:05 -04:00
Niko Matsakis
390125ea11
update RELEASES.md
2017-06-16 15:47:18 -04:00