// Rhea use logos::Logos; use memory::{Variable, VariableHashmap, VariableType}; mod memory; #[derive(Logos, Debug, PartialEq)] #[logos(skip r"[ \t\n\f]+")] // Ignore this regex pattern between tokens enum Token { #[token(".")] Period, #[token("(")] LeftParen, #[token("{")] LeftBrace, #[token(")")] RightParen, #[token("}")] RightBrace, #[token("include")] Include, #[token("=")] Equals, #[token(";")] Semicolon, #[token("\"")] Quote, // Or regular expressions. #[regex("[a-zA-Z]+")] Text, } fn main() { let mut memmap = Vec::new(); let mut varmap: VariableHashmap = hashbrown::HashMap::new(); let variable_name = "abcd".to_string(); let variable_type = Some(memory::VariableType::Signed); let constant = false; let length = 8; let abc = Variable::new(&mut memmap, variable_type, constant, length); varmap.insert(variable_name, abc); let mut lex = Token::lexer(include_str!("../assets/examples/library.rhea")); for x in lex { println!("{:?}", x); } //todo compile to hb }