Skip to content

Commit 635dfb4

Browse files
committed
Apply review comments
1 parent 43e6ddb commit 635dfb4

File tree

8 files changed

+49
-74
lines changed

8 files changed

+49
-74
lines changed

vidyut-prakriya/src/core/term.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl Term {
226226
}
227227

228228
pub fn u_adi(&self) -> Option<char> {
229-
self.u.clone().unwrap().bytes().next().map(|x| x as char)
229+
self.u.as_ref()?.bytes().next().map(|x| x as char)
230230
}
231231

232232
/// Returns the last sound in the term if it exists.

vidyut-prakriya/src/it_agama.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ fn run_valadau_ardhadhatuke_before_attva_for_term(ip: &mut ItPrakriya) -> Option
512512
can_block = !ip.optional_try_add("7.2.17");
513513
}
514514
if can_block {
515-
// Block iw-agama
516515
ip.try_block("7.2.16");
517516
}
518517
} else if anga.has_u_in(&["wuvama~", "Svasa~"]) {

vidyut-prakriya/src/samjna.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ pub fn try_decide_pratipadika(p: &mut Prakriya) -> Option<()> {
456456
&& !t.is_agama()
457457
&& !t.is_abhyasa()
458458
&& !t.is_pada()
459-
&& !t.is_upasarga()
460-
461459
{
462460
// 1.2.45 specifies "arthavat", so exclude meaningless terms (agamas and abhyasas).
463461
// TODO: is there anything else that's not arthavat?

vidyut-prakriya/src/tripadi/pada_8_4.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,6 @@ fn try_natva_for_span(
6363
}
6464
}
6565

66-
/* This is only for debugging
67-
if let Some(i_dhatu2) = ip.p.find_first_with_tag(T::Pada) {
68-
let term = ip.p.get(i_dhatu2)?;
69-
70-
if term.has_u_in( &["BU", "BA\\", "pUY"]) {
71-
ip.p.debug("Found term BA");
72-
} else {
73-
ip.p.debug("did not find term BA");
74-
ip.p.debug(format!("i_x={}, i_y={:?}", i_x, i_y));
75-
}
76-
ip.p.dump();
77-
}
78-
// End Debugging */
79-
8066
let x = ip.p.get(i_x)?;
8167
let y = ip.p.get(i_y)?;
8268

@@ -225,14 +211,12 @@ fn try_natva_for_span(
225211

226212
if dhatu.has_u_in( &["BU", "BA\\", "pUY",
227213
Aupadeshika::opyAyI.as_str(), "ga\\mx~", "kamu~\\", "wuvepf~\\"]) {
228-
// Really do not apply anything but note the usage of the rule to deny Ratva
229214
ip.p.step("8.4.34");
230215
} else if dhatu.has_antya(HAL) && dhatu.has_tag(T::idit) {
231216
if dhatu.has_u_adi(IC) {
232217
ip.p.run_at("8.4.32", i_y, |t| t.find_and_replace_text("n", "R"));
233218
} else {
234-
// Do nothing but note the step for clarification
235-
// this is the case for परिमङ्गनम् and प्राङ्गनम्
219+
// This is the case for परिमङ्गनम् and प्राङ्गनम्
236220
ip.p.step("8.4.32");
237221
}
238222
} else if prev_is_ac {

vidyut-prakriya/tests/integration/kashika_3_2.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,9 @@ fn sutra_3_2_45() {
525525

526526
#[test]
527527
fn sutra_3_2_46() {
528-
let mut myd = d("Df\\Y", Bhvadi);
529-
assert_has_upapada_krdanta("vasu", &[], &nic(&myd), Krt::Kac, &["vasunDara"]);
530-
myd = d("quBf\\Y", Juhotyadi);
531-
assert_has_upapada_krdanta("viSva", &[], &myd, Krt::Kac, &["viSvamBara"]);
532-
myd = d("tF", Bhvadi);
533-
assert_has_upapada_krdanta("raTa", &[], &myd, Krt::Kac, &["raTantara"]);
528+
assert_has_upapada_krdanta("vasu", &[], &nic(&d("Df\\Y", Bhvadi)), Krt::Kac, &["vasunDara"]);
529+
assert_has_upapada_krdanta("viSva", &[], &d("quBf\\Y", Juhotyadi), Krt::Kac, &["viSvamBara"]);
530+
assert_has_upapada_krdanta("raTa", &[], &d("tF", Bhvadi), Krt::Kac, &["raTantara"]);
534531
}
535532

536533
#[test]

vidyut-prakriya/tests/integration/kashika_6_1.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,12 @@ fn sutra_6_1_48() {
524524

525525
#[test]
526526
fn sutra_6_1_49() {
527-
let zid = d("zi\\Du~", Divadi);
528-
assert_has_tip(&[], &nic(&zid), Lat, &["sADayati", "seDayati"]);
527+
assert_has_tip(
528+
&[],
529+
&nic(&d("zi\\Du~", Divadi)),
530+
Lat,
531+
&["sADayati", "seDayati"],
532+
);
529533
}
530534

531535
#[test]

vidyut-prakriya/tests/integration/kashika_8_4.rs

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,17 @@ fn sutra_8_4_2() {
7575

7676
#[test]
7777
fn sutra_8_4_8() {
78-
let mut rule_choices: Vec<RuleChoice> = vec![];
7978
let vah = d("va\\ha~^", Bhvadi);
8079

8180
// 8.4.8 has two rules
8281
// Nipatana ufor vAhana always
8382
// 8.4.8.1 : Ahita for vAhanam
84-
rule_choices.push(RuleChoice {
85-
rule: Rule::Ashtadhyayi("8.4.8.1"),
86-
decision: Decision::Accept
87-
});
88-
89-
let mut t = Tester::with_rule_choices(rule_choices);
83+
let mut t = Tester::with_rule_choices(vec![
84+
RuleChoice {
85+
rule: Rule::Ashtadhyayi("8.4.8.1"),
86+
decision: Decision::Accept
87+
},
88+
]);
9089

9190
t.assert_has_upapada_krdanta("ikzu", &[], &vah, Krt::lyuw, &["ikzuvAhaRa"]);
9291
t.assert_has_upapada_krdanta("darBa", &[], &vah, Krt::lyuw, &["darBavAhaRa"]);
@@ -96,13 +95,12 @@ fn sutra_8_4_8() {
9695
t.assert_has_bahuvrihi("darBa", "vAhana", &["darBavAhaRa"]);
9796

9897
// Swamitva artha
99-
rule_choices = vec![];
100-
rule_choices.push(RuleChoice {
101-
rule: Rule::Ashtadhyayi("8.4.8.1"),
102-
decision: Decision::Decline
103-
});
104-
105-
t = Tester::with_rule_choices(rule_choices);
98+
t = Tester::with_rule_choices(vec![
99+
RuleChoice {
100+
rule: Rule::Ashtadhyayi("8.4.8.1"),
101+
decision: Decision::Decline
102+
},
103+
]);
106104
t.assert_has_upapada_krdanta("dAkzi", &[], &vah, Krt::lyuw, &["dAkzivAhana"]);
107105

108106
// As in dAkzi's vAhana .. (sasthi tatpurusha intent so Decline the rule)
@@ -309,15 +307,13 @@ fn sutra_8_4_24() {
309307
assert_has_jhi(&["antar"], &han, Lat, &["antarGnanti"]);
310308
assert_has_krdanta(&["antar"], &han, Krt::lyuw, &["antarhaRana", "antarhanana"]);
311309

312-
// Forcing a specific choice to assume "desh" context
313-
let mut rule_choices = vec![];
314-
rule_choices.push(RuleChoice {
315-
rule: Rule::Ashtadhyayi("8.4.24"),
316-
decision: Decision::Decline
317-
});
318-
319310
// The "desh" case
320-
let t = Tester::with_rule_choices(rule_choices);
311+
let t = Tester::with_rule_choices(vec![
312+
RuleChoice {
313+
rule: Rule::Ashtadhyayi("8.4.24"),
314+
decision: Decision::Decline
315+
}
316+
]);
321317
t.assert_has_ta_k(&["antar"], &han, Lat, &["antarhanyate"]);
322318
t.assert_has_ta_k(&["antar"], &han, Lun, &["antaraGAni", "antaravaDi"]); // No change
323319
t.assert_has_jhi(&["antar"], &han, Lat, &["antarGnanti"]);
@@ -326,26 +322,22 @@ fn sutra_8_4_24() {
326322

327323
#[test]
328324
fn sutra_8_4_25() {
329-
let mut rule_choices: Vec<RuleChoice> = vec![];
330-
331-
// 8.4.25 : Accept
332-
rule_choices.push(RuleChoice {
333-
rule: Rule::Ashtadhyayi("8.4.25"),
334-
decision: Decision::Accept
335-
});
336-
337-
let mut t = Tester::with_rule_choices(rule_choices);
325+
let mut t = Tester::with_rule_choices(vec![
326+
RuleChoice {
327+
rule: Rule::Ashtadhyayi("8.4.25"),
328+
decision: Decision::Accept
329+
}
330+
]);
338331
// antaH (antarasmin?) ayanam
339332
t.assert_has_saptami_tatpurusha("antar", "ayana", &["antarayaRa"]);
340333

341334
// 8.4.25: Decline ("Desh" case)
342-
rule_choices = vec![];
343-
rule_choices.push(RuleChoice {
344-
rule: Rule::Ashtadhyayi("8.4.25"),
345-
decision: Decision::Decline
346-
});
347-
348-
t = Tester::with_rule_choices(rule_choices);
335+
t = Tester::with_rule_choices(vec![
336+
RuleChoice {
337+
rule: Rule::Ashtadhyayi("8.4.25"),
338+
decision: Decision::Decline
339+
}
340+
]);
349341
// antaH Iyate asmin deSe
350342
t.assert_has_bahuvrihi("antar", "ayana", &["antarayana"]);
351343
}

vidyut-prakriya/tests/integration/regressions.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,16 @@ fn ratva_8_4_14() {
354354
}
355355

356356
#[test]
357+
#[allow(non_snake_case)]
357358
fn zta_with_upsarga() {
358-
let myd = d("zWA\\", Bhvadi);
359+
let zWA = d("zWA\\", Bhvadi);
359360
// No upsarga actually has both atmane and parasmai padi forms
360-
assert_has_krdanta(&[], &san(&myd), Krt::Satf, &["tizWAsat"]);
361-
assert_has_krdanta(&[], &san(&myd), Krt::SAnac, &["tizWAsamAna"]);
361+
assert_has_krdanta(&[], &san(&zWA), Krt::Satf, &["tizWAsat"]);
362+
assert_has_krdanta(&[], &san(&zWA), Krt::SAnac, &["tizWAsamAna"]);
362363
// "pari" upasarga is always parasmaipadi
363-
assert_has_krdanta(&["pari"], &san(&myd), Krt::Satf, &["paritizWAsat"]);
364-
assert_has_krdanta(&["pari"], &san(&myd), Krt::SAnac, &[]); // fails
364+
assert_has_krdanta(&["pari"], &san(&zWA), Krt::Satf, &["paritizWAsat"]);
365+
assert_has_krdanta(&["pari"], &san(&zWA), Krt::SAnac, &[]);
365366
// "pra" upasarga is always atmanepadi
366-
assert_has_krdanta(&["pra"], &san(&myd), Krt::SAnac, &["pratizWAsamAna"]);
367-
assert_has_krdanta(&["pra"], &san(&myd), Krt::Satf, &[]); // fails
367+
assert_has_krdanta(&["pra"], &san(&zWA), Krt::SAnac, &["pratizWAsamAna"]);
368+
assert_has_krdanta(&["pra"], &san(&zWA), Krt::Satf, &[]);
368369
}

0 commit comments

Comments
 (0)