1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! The typed AST layer.
//!
//! Layout and naming follow the Lua implementation this project grew out of (now under
//! `reference/`), so code written against the old API keeps working:
//!
//! ```text
//! node/
//! traits.rs CppAstNode, CppAstToken, CppAstChildren, CppAstTokenChildren
//! sum.rs CppStat, CppAst — the sum types over nodes
//! docs.rs documentation comments: CppDocComment, CppDocCommand, ...
//! cpp/
//! mod.rs declarations, types
//! expr.rs expressions
//! stat.rs statements
//! modules.rs C++20 modules
//! token/ typed token wrappers
//! ```
//!
//! # Using it
//!
//! ```ignore
//! use cpp_parser::{CppParser, CppParserConfig, CppTranslationUnit, CppAstNode};
//!
//! let tree = CppParser::parse(source, ParserConfig::default());
//! let unit = CppTranslationUnit::cast(tree.get_red_root()).unwrap();
//!
//! for decl in unit.get_declarations() {
//! println!("{} {:?}", decl.kind_name(), decl.get_name_text());
//! }
//! ```
//!
//! Every accessor returns `Option`, because an editor parses files that are being written. Nothing
//! in this layer panics on malformed input, and nothing validates structure — a `get_name()` on a
//! half-typed declaration returns whatever name it can find.
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;