scribe_analysis/
parser.rs1use scribe_core::Result;
6use crate::ast::AstNode;
7
8#[derive(Debug, Clone)]
9pub struct ParseResult {
10 pub ast: AstNode,
11 pub errors: Vec<String>,
12}
13
14impl ParseResult {
15 pub fn new(ast: AstNode) -> Self {
16 Self {
17 ast,
18 errors: Vec::new(),
19 }
20 }
21
22 pub fn with_errors(mut self, errors: Vec<String>) -> Self {
23 self.errors = errors;
24 self
25 }
26}
27
28pub struct Parser;
29
30impl Parser {
31 pub fn new() -> Result<Self> {
32 Ok(Self)
33 }
34
35 pub fn parse(&self, _code: &str, _language: &str) -> Result<AstNode> {
36 Ok(AstNode::new("root".to_string()))
38 }
39}
40
41impl Default for Parser {
42 fn default() -> Self {
43 Self::new().expect("Failed to create Parser")
44 }
45}