sdml_parse/
lib.rs

1/*!
2This library provides a parser for the Simple Domain Modeling Language (SDML) and produces an in-memory representation
3using the crate [sdml-core](https://crates.io/crates/sdml-core).
4
5The `ModuleLoader` trait from, `sdml-core`, provides the interface for finding, parsing, and loading modules and the
6[`load::FsModuleLoader`] implementation is provided in this crate for file-system based module definitions.
7
8# Example
9
10The following example demonstrates the `FsModuleLoader` to resolve a module name to a file and parse it.
11
12
13```rust,no_run
14use sdml_core::model::identifiers::Identifier;
15use sdml_core::store::{InMemoryModuleCache, ModuleStore};
16use sdml_core::load::ModuleLoader;
17use sdml_parse::load::FsModuleLoader;
18use std::str::FromStr;
19
20let mut cache = InMemoryModuleCache::with_stdlib();
21let mut loader = FsModuleLoader::default();
22
23let name = Identifier::from_str("example").unwrap();
24
25let module_name = loader.load(&name, None, &mut cache, true);
26assert!(module_name.is_ok());
27
28let module = cache.get(&module_name.unwrap()).unwrap();
29```
30
31*/
32
33#![warn(
34    unknown_lints,
35    // ---------- Stylistic
36    absolute_paths_not_starting_with_crate,
37    elided_lifetimes_in_paths,
38    explicit_outlives_requirements,
39    macro_use_extern_crate,
40    nonstandard_style, /* group */
41    noop_method_call,
42    rust_2018_idioms,
43    single_use_lifetimes,
44    trivial_casts,
45    trivial_numeric_casts,
46    // ---------- Future
47    future_incompatible, /* group */
48    rust_2021_compatibility, /* group */
49    // ---------- Public
50    missing_debug_implementations,
51    // missing_docs,
52    unreachable_pub,
53    // ---------- Unsafe
54    unsafe_code,
55    unsafe_op_in_unsafe_fn,
56    // ---------- Unused
57    unused, /* group */
58)]
59#![deny(
60    // ---------- Public
61    exported_private_dependencies,
62    // ---------- Deprecated
63    anonymous_parameters,
64    bare_trait_objects,
65    ellipsis_inclusive_range_patterns,
66    // ---------- Unsafe
67    deref_nullptr,
68    drop_bounds,
69    dyn_drop,
70)]
71
72// ------------------------------------------------------------------------------------------------
73// Modules
74// ------------------------------------------------------------------------------------------------
75
76mod parse;
77
78pub use sdml_core::error;
79
80pub mod load;