tokens.rs
1 use regex::{Regex, Error as ReError}; 2 3 /// A very slow regex::RegexSet that lets you change the sets on the fly 4 type RegexVec = Vec<Regex>; 5 macro_rules! regexVecUncompiled { 6 ( $( $x:expr ),* ) => { 7 vec![ 8 $( 9 Regex::new($x) 10 ),* 11 ] 12 }; 13 } 14 macro_rules! regexVec { 15 ( $( $x:expr ),* ) => { 16 regexVecUncompiled![ 17 $( $x ),* 18 ].into_iter().map(|reg:Result<Regex,ReError>| reg.unwrap()).collect() 19 }; 20 } 21 22 /** Returns the "default" regexes. 23 * 24 * TODO test that The list of named regexes is dynamic, and can be modified during the parse phase. 25 */ 26 fn get_initial_regexes() -> RegexVec { 27 todo!("Fill out token list"); 28 regexVec![] 29 } 30 31 /// Stream token sequence from input file 32 pub fn get_token_stream(data: String) { 33 get_initial_regexes(); 34 todo!("do something with '{}'", data); 35 { 36 todo!("Use current regexps to get next token"); 37 todo!("Tokens are granted upon request."); 38 todo!("Tokens include location and path data."); 39 todo!("Can be told to skip."); 40 } 41 }