diff --git a/vidyut-prakriya/Makefile b/vidyut-prakriya/Makefile index 8088758..ff5a726 100644 --- a/vidyut-prakriya/Makefile +++ b/vidyut-prakriya/Makefile @@ -56,7 +56,7 @@ test_tinantas: --hash "28293a6aa746f04dff1a5c3b822396c236df269460d691bd137ba01a2c80557f" ../target/release/test_tinantas \ --test-cases test-files/tinantas-nic-kartari.csv \ - --hash "5d508a8b3a52ebe92a1524b0b51bbed90e27301f265669aa8e7a887d55bf1eff" + --hash "e4ab38f9c71d040bf8cbf7dbc6bb1951749b831240f9248288389a68b24ef413" ../target/release/test_tinantas \ --test-cases test-files/tinantas-san-kartari.csv \ --hash "ef278531cd45ba1df9af60e5b4b8ef582fdbe7a7eb31478fe35b9600c42380fc" diff --git a/vidyut-prakriya/src/dvitva.rs b/vidyut-prakriya/src/dvitva.rs index 96ef622..e5d9273 100644 --- a/vidyut-prakriya/src/dvitva.rs +++ b/vidyut-prakriya/src/dvitva.rs @@ -14,6 +14,7 @@ use lazy_static::lazy_static; lazy_static! { static ref AC: Set = s("ac"); + static ref YAN: Set = s("yaR"); static ref HAL: Set = s("hal"); static ref NDR: Set = s("n d r"); } @@ -61,7 +62,12 @@ fn mark_abhyasta(p: &mut Prakriya, i_start: usize, i_end: usize) { fn try_dvitva(rule: Code, p: &mut Prakriya, i_dhatu: usize) -> Option<()> { // First, run ac-sandhi (for div -> dudyUzati, etc.) ac_sandhi::run_antaranga(p); + p.maybe_save_sthanivat(); + // Force-save for dhatus that consist of a single vowel. + if p.has(i_dhatu, |t| t.has_adi(&*AC) && t.has_antya(&*YAN)) { + p.set(i_dhatu, |t| t.force_save_sthanivat()); + } let i_n = p.find_next_where(i_dhatu, |t| { !(t.is_agama() && t.has_tag(T::kit) && !t.is_it_agama()) @@ -252,7 +258,6 @@ fn try_dvitva(rule: Code, p: &mut Prakriya, i_dhatu: usize) -> Option<()> { /// /// - `i` should point to a dhatu. fn run_at_index(p: &mut Prakriya, i: usize) -> Option<()> { - p.debug("run at index"); let dhatu = p.get_mut(i)?; debug_assert!(dhatu.is_dhatu()); diff --git a/vidyut-prakriya/tests/regressions.rs b/vidyut-prakriya/tests/regressions.rs index 83dd63d..c6980cf 100644 --- a/vidyut-prakriya/tests/regressions.rs +++ b/vidyut-prakriya/tests/regressions.rs @@ -44,3 +44,20 @@ fn irshy_san_lan() { &["Erzyiyizat", "Erzyizizat"], ); } + +// Fixes https://github.com/ambuda-org/vidyut/issues/120 +#[test] +fn ayiyat() { + assert_has_tip(&[], &nic(&d("I\\N", Divadi)), Lun, &["Ayiyat"]); +} + +// Fixes https://github.com/ambuda-org/vidyut/issues/121 +#[test] +fn adhyajigapat_adhyapipat() { + assert_has_tip( + &["aDi"], + &nic(&d("i\\N", Adadi)), + Lun, + &["aDyajIgapat", "aDyApipat"], + ); +}