Skip to main content

Crate parser

Crate parser 

Source
Expand description

SqlExprParser - Generated by CongoCC Parser Generator

This parser was automatically generated from: SqlExprParser.ccc Do not edit this file directly. Regenerate from the grammar instead.

§Features

  • Arena-based allocation: All AST nodes and tokens are stored in a central arena
  • Type-safe indices: NodeId and TokenId provide safe references without lifetimes
  • Result-based errors: All parsing operations return Result<T, ParseError>
  • Location tracking: Errors include line/column information for better diagnostics

§Example

use parser::*;

fn main() -> Result<(), ParseError> {
    let input = "your input here".to_string();
    let mut parser = Parser::new(input)?;
    // parse() returns the root NodeId of the AST
    let root = parser.parse()?;
    // Access AST through the arena, with original input for pretty printing
    println!("{}", parser.arena().pretty_print(root, 0, parser.input()));
    Ok(())
}

Structs§

AddExpressionNode
AST node for addExpression production
AndExpressionNode
AST node for andExpression production
Arena
Arena that owns all AST nodes and tokens
ComparisonExpressionNode
AST node for comparisonExpression production
EqualityExpressionNode
AST node for equalityExpression production
JmsSelectorNode
AST node for JmsSelector production
Lexer
The lexer/tokenizer for SqlExprParser
LiteralNode
AST node for literal production
MultExprNode
AST node for multExpr production
NodeId
Type-safe index for nodes in the arena
OrExpressionNode
AST node for orExpression production
ParseError
Error type for parsing failures
Parser
The parser for SqlExprParser
PrimaryExprNode
AST node for primaryExpr production
StringLiteralNode
AST node for stringLiteral production
Token
A single token in the input stream
TokenId
Type-safe index for tokens in the arena
UnaryExprNode
AST node for unaryExpr production
VariableNode
AST node for variable production

Enums§

AddOp
Operator for addExpression
AstNode
Enum containing all AST node types
ComparisonOp
Operator for comparisonExpression
EqualityOp
Operator for equalityExpression
EvalError
Comprehensive error type for evaluation failures
LexicalState
Lexical state enumeration
MultExprOp
Operator for multExpr
RuntimeValue
User-provided values for variable substitution
TokenType
Token type enumeration
UnaryOp
Operator for unaryExpr
VisitControl
Controls visitor traversal behavior

Traits§

TokenSource
Token source trait for tracking token locations

Functions§

evaluate
Evaluate a SQL boolean expression string with variable bindings.

Type Aliases§

ParseResult
Result type for parsing operations