-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an OutputMode type parameter to drive parser results (#1631)
* add initial traits for GAT integration The Mode trait will be used to adapt the production of output or error values depending on the call site. If we do not care about the actual value or error, and just want to know if a parser was succssful or not, then the Mode trait allows us to signal it without producng the actual type. in Err, the Error and Failure variants get different types, because usually want to get the failure variant, while the error variant might change independently. The OutputMode trait also carries information about the streaming or complete status, and in the same way define which type of parser we want, directly at the call site * convert the Parser trait a new `process` method is used to handle the new OutputMode trait. The `OutputM` supporting structure is used to carry which modes we want to use, and depending on the case, we can call an inner parser using directly the mode we're in (example: Map), or we can convert it to Emit for Output (ex: MapRes because we have to apply the mapping function on the parser output and check for errors). We keep the `parse` method with `Emit` for both output and error, which allows us to convert combinators gradually: the ones using `parse` will work but won't benefit directly from these traits also parent and child combinators in a serie of parsers may support it * various optimizations it turns out that rustc is generating separate functions for each process() implementation, which tends to slow things down * raise minimal version to 1.65
- Loading branch information
Showing
53 changed files
with
5,799 additions
and
1,867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.