-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use bluebell parser instead of parsing scilla-fmt s-exp (#3)
* Use bluebell parser instead of parsing scilla-fmt s-exp * Start implementing the AstConverting for Contract. * Pass the first test. * Pass the next test * Pass next test. * Simplify intermediate representation. * Rename * Support complex types * ByStr buggy contract. * Updating grammar * One more passing test ^_^ * Pass one more test! * Remove dependency to lexpr * Support map * Support complex map types * Pass one more test. * All tests passed. * All tests passed * Remove commented codes * Remove useless code * Refactor, remove useless code * Fix doc tests * Remove namespaces. * Remove useless code. * Update readme * Remove panic --------- Co-authored-by: Troels F. Roennow <[email protected]>
- Loading branch information
Showing
17 changed files
with
831 additions
and
275 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,31 @@ | ||
use core::fmt; | ||
use std::string::FromUtf8Error; | ||
|
||
use lalrpop_util::ParseError; | ||
use thiserror::Error as ThisError; | ||
|
||
#[derive(Debug, ThisError)] | ||
pub enum Error { | ||
#[error("The requested entry {0} does not exist in the given S-expression")] | ||
NoSuchEntryInSexp(String), | ||
#[error("Failed to parse the contract. {0}")] | ||
ParseError(String), | ||
|
||
#[error("Comptype is not transition. It's {0}")] | ||
CompTypeIsNotTransition(String), | ||
#[error("Failed to visit AST {0}")] | ||
AstVisitError(String), | ||
|
||
#[error(transparent)] | ||
IoError(#[from] std::io::Error), | ||
|
||
#[error(transparent)] | ||
LexprParseError(#[from] lexpr::parse::Error), | ||
|
||
#[error(transparent)] | ||
FromUtf8Error(#[from] FromUtf8Error), | ||
} | ||
|
||
impl<L, T, E> From<ParseError<L, T, E>> for Error | ||
where | ||
L: fmt::Debug, | ||
T: fmt::Debug, | ||
E: fmt::Debug, | ||
{ | ||
fn from(value: ParseError<L, T, E>) -> Self { | ||
Self::ParseError(format!("{:?}", value)) | ||
} | ||
} |
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.