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:
2025-10-21 11:43:11 -04:00
parent c950b70c9b
commit 6984455c12
4 changed files with 108 additions and 26 deletions

View File

@ -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");