Added the new LexerResult to use as an Error.
The code now returns a result that has the TokenStream. For now it is returning any Error, but later there should be a lexical analysis error type.
This commit is contained in:
@ -46,7 +46,7 @@ impl std::fmt::Display for MarkdownTokenType
|
||||
|
||||
// Define how you want to interpret base tokens
|
||||
pub fn transform(input: &TokenStream<TokenType>)
|
||||
-> TokenStream<MarkdownTokenType>
|
||||
-> Result<TokenStream<MarkdownTokenType>, Box<dyn std::error::Error + Send + Sync>>
|
||||
{
|
||||
let mut output = TokenStream::new();
|
||||
|
||||
@ -157,11 +157,11 @@ pub fn transform(input: &TokenStream<TokenType>)
|
||||
i += 1;
|
||||
}
|
||||
|
||||
output
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>>
|
||||
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>>
|
||||
{
|
||||
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
path.push("examples/example.md");
|
||||
|
||||
Reference in New Issue
Block a user