Skip to main content

parser/
lib.rs

1//! SqlExprParser - Generated by CongoCC Parser Generator
2//!
3//! This parser was automatically generated from: SqlExprParser.ccc
4//! Do not edit this file directly. Regenerate from the grammar instead.
5//!
6//! # Features
7//!
8//! - **Arena-based allocation**: All AST nodes and tokens are stored in a central arena
9//! - **Type-safe indices**: `NodeId` and `TokenId` provide safe references without lifetimes
10//! - **Result-based errors**: All parsing operations return `Result<T, ParseError>`
11//! - **Location tracking**: Errors include line/column information for better diagnostics
12//!
13//! # Example
14//!
15//! ```ignore
16//! use parser::*;
17//!
18//! fn main() -> Result<(), ParseError> {
19//!     let input = "your input here".to_string();
20//!     let mut parser = Parser::new(input)?;
21//!     // parse() returns the root NodeId of the AST
22//!     let root = parser.parse()?;
23//!     // Access AST through the arena, with original input for pretty printing
24//!     println!("{}", parser.arena().pretty_print(root, 0, parser.input()));
25//!     Ok(())
26//! }
27//! ```
28
29#![deny(unsafe_code)]
30#![warn(missing_docs)]
31#![allow(dead_code)]
32#![allow(unused_variables)]
33
34mod error;
35mod tokens;
36mod arena;
37mod lexer;
38mod parser;
39mod evaluator;
40mod visitor;
41
42// Re-export public API
43pub use error::{ParseError, ParseResult};
44pub use tokens::{Token, TokenType, LexicalState, TokenSource};
45pub use arena::{Arena, NodeId, TokenId, AstNode};
46pub use lexer::Lexer;
47pub use parser::Parser;
48pub use visitor::VisitControl;
49
50// Re-export AST node types and operator enums
51pub use arena::JmsSelectorNode;
52pub use arena::OrExpressionNode;
53pub use arena::AndExpressionNode;
54pub use arena::EqualityExpressionNode;
55pub use arena::ComparisonExpressionNode;
56pub use arena::AddExpressionNode;
57pub use arena::MultExprNode;
58pub use arena::UnaryExprNode;
59pub use arena::PrimaryExprNode;
60pub use arena::LiteralNode;
61pub use arena::StringLiteralNode;
62pub use arena::VariableNode;
63pub use arena::AddOp;
64pub use arena::MultExprOp;
65pub use arena::EqualityOp;
66pub use arena::ComparisonOp;
67pub use arena::UnaryOp;
68pub use evaluator::{evaluate, RuntimeValue, EvalError};