glyph-parser 0.0.1

Python-like parser for the Glyph programming language
Documentation
//! Glyph Parser
//!
//! A Python-like parser optimized for LLM generation with excellent error recovery.

use thiserror::Error;

pub mod ast;
pub mod indent_tracker;
pub mod lexer;
pub mod parser;

pub use ast::*;
pub use parser::{parse_glyph, Parser};

#[derive(Debug, Error)]
pub enum ParseError {
    #[error("Unexpected token: {0}")]
    UnexpectedToken(String),

    #[error("Invalid indentation at line {line}: expected {expected} spaces, found {found}")]
    IndentationError {
        line: usize,
        expected: usize,
        found: usize,
    },

    #[error("Missing required field '{field}' in @program decorator")]
    MissingProgramField { field: String },

    #[error("Syntax error at line {line}: {message}")]
    SyntaxError { line: usize, message: String },

    #[error("Type annotation error: {0}")]
    TypeError(String),
}

pub type ParseResult<T> = Result<T, ParseError>;