#------------------------------
# How to write the sandhi rules
#------------------------------
# Lines beginning with a # or empty lines are skipped
# Each line should contain one rule
# (Can be written in devanagari easier to read/check for a human)
# Each rule is typically left_1 + left_2 = right_1 / right_2 / ...
# left_1 and left_2 can specify lists. These will be 
# expanded by the parser to generate a product of all possible combinations
# E.g. [अ, इ, उ, ऋ][ ङ्, ञ्, न्] + [अ, आ, इ, ई, उ, ऊ, ऋ, ॠ, ए, ऐ, ओ, औ]
# right uses Python's format string specification to refer to
# elements from the left expression. 
# Note that even a single character on the left is treated as a list, so be 
# careful with indexing in the right expression.
# E.g. एचोऽयवायावः / यान्तवान्तादेशः would be specified as 
# ए + [आ, इ, ई, उ, ऊ, ऋ, ॠ, ऌ, ए, ऐ, ओ, औ] = अय्{1} (the ए would be considered as list 0)
# Multiple right expressions can be specified by separating them with "/"
# Spaces at the beginning and end of expressions are stripped,
# but if they appear inside an expression, they will be preserved
# E.g. the space in अ {1}  for एचोऽयवायावः + लोपः शाकल्यस्य will be retained
# mAheswara-sutra pratyAhAras can be included in the rules by preceding them with a *
# To exclude certain varnas from a pratyAhAra, you can use set notation
# E.g. [*अच् - इई] 
# Note that pratyAhAras with vowels will be expanded to include dIrghas as well

# 1. विसर्जनीयस्य सः etc.
[स्, ः] + [त्, थ्] = स्{1}
[ः] + [च्, छ्] = श्{1}
[ः] + [ट्, ठ्] = ष्{1}
[ः] + [श्, स्, ष्] = ः{1} / {1}{1}
# For the last three, the case of returning स् will be 
# taken care of by schutva/ShTutva etc.

# 2. कुप्वोः ...
[स्, र्, ः] + [क्, ख्, प्, फ्] = ः {1} / ः{1}

# 3. रेफः
[*इच्][स्, र्, ः] + [*अश्] = {0}र्{2} / {0}र् {2}

# लोपः
आ[ः, स्, र्] + [*अश्] = आ {2} / आ{2}
अ[ः, स्, र्] + [*अच् - अ] = अ {2} / अ{2}
^[एष, स][ः, स्, र्] + [*अल् - अ] = {1} {3} / {1}{3}

[इ, ई][ः, स्, र्] + र् = ई र् / ईर्
[उ, ऊ][ः, स्, र्] + र् = ऊ र् / ऊर्
[ऋ, ॠ][ः, स्, र्] + र् = ॠ र् / ॠर्
[ए, ऐ, ओ, औ][ः, स्, र्] + र् = {0} र् / {0}र्
# Even though this only happens for some forms, we need to be able to split पुनारमते etc.
अ[स्, र्, ः] + र् = आर् / आ र्
# This only applies to certain forms, but we need to split them as well
#अ[ः, स्, र्] + [*अल्] = अर्{2}
^पुन[ः, स्, र्] + [*अल्] = पुनर्{2}

# उत्वम्
# ससजुषो रुः, खरवसानयोर्विसर्जनीयः, अतो रोरप्लुतादप्लुते etc.
[ः, स्, र्] + = ः
अ[ः, स्, र्] + अ[*हल्+ं] = ओ{3} / ओऽ{3}
अ[ः, स्, र्] + [*हश्] = ओ {2} / ओ{2}
