Commit graph

18 commits

Author SHA1 Message Date
Sebastian Ullrich
f52395140a feat(library/init/lean/parser/parsec): add dbg helper combinator 2018-08-02 13:32:42 -07:00
Sebastian Ullrich
87dc8adbe6 fix(library/init/lean/parser/parsec): monad_except.catch should not reset position, consumed flag 2018-07-30 17:50:37 -07:00
Sebastian Ullrich
0fd9d29ba2 feat(library/init/lean/parser/reader/module): command-level error recovery 2018-07-30 10:38:00 -07:00
Sebastian Ullrich
3728b2ba3f feat(library/init/lean/parser/reader/basic): add error list handling 2018-07-30 10:38:00 -07:00
Sebastian Ullrich
e34f2e8cd7 chore(library/init/lean/parser): improve error messages 2018-07-30 10:38:00 -07:00
Sebastian Ullrich
2823bebd23 refactor(library/init/lean/parser/parsec): message.pos: replace with iterator
This allows efficient recovery from a parse error as well as implementing
`has_to_string` for `message`
2018-07-30 10:38:00 -07:00
Sebastian Ullrich
898e14cdf5 fix(library/init/lean/parser/parsec): orelse: do not backtrack on success
This change makes backtracking behavior more predictable and
matches Parsec and Megaparsec's behavior. While the original Parsec paper
motivates the old behavior by arguing it implements the "longest match" rule,
this is obviously only true in a very limited sense.
2018-07-30 10:38:00 -07:00
Sebastian Ullrich
10b18e77a1 feat(library/init/lean/parser/reader/basic): combinators: create partial syntax trees 2018-07-27 16:19:02 -07:00
Sebastian Ullrich
389e9b7b49 feat(library/init/lean/parser/parsec): use [inhabited μ] instead of unit for custom message type of basic parsers
In hindsight, this seems to simplify usage without compromising static typing much
2018-07-27 15:10:20 -07:00
Sebastian Ullrich
65fd050b83 feat(library/init/lean/parser/parsec): add custom error message type 2018-07-27 14:29:50 -07:00
Leonardo de Moura
5d3f421e70 feat(library/init/lean/parser/parsec): avoid unnecessary [alternative m] dependencies 2018-07-26 15:51:00 -07:00
Leonardo de Moura
35b100bb94 feat(library/init/lean/parser/parsec): implement not_followed_by using catch 2018-07-26 15:47:19 -07:00
Sebastian Ullrich
134d27dbec feat(library/init/lean/parser/parsec): longest_match should return all longest parses
In the case of overlapping notations, we will return a choice node of all
possible parses.
2018-07-25 18:07:56 -07:00
Sebastian Ullrich
18b4456a84 Revert "refactor(library/init/lean/parser/parsec): monad_parsec: move from monad_lift/monad_map to direct primitives"
This reverts commit 9db0724bf1.
2018-07-25 13:53:29 -07:00
Sebastian Ullrich
8707773872 feat(library/init/lean/parser/parsec): introduce observing and longest_match primitive parser combinators 2018-07-13 15:51:00 +02:00
Sebastian Ullrich
9db0724bf1 refactor(library/init/lean/parser/parsec): monad_parsec: move from monad_lift/monad_map to direct primitives
This breaks the code for variable-length tokens that depended on lifting
`parsec` into `read_m`. Either `read_m` could be parameterized by its state,
or we just hard-code all variable-length tokens.
2018-07-12 17:53:43 +02:00
Sebastian Ullrich
5955e3fce8 chore(library/init/lean/parser/parsec): proper namespacing 2018-07-12 10:35:22 +02:00
Sebastian Ullrich
72b255d4e1 chore(library/init/lean/parser/parser_t): rename module and type to parsec to avoid nested use of parser 2018-07-12 10:35:20 +02:00
Renamed from library/init/lean/parser/parser_t.lean (Browse further)