atlas_core/
lib.rs

1/*
2 * atlas-core by Gipson62
3 *
4 * The core of a tool designed to help you make programming language
5 *
6 * There will be a lexer macro that build up a fully fledged lexer for you with no efforts.
7 * It's currently in development, more information coming soon
8*/
9
10//! # atlas-Core
11//!
12//! `atlas-core` is the foundational library for a language creation tool designed to assist users in developing languages.
13//! This core library currently serves as the building block for the creation of Atlas77, a functional programming language.
14//!
15//! Currently, it's only purpose is to generate a Lexer and the way to do it is pretty straightforward
16
17/// Contain a powerful macro to generate a fully fledge lexer tailored to the user needs
18pub mod lexer;
19mod tests;
20/// TODO
21pub mod utils;
22
23#[doc = "Used to import the base set of features of this tool"]
24pub mod prelude {
25    pub use crate::keywords;
26    pub use crate::lexer;
27    pub use crate::lexer::lexer_state::LexerState;
28    pub use crate::lexer_builder;
29    pub use crate::map;
30    pub use crate::tokens;
31    pub use crate::utils::{case::Case, span::*};
32}
33
34/// A macro to create a `HashMap` with the given key-value pairs.
35#[macro_export]
36macro_rules! map {
37    ($name:ident, &key: ty, &val: ty) => {
38        let mut $name: HashMap<&key, &val> = HashMap::new();
39    };
40    ($($key:expr => $val:expr),* $(,)?) => {
41        {
42            let mut map = HashMap::new();
43            $(map.insert($key, $val);)*
44            map
45        }
46    }
47}