From f9f56b4e9bb4cf56d0c00209338c0e058a09b24f Mon Sep 17 00:00:00 2001 From: Tan Kian-ting Date: Sat, 30 Sep 2023 22:11:17 +0800 Subject: [PATCH] add uann --- uann | 1 - uann.tar.gz | Bin 0 -> 81920 bytes uann/Cargo.lock | 16 +++++ uann/Cargo.toml | 9 +++ uann/README.md | 2 + uann/src/main.rs | 176 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 203 insertions(+), 1 deletion(-) delete mode 160000 uann create mode 100644 uann.tar.gz create mode 100644 uann/Cargo.lock create mode 100644 uann/Cargo.toml create mode 100644 uann/README.md create mode 100644 uann/src/main.rs diff --git a/uann b/uann deleted file mode 160000 index 513173b..0000000 --- a/uann +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 513173b22fa4776c54cae4bb6b78dcc8ec9acac9 diff --git a/uann.tar.gz b/uann.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..a08eee2bf81c78a6ea68e59cc084cb6c01b48af4 GIT binary patch literal 81920 zcmeEv2V9g#^FMYud(>!RdpuA;X-8EMEZ7Jt7OaSH+#PTNcX&lW#THv^QDZdr-eT;% zx5Qpzj3u_%TWqnLME!qf_j&G)VtZfoec%5NK0e;v^X$&f&d$!x%+AhZR_b&fb|3c7 z6Mz2xzIOOf`1^X=e$pfQvs3u^dir^K`FZ-|xk91v^tBUwKP*}ty4h$_8U(>EU7w~& zenW$Ad;W&1|ILrgH2xt}sdn!Eb1kVqG zO%|a4$H(76h)B>Hg*a`JM!=`iY|h$=~nKU{z9>?hoLb6h4RwfA=wbrE7#k+&$$owI+oC>r`5e5k(_qg50drs`P4&n^6;=tkIc(q+Ta? zl||(YJIB(t4Jq6eXiF|L>dgifL&u#I=IsZ+<#&$F(N zw?gT!@{X+&=d1A3_$bugo*GX-AMZF%Z*^TC-@0B(g^$0++fOdb!kr)dC!7E7=&3ed zr#EOmNPBFKzhVB4173Oh|Hoi}*Ni{uJMQVpNx6c; z+tz;{f1fPtzn_kO@MH*_c3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{KfONIaYb^o9{pV zzJ9)5dE@`yg#H&Qym|a{CnpSz|C`SLdwTn2j{j5mQA()1_`iQ)Jm0qpv_3KaizNER zsh@X7{(VXLKUqG@{HGUr<+=j+{_@}3-#<_P`zZXB(^qTqXf?^rLdIHixjzn{w2N2S#G#K!u?`qxpbRCP3}x=OtHuWnv`hu4zu zfBJ!S{v(S|u1kJSn)jFgUjB+a{r{uzRhIG39fdy&=5Le#UVb+DKbZaR?VTt8vk>tE z{iLyZmp|cM7YZQ)uf`73Ds^u3vPPjE(lYD1o4h?6#6zn{qFi6Wg2Jz^pJyF!v@6v1 ztmElPZ}ib=0{DxJ-<%xm1CinXEZ8jb|ATA-5P!X&|3A_}@r}39O0l9_4`;Wh` zw->_2^ZdWLH3F}P^QQ67Ehq5%kH4Rv0{P$b#{c!>mRnEWVf_DXosh==P5$5P`k%j7 zUjEnI8sRs?p|N?FzdZf#&2;=z(C4i~mCWU!MIZk?;St zclIm@!$27RD}fGvKr1LX2u^~N|3Dn1O+{&XkhW+Sf4lFc9Ym;8UF4k_Lehih!VPJ; z=cmt){M$!bG?^VYq~`xy{a?M`|91cXF4wI8<0fI?ZBg(A7gemS-YXNwg2wJ%2mMiq zb1!b2K-I7a6{4Sp=j(7Su_JgJ)u95LB6JRB5=|g`R2{K%wha0&vxguI;xI2ao7Tob zF;}#zA>4H~$XwK}sJF#;X^ITqL#)1tWbp05ew-s#9~JVky0*To%(N-{2r7(pD!6W? z2|`D0QLj2Oou6&6d7d2QeA2;_pD_o{0jEiT1W14cNPq-LfCNZ@1W14cNPq +/// Under MIT License +/// 习包子 梁家河小学博士 清零宗 习炀帝 庆丰大帝 +/// 独裁国贼 新疆集中营 光复香港时代革命 祈翠 南蒙古独立 香港独立 +/// + +/// +/// pairs of string for matching and parsing +/// +/// - `matched` : the string being accumulatedly matched. +/// - `remained` : the string to be matched +#[derive(Debug, Clone, PartialEq)] +pub struct Matchee { + matched : String, + remained : String, +} + +/// macro convert a str as a string, equivalent to `x.to_string()`. +/// +/// # Example: +/// ``` +/// let a = "abc"; +/// assert_eq!(string!(a), a.to_string()); +/// ``` +/// +macro_rules! string { + ($name:expr) => {$name.to_string()} +} + + +/// then!(a, b [, c...]*) i similar to +/// a ==> b ((==> c)...)* +macro_rules! then{ + + ($item: expr, $closure1: expr, $($closure2: expr),+)=>{ + then!(then_do($item, &$closure1), $($closure2),+); + }; + ($item: expr, $closure1: expr)=>{ + then_do($item, &$closure1); + }; +} + + +/// convert a string to +/// a vector of char +/// +/// * s : input `str`'s reference +/// +/// # Example +/// +/// ``` +/// let s = "Lí 好!"; +/// let char_vec: Vec = str_to_char_vec(s); +/// assert_eq!(char_vec, vec!['L','í',' ','好','!']) +/// ``` +fn str_to_char_vec (s : &str) -> Vec{ + return s.chars().collect(); +} + +/// return a closure such that +/// if the 1st char of `Matchee.matched` matches `ch`, +/// then return the new `Some`. Otherwise, it returns `None`. +fn match_1_char(ch : char) -> Box Option>{ + return match_range(ch, ch) +} + +/// return a closure such that +/// if the codepoint of the 1st char of `Matchee.matched` between +/// that of `lower_ch` (lower bound) and that of `upper_ch` (upper bound) +/// then return the new updated `Some`. +/// Otherwise, it returns `None`. +/// +fn match_range(lower_ch : char, upper_ch: char) -> + Box Option> { + Box::new(move | x : Matchee| -> Option { + let x_remained_str = x.remained.as_str(); + let x_remained_char_vec = str_to_char_vec(x_remained_str); + + if x_remained_char_vec.len() == 0{ + return None; + } + + if (x_remained_char_vec[0] as u32) >= (lower_ch as u32) && + (x_remained_char_vec[0] as u32) <= (upper_ch as u32){ + let remained_string = x_remained_char_vec[1..].iter() + .collect::(); + return Some(Matchee{ + matched : x.matched + &x_remained_char_vec[0].to_string(), + remained : remained_string, + }); + }else{ + return None; + } + }) +} + +/// +/// like the infix `==>` monad, i.e. `inputee ==> closure` in OCaml, +/// return a combinable closure. +/// - `inputee` : input string wrapped by Some() or None +/// - `closure` : the input to be processed +fn then_do(inputee : Option, closure : &dyn Fn(Matchee) -> Option) + -> Option{ + return match inputee { + Some(inner) => closure(inner), + None => inputee, + } + } +/// return a closure for what is do 0+ times +/// similar to `( closure )*` +fn zero_plus_times_do(closure : &dyn Fn(Matchee) -> Option) -> +Box Option + '_>{ + return Box::new( + move |inputee|{ + let mut old_inputee = inputee.clone(); + let mut new_inputee = closure(old_inputee.clone()); + while let Some(new_inner) = new_inputee + { + old_inputee = new_inner.clone(); + new_inputee = closure(new_inner); + } + return Some(old_inputee.clone()); + }); +} + +/// return a combined closure. if `closure1` is not passed, then +/// use `closure2`, i.e. : `(closure1 || closure2)` +fn or_do( + closure1 : Box Option>, + closure2 : Box Option>) -> + Box Option>{ + Box::new( + move |inputee|{ + let inputee_after_c1 = closure1(inputee.clone()); + match inputee_after_c1 { + None => closure2(inputee.clone()), + _ => inputee_after_c1, + } + } + ) + } + + +fn main() { + let ex1 = Matchee{ + matched : string!(""), + remained : string!("112")}; + + let d = match_range('0', '9'); + println!("{:?}", then_do(then_do(then_do(Some(ex1.clone()), &d), &d), &d)); + + println!("{:?}", (ex1.clone())); + println!("{:?}", match_range('2', '9')(ex1.clone())); + println!("{:?}", match_1_char('0')(ex1.clone())); + println!("{:?}", match_1_char('1')(ex1.clone())); + + let ex2 = Matchee{ + matched : string!(""), + remained : string!("1234")}; + println!("~~~{:?}", + then_do(then_do(Some(ex2.clone()), &or_do(match_1_char('1'), + match_1_char('0'))),&d)); + + println!("~~~{:?}", + then_do(Some(ex2.clone()),&zero_plus_times_do(&d))); + + println!("~~~{:?}", + then!(Some(ex2.clone()),&zero_plus_times_do(&d))); + + println!("~~~{:?}", + then!(Some(ex2.clone()), &d, &d, &d)); + + +} + + -- 2.39.2