sonatina_parser/lib.rs
1//! This crate provides a parser for sonatina-IR text format.
2//! The text format is mainly used for debugging and testing.
3
4pub mod parser;
5
6mod lexer;
7
8pub type Result<T> = std::result::Result<T, Error>;
9
10#[derive(Debug)]
11pub struct Error {
12 pub kind: ErrorKind,
13 pub line: u32,
14}
15
16impl Error {
17 pub fn new(kind: ErrorKind, line: u32) -> Self {
18 Self { kind, line }
19 }
20}
21
22#[derive(Debug)]
23pub enum ErrorKind {
24 InvalidToken(String),
25 SyntaxError(String),
26 SemanticError(String),
27}