openehr_query/lib.rs
1// SPDX-FileCopyrightText: Cadasto B.V.
2// SPDX-FileCopyrightText: openEHR Foundation
3// SPDX-License-Identifier: Apache-2.0
4
5//! openEHR QUERY (AQL 1.1.0): a hand-written lexer, parser, and AST over the
6//! canonical ANTLR4 grammar vendored at `vendor/grammar/`, with no ANTLR
7//! runtime dependency. AQL has no BMM meta-model, so this crate is written by
8//! hand against the grammar and tested against `vendor/examples/`.
9//!
10//! The crate stops at the AST: [`lexer`] tokenizes `AqlLexer.g4` with `logos`,
11//! [`ast`] carries one type per `AqlParser.g4` rule, and [`parser`] builds an
12//! [`ast::SelectQuery`] with `chumsky`. [`visit`] walks and rewrites the tree,
13//! [`bind`] substitutes ITS-REST `query_parameters` into it, and [`printer`]
14//! renders it back to AQL text. Query execution lives in the application.
15//!
16//! The `federation` feature adds `federation`, which separates the
17//! federation-only `FROM ENDPOINT` / `ORGANISATION` directive from a query
18//! before the strict AQL 1.1.0 parse.
19
20// Doctests are copy-paste templates: they must use `?`, never unwrap
21// (C-QUESTION-MARK, https://rust-lang.github.io/api-guidelines/documentation.html#c-question-mark).
22#![doc(test(attr(deny(warnings))))]
23pub mod ast;
24pub mod bind;
25#[cfg(feature = "federation")]
26pub mod federation;
27pub mod lexer;
28pub mod parser;
29pub mod printer;
30pub mod visit;
31
32/// The openEHR specification version this crate implements.
33///
34/// The pin is deliberately independent of the crates.io package version,
35/// which is the crate's own `SemVer` line and moves only with this
36/// implementation's code.
37pub const SPEC_VERSION: &str = "1.1.0";