pub mod ast;
pub mod diagnostic;
pub mod error;
pub mod fix_hint;
pub mod lexer;
pub mod linter;
pub mod parser;
pub mod rule_graph;
pub mod runtime;
pub mod span;
pub mod token;
pub use ast::{
ExampleDecl, Expr, Grammar, GrammarItem, ImportDecl, RuleDecl, TokenBody, TokenDecl,
};
pub use diagnostic::{Diagnostic, DiagnosticKind, Severity};
pub use error::{ErrorKind, RantlrError};
pub use fix_hint::FixHint;
pub use lexer::{lex, Lexer, LexerError};
pub use linter::{lint, lint_all};
pub use parser::parse;
pub use rule_graph::{rule_graph, RuleEdge, RuleGraph, RuleNode};
pub use runtime::{
analyze_and_parse, diagnose, parse_input, AnalyzeResult, DiagnosticJson, ParseTree,
};
pub use span::{BytePos, Span};
pub use token::{BuiltinType, Keyword, Token, TokenKind};
pub fn analyze(source: &str) -> Result<Grammar, RantlrError> {
let grammar = parse(source)?;
lint(source, &grammar)?;
Ok(grammar)
}