﻿<?xml version="1.0" encoding="utf-8"?>
<lgr xmlns="urn:ietf:params:xml:ns:lgr-1.0">
  <meta>
    <version comment="Proposed LGR for Malayalam">4</version>
    <date>2020-06-26</date>
    <language>und-Mlym</language>
    <scope type="domain">.</scope>
    <unicode-version>6.3.0</unicode-version>
    <description type="text/html"><![CDATA[
    
    <h1>Label Generation Rules for Malayalam script</h1>
    <p>This LGR proposal was originally published on April 22, 2019. It has been updated to correct an inconsistency involving the support for conjunct “nta” and to address new cross-script variants for LGR-4.</p>
        
    <h2>Overview</h2>    
    <p>This file contains Label Generation Rules (LGR) for the Malayalam script as would be appropriate for the 
    Root zone. For more details on this proposal see "Proposal for a Malayalam Script Root Zone Label Generation Ruleset (LGR) [Proposal]". 
    The format of this file follows [RFC 7940].</p>
   
    <h2>Background of Malayalam Script</h2>
    <p>Malayalam was first written with the Vatteluttu alphabet (വട്ടെഴുത്ത് Vaṭṭeḻuttŭ), which means 'round writing' and developed from the Brahmi script. 
    The oldest known written text in Malayalam is known as the Vazhappalli or Vazhappally inscription, is in the Vatteluttu alphabet and dates from 
    about 830 AD. More details in Section "3 Background on Script and Principal Languages Using It" of the [Proposal].</p>
    
    <h2>Character Classes</h2>
    <p>The basic characters in Malayalam are classified into seven main categories. They are Consonants, Vowels, Matra, Halant, Visargam, 
    Anusvaram and Chillu letters. </p>
    
    <p>Consonant: Malayalam is written in an abugida script derived ultimately from Brāhmī in which 
    every consonant carries an inherent a. More details in Section 3.8, "The Structure of 
    Malayalam Script" of the [Proposal].</p>

    <p>Matra: Vowels other than the inherent vowel are written as vowel diacritics. They are referred to as Matras, 
    when they follow consonants. More details in Section 3.8, "The Structure of Malayalam Script" of the [Proposal].</p>
    
    <p>Halant: A consonant can be combined with another consonant or conjunct 
    using the halant encoded as U+0D4D MALAYALAM SIGN VIRAMA. This strips off the implicit vowel. 
     More details in Section 3.8, "The Structure of Malayalam Script" of the [Proposal].</p>

    <p>Anusvaram: In Malayalam, anusvara represented as ം (0D02), simply represents a consonant /m/ after a vowel, 
    though this /m/ may be assimilated to another nasal consonant. More details in Section 3.8 "The Structure of Malayalam 
    Script" of the [Proposal].</p>

    <p>Visargam: /വിസർഗം,/ (visargam), or visarga, represents a consonant /h/ after a vowel, 
    and is transliterated as ḥ. Like the anusvara, it is a special symbol, and is never followed by an 
    inherent vowel or another vowel. More details in Section 3.8, "The Structure of Malayalam 
    Script" of the [Proposal].</p>

    <p>Chillu: Chillu letters, aka "Chillaksharam", represent pure consonants without any vowel sound. 
    More details in Section 3.8, "The Structure of Malayalam Script" of the [Proposal].</p>
    
    <p>Reordrant: Vowel diacritics, part of which reorder around the preceding character or conjunct. 
    More details in Sections 6.1 "In-script Variants" and 7.1.1 "Variables or definitions" of the [Proposal].</p>    
    <h2>Repertoire</h2>
    <p>According to Section 5, "Repertoire" in [Proposal], the Malayalam LGR contains 70 unique code points.</p>
    <p>The repertoire is based on [MSR-4], which is a subset of Unicode 6.3 [Unicode 6.3].</p>
    <p>Each code-point has associated Glyph, Character Name, Indic Syllabic Category and References.</p>
    
    <h2>Variants</h2>
    <p>According to Section 6 "Variants", in "[Proposal]", this LGR defines in-script variant sets due to the multiple ways to write the conjunct 
    “nta" in Malayalam. This LGR also defines the cross-script variant sets which are "Confusing due to deviation from normally perceived character 
    formations by larger linguistic community". These cases are not of mere visual similarity. These can cause confusion even to a    careful observer 
    and hence being proposed as variants.</p>
    
    <p>Variant Disposition: All variants are of type "blocked", making labels that differ only    by these variants mutually exclusive:  
    whichever label containing either of these variants is chosen earlier, the other one equivalent variant label should be blocked. 
    There is no preference among these variants.</p>
    
    <p>Sequences ending with 0D31 overlap with the various variant sequences beginning with 0D31, the actual implementation 
    of these variants will drop the 0D31 from the end of these sequences, but add a context rule when="followed-by-0D31" instead. This implementation 
    is equivalent as far as variants generated for the sequences ending with 0D31, but variant is well-behaved in cases where any 
    of the sequences here is followed by 0D31 or 0D4D 0D31.</p>
    
    <p>Context Rules for Variants: some of the variants defined in this LGR are "effective null variants", that is,
    some code points in the source map to "nothing" in the target with all other code points unchanged.
    (Because mappings are symmetric, it does not matter whether it is the forward or reverse mapping that
    maps to "null"). Such variants require a context rule to keep the variant set well-behaved. Symmetry requires
    the same context rule for both forward and reverse mappings.</p>
   
    <p>In other cases, the sequences or code points making up source and target are constrained by context
    rules on the code points. In such a case, any variants require context rules that match the intersection
    between the contexts for both source and target; otherwise a sequence might be considered valid in some
    variant label when it would not be valid in an equivalent context in an original label.</p>

    <h2>Whole Label Evaluation (WLE) rules</h2>
    <h3>Default Whole Label Evaluation Rules</h3>
    <p>The LGR includes the set of required default WLE rules and actions applicable to 
    the Root Zone and defined in [MSR-4]. They are marked with &#x235F;.</p>
    <h3>Malayalam specific Rules</h3>
    <p>These rules have been formulated so that they can be adopted for  LGR specification.</p>
    <p>Following symbols are used in the WLE rules: 
    <br/>C    →    Consonant
    <br/>M    →    Matra
    <br/>V    →    Vowel
    <br/>B    →    Anusvara
    <br/>X    →    Visarga 
    <br/>D    →    Chandrabindu
    <br/>H    →    Halant
    <br/>L    →    Chillu
    <br/>R    →    Reordrant Matra
    </p>
    <p>Note: the Reordrant Matras include one sequence. That requires an auxiliary rule R in addition to class R.</p>
    
    <p>The rules are: </p>
    <ul>
        <li>1. H: must be preceded by C or U+0D41</li>
        <li>2. M: must be preceded by C</li>
        <li>3. B: must be preceded by C, V or M</li>
        <li>4. X: must be preceded by C, V or M</li>
        <li>5. L: cannot be preceded by B, X or H</li>
        <li>6. A label does not begin with L</li>
    </ul>
    <p>The following context rules  apply to code points U+0D33 and U+0D31 as well as to sequences ending in these code points:</p>
    <ul>
      <li>7. The character ള (0D33) cannot immediately follow ള (0D33), except as part of a defined sequence</li>
      <li>8. The character റ (0D31) cannot immediately follow റ (0D31), except as part of a defined sequence</li>
    </ul>
    
    <p>The following context rule applies to sequence 0D7B 0D4D :</p>
    <ul>
      <li>9. Sequence 0D7B 0D4D must be preceded by C, L, M, V and must be followed by റ (0D31)</li>
    </ul>
    <p>The following context rules apply to variants:</p>
    <ul>
        <li>V1: A variant is defined when followed by 0D31</li>
        <li>V2: A variant preceded by 0D33+Halant or followed by R or Halant+0D33 is not defined</li>
        <li>V3: A variant preceded by 0D31+Halant or followed by R or Halant+0D31 is not defined</li>
    </ul>
    
    <p>More details in Section 6.1 "In-script Variants" and Section 7, "Whole Label Evaluation Rules (WLE)" of the [Proposal]</p>
    <p>Note: the implementation of Rules 7 &amp; 8 relies on the fact that a context rule is not evaluated between code points in the same sequence. 
    For example, if a label contains two adjacent U+0D33 U+0D33 surrounded by other code points , the two code points can only be interpreted 
    as the sequence U+0D33 U+0D33 ളള because a singleton U+0D33  ള  is not allowed to be followed by another U+0D33 ള.
    </p>
    
    <p>There are a number of cross script homoglyphs to RRA, which would interact with the definition of in-script sequences and 
    variants, leading to unacceptable complexity. These variants would affect only the two possible labels made solely of letters
    RRA, and no other labels. Rule 8 already restricts labels consisting solely of copies of the letter RRA to either റ or ററ,, thus 
    allowing only two such labels. The following rule disallows the remaining two possible labels.</p>
    
    <ul>
          <li>10. A label cannot consist solely of letters RRA റ (0D31)</li>
    </ul>
    
    <h2>Overall Development Process and Methodology</h2>
    <p>Under the Neo-Brahmi Generation Panel, there are many different scripts belonging to separate Unicode blocks. 
    Each of these scripts will be assigned a separate LGR; however Neo-Brahmi GP will ensure that the fundamental philosophy 
    behind building those LGRs are all in sync with all other Brahmi derived scripts. 
    This is the Malayalam LGR, which caters to Malayalam language written using the Malayalam script.</p>
    
    <h2>References</h2> 
    <p>Following references are cited in this document:</p>
    <dl class="references">
    <dt>[MSR-4]</dt>
    <dd>Integration Panel, "Maximal Starting Repertoire — MSR-4 Overview and Rationale", 7 February 2018, 
    https://www.icann.org/en/system/files/files/msr-4-overview-25jan19-en.pdf</dd> 
    
     <dt>[Proposal]</dt> <dd></dd><dd>Neo-Brahmi Generation Panel, "Proposal for a Malayalam Script Root Zone Label Generation Ruleset (LGR)", 26 June 2020, https://www.icann.org/en/system/files/files/proposal-malayalam-lgr-26jun20-en.pdf</dd>
     <dt>[RFC 7940]</dt><dd>Davies, K. and A. Freytag, "Representing Label Generation Rulesets Using XML", RFC 7940, August 2016, http://www.rfc-editor.org/info/rfc7940. </dd>
     <dt>[Unicode 6.3]</dt><dd>The Unicode Consortium. The Unicode Standard, Version 6.3.0, (Mountain View, CA: The Unicode Consortium, 2013. ISBN 978-1-936213-08-5), http://www.unicode.org/versions/Unicode6.3.0/</dd></dl>
     
     ]]></description>
    <references>
      <reference id="106">Omniglot, Malayalam (മലയാളം): https://www.omniglot.com/writing/malayalam.htm (Accessed on 5th July, 2018)</reference>
    </references>
  </meta>
  <data>
    <char cp="0B20" comment="not part of repertoire">
      <var cp="0B20" type="out-of-repertoire-var" comment="Out of repertoire" />
      <var cp="0D20" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0B9C" comment="not part of repertoire">
      <var cp="0B9C" type="out-of-repertoire-var" comment="Out of repertoire" />
      <var cp="0D1C" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0BAE" comment="not part of repertoire">
      <var cp="0BAE" type="out-of-repertoire-var" comment="Out of repertoire" />
      <var cp="0D25" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0BB5" comment="not part of repertoire">
      <var cp="0BB5" type="out-of-repertoire-var" comment="Out of repertoire" />
      <var cp="0D16" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0BBF" comment="not part of repertoire">
      <var cp="0BBF" type="out-of-repertoire-var" comment="Out of repertoire" />
      <var cp="0D3F" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0BC6" comment="not part of repertoire">
      <var cp="0BC6" type="out-of-repertoire-var" comment="Out of repertoire" />
      <var cp="0D46" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0BC7" comment="not part of repertoire">
      <var cp="0BC7" type="out-of-repertoire-var" comment="Out of repertoire" />
      <var cp="0D47" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D02" when="follows-C-V-or-M" tag="Anusvaram" ref="106" comment="MALAYALAM SIGN ANUSVARA" />
    <char cp="0D03" when="follows-C-V-or-M" tag="Visargam" ref="106" comment="MALAYALAM SIGN VISARGA" />
    <char cp="0D05" tag="Vowel" ref="106" comment="MALAYALAM LETTER A" />
    <char cp="0D06" tag="Vowel" ref="106" comment="MALAYALAM LETTER AA" />
    <char cp="0D07" tag="Vowel" ref="106" comment="MALAYALAM LETTER I" />
    <char cp="0D08" tag="Vowel" ref="106" comment="MALAYALAM LETTER II" />
    <char cp="0D09" tag="Vowel" ref="106" comment="MALAYALAM LETTER U" />
    <char cp="0D0A" tag="Vowel" ref="106" comment="MALAYALAM LETTER UU" />
    <char cp="0D0B" tag="Vowel" ref="106" comment="MALAYALAM LETTER VOCALIC R" />
    <char cp="0D0E" tag="Vowel" ref="106" comment="MALAYALAM LETTER E" />
    <char cp="0D0F" tag="Vowel" ref="106" comment="MALAYALAM LETTER EE" />
    <char cp="0D10" tag="Vowel" ref="106" comment="MALAYALAM LETTER AI" />
    <char cp="0D12" tag="Vowel" ref="106" comment="MALAYALAM LETTER O" />
    <char cp="0D13" tag="Vowel" ref="106" comment="MALAYALAM LETTER OO" />
    <char cp="0D14" tag="Vowel" ref="106" comment="MALAYALAM LETTER AU" />
    <char cp="0D15" tag="Consonant" ref="106" comment="MALAYALAM LETTER KA" />
    <char cp="0D16" tag="Consonant" ref="106" comment="MALAYALAM LETTER KHA">
      <var cp="0BB5" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D17" tag="Consonant" ref="106" comment="MALAYALAM LETTER GA" />
    <char cp="0D18" tag="Consonant" ref="106" comment="MALAYALAM LETTER GHA" />
    <char cp="0D19" tag="Consonant" ref="106" comment="MALAYALAM LETTER NGA" />
    <char cp="0D1A" tag="Consonant" ref="106" comment="MALAYALAM LETTER CA" />
    <char cp="0D1B" tag="Consonant" ref="106" comment="MALAYALAM LETTER CHA" />
    <char cp="0D1C" tag="Consonant" ref="106" comment="MALAYALAM LETTER JA">
      <var cp="0B9C" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D1D" tag="Consonant" ref="106" comment="MALAYALAM LETTER JHA" />
    <char cp="0D1E" tag="Consonant" ref="106" comment="MALAYALAM LETTER NYA" />
    <char cp="0D1F" tag="Consonant" ref="106" comment="MALAYALAM LETTER TTA" />
    <char cp="0D20" tag="Consonant" ref="106" comment="MALAYALAM LETTER TTHA">
      <var cp="0B20" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D21" tag="Consonant" ref="106" comment="MALAYALAM LETTER DDA" />
    <char cp="0D22" tag="Consonant" ref="106" comment="MALAYALAM LETTER DDHA" />
    <char cp="0D23" tag="Consonant" ref="106" comment="MALAYALAM LETTER NNA" />
    <char cp="0D24" tag="Consonant" ref="106" comment="MALAYALAM LETTER TA" />
    <char cp="0D25" tag="Consonant" ref="106" comment="MALAYALAM LETTER THA">
      <var cp="0BAE" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D26" tag="Consonant" ref="106" comment="MALAYALAM LETTER DA" />
    <char cp="0D27" tag="Consonant" ref="106" comment="MALAYALAM LETTER DHA" />
    <char cp="0D28" tag="Consonant" ref="106" comment="MALAYALAM LETTER NA" />
    <char cp="0D28 0D4D" not-when="follows-B-X-or-H" ref="106">
      <var cp="0D7B" when="followed-by-0D31" type="blocked" />
      <var cp="0D7B 0D4D" when="followed-by-0D31" type="blocked" />
    </char>
    <char cp="0D2A" tag="Consonant" ref="106" comment="MALAYALAM LETTER PA" />
    <char cp="0D2B" tag="Consonant" ref="106" comment="MALAYALAM LETTER PHA" />
    <char cp="0D2C" tag="Consonant" ref="106" comment="MALAYALAM LETTER BA" />
    <char cp="0D2D" tag="Consonant" ref="106" comment="MALAYALAM LETTER BHA" />
    <char cp="0D2E" tag="Consonant" ref="106" comment="MALAYALAM LETTER MA" />
    <char cp="0D2F" tag="Consonant" ref="106" comment="MALAYALAM LETTER YA" />
    <char cp="0D30" tag="Consonant" ref="106" comment="MALAYALAM LETTER RA" />
    <char cp="0D31" not-when="follows-0D31" tag="Consonant" ref="106" comment="MALAYALAM LETTER RRA" />
    <char cp="0D31 0D31" not-when="follows-0D31">
      <var cp="0D31 0D4D 0D31" not-when="follows-0D31-0D4D-or-followed-by-0D4D-0D31-or-R" type="blocked" />
    </char>
    <char cp="0D31 0D31 0D4D 0D31" not-when="follows-0D31">
      <var cp="0D31 0D4D 0D31 0D31" not-when="followed-by-R" type="blocked" />
    </char>
    <char cp="0D31 0D4D 0D31" not-when="follows-0D31">
      <var cp="0D31 0D31" not-when="follows-0D31-0D4D-or-followed-by-0D4D-0D31-or-R" type="blocked" />
    </char>
    <char cp="0D31 0D4D 0D31 0D31" not-when="follows-0D31">
      <var cp="0D31 0D31 0D4D 0D31" not-when="followed-by-R" type="blocked" />
    </char>
    <char cp="0D32" tag="Consonant" ref="106" comment="MALAYALAM LETTER LA" />
    <char cp="0D33" not-when="follows-0D33" tag="Consonant" ref="106" comment="MALAYALAM LETTER LLA" />
    <char cp="0D33 0D33" not-when="follows-0D33">
      <var cp="0D33 0D4D 0D33" not-when="follows-0D33-0D4D-or-followed-by-0D4D-0D33-or-R" type="blocked" />
    </char>
    <char cp="0D33 0D33 0D4D 0D33" not-when="follows-0D33">
      <var cp="0D33 0D4D 0D33 0D33" not-when="followed-by-R" type="blocked" />
    </char>
    <char cp="0D33 0D4D 0D33" not-when="follows-0D33">
      <var cp="0D33 0D33" not-when="follows-0D33-0D4D-or-followed-by-0D4D-0D33-or-R" type="blocked" />
    </char>
    <char cp="0D33 0D4D 0D33 0D33" not-when="follows-0D33">
      <var cp="0D33 0D33 0D4D 0D33" not-when="followed-by-R" type="blocked" />
    </char>
    <char cp="0D34" tag="Consonant" ref="106" comment="MALAYALAM LETTER LLLA" />
    <char cp="0D35" tag="Consonant" ref="106" comment="MALAYALAM LETTER VA" />
    <char cp="0D36" tag="Consonant" ref="106" comment="MALAYALAM LETTER SHA" />
    <char cp="0D37" tag="Consonant" ref="106" comment="MALAYALAM LETTER SSA" />
    <char cp="0D38" tag="Consonant" ref="106" comment="MALAYALAM LETTER SA" />
    <char cp="0D39" tag="Consonant" ref="106" comment="MALAYALAM LETTER HA" />
    <char cp="0D3E" when="follows-C" tag="Matra" ref="106" comment="MALAYALAM VOWEL SIGN AA" />
    <char cp="0D3F" when="follows-C" tag="Matra" ref="106" comment="MALAYALAM VOWEL SIGN I">
      <var cp="0BBF" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D40" when="follows-C" tag="Matra" ref="106" comment="MALAYALAM VOWEL SIGN II" />
    <char cp="0D41" when="follows-C" tag="Matra" ref="106" comment="MALAYALAM VOWEL SIGN U" />
    <char cp="0D42" when="follows-C" tag="Matra" ref="106" comment="MALAYALAM VOWEL SIGN UU" />
    <char cp="0D43" when="follows-C" tag="Matra" ref="106" comment="MALAYALAM VOWEL SIGN VOCALIC R" />
    <char cp="0D46" when="follows-C" tag="Matra R" ref="106" comment="MALAYALAM VOWEL SIGN E">
      <var cp="0BC6" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D47" when="follows-C" tag="Matra R" ref="106" comment="MALAYALAM VOWEL SIGN EE">
      <var cp="0BC7" type="blocked" comment="cross-script homoglyph" />
    </char>
    <char cp="0D48" when="follows-C" tag="Matra R" ref="106" comment="MALAYALAM VOWEL SIGN AI" />
    <char cp="0D4A" when="follows-C" tag="Matra R" ref="106" comment="MALAYALAM VOWEL SIGN O" />
    <char cp="0D4B" when="follows-C" tag="Matra R" ref="106" comment="MALAYALAM VOWEL SIGN OO" />
    <char cp="0D4D" when="follows-C-or-0D41" tag="Halant" ref="106" comment="MALAYALAM SIGN VIRAMA" />
    <char cp="0D57" when="follows-C" tag="Matra" ref="106" comment="MALAYALAM AU LENGTH MARK" />
    <char cp="0D7A" not-when="follows-B-X-or-H" tag="Chillu" ref="106" comment="MALAYALAM LETTER CHILLU NN" />
    <char cp="0D7B" not-when="follows-B-X-or-H" tag="Chillu" ref="106" comment="MALAYALAM LETTER CHILLU N">
      <var cp="0D28 0D4D" when="followed-by-0D31" type="blocked" />
      <var cp="0D7B 0D4D" when="followed-by-0D31" type="blocked" />
    </char>
    <char cp="0D7B 0D4D" when="follows-C-L-M-V-and-followed-by-03D1">
      <var cp="0D28 0D4D" when="followed-by-0D31" type="blocked" />
      <var cp="0D7B" when="followed-by-0D31" type="blocked" />
    </char>
    <char cp="0D7C" not-when="follows-B-X-or-H" tag="Chillu" ref="106" comment="MALAYALAM LETTER CHILLU RR" />
    <char cp="0D7D" not-when="follows-B-X-or-H" tag="Chillu" ref="106" comment="MALAYALAM LETTER CHILLU L" />
    <char cp="0D7E" not-when="follows-B-X-or-H" tag="Chillu" ref="106" comment="MALAYALAM LETTER CHILLU LL" />
    <char cp="0D7F" not-when="follows-B-X-or-H" tag="Chillu" ref="106" comment="MALAYALAM LETTER CHILLU K" />
  </data>
  <!--Rules section goes here-->
  <rules>
    <!--Character class definitions go here-->
    <class name="C" from-tag="Consonant" comment="Any consonant" />
    <class name="V" from-tag="Vowel" comment="Any independent vowel" />
    <class name="M" from-tag="Matra" comment="Any vowel sign (matra)" />
    <class name="H" from-tag="Halant" comment="The Halant/Virama" />
    <class name="B" from-tag="Anusvaram" comment="The Anusvaram" />
    <class name="X" from-tag="Visargam" comment="The Visargam" />
    <class name="L" from-tag="Chillu" comment="Any consonant without any vowel sound" />
    <class name="R" from-tag="R" comment="Any reordrant vowel sign" />
    <!--Whole label evaluation and context rules go here-->
    <rule name="leading-combining-mark" comment="Default rule from MSR-4 &#x235F;">
      <start />
      <union>
        <class property="gc:Mn" />
        <class property="gc:Mc" />
      </union>
    </rule>
    <rule name="follows-C-or-0D41" comment="Section 7, WLE 1: Rule 1: H must be preceded by C or 0D41">
      <look-behind>
        <choice>
          <class by-ref="C" />
          <char cp="0D41" comment="MALAYALAM VOWEL SIGN U" />
        </choice>
      </look-behind>
      <anchor />
    </rule>
    <rule name="follows-C" comment="Section 7, WLE 2: M must be preceded by C">
      <look-behind>
        <class by-ref="C" />
      </look-behind>
      <anchor />
    </rule>
    <rule name="follows-C-V-or-M" comment="Section 7, WLE 3: B must be preceded by C, V or M and WLE 4: X must be preceded by C, V or M">
      <look-behind>
        <choice>
          <class by-ref="C" />
          <class by-ref="V" />
          <class by-ref="M" />
        </choice>
      </look-behind>
      <anchor />
    </rule>
    <rule name="follows-B-X-or-H" comment="Section 7, WLE 5: L cannot be preceded by B, X or H">
      <look-behind>
        <choice>
          <class by-ref="B" />
          <class by-ref="X" />
          <class by-ref="H" />
        </choice>
      </look-behind>
      <anchor />
    </rule>
    <rule name="begins-with-L" comment="Section 7, WLE 6: Label does not begin with L">
      <start />
      <class by-ref="L" />
    </rule>
    <rule name="follows-0D33" comment="Section 7, WLE 7. The character ള (0D33) cannot immediately follow ള (0D33), except as part of a defined sequence">
      <look-behind>
        <char cp="0D33" />
      </look-behind>
      <anchor />
    </rule>
    <rule name="follows-0D31" comment="Section 7, WLE 8. The character റ (0D31) cannot immediately follow റ (0D31), except as part of a defined sequence">
      <look-behind>
        <char cp="0D31" />
      </look-behind>
      <anchor />
    </rule>
    <rule name="follows-C-L-M-V-and-followed-by-03D1" comment="Section 7, WLE 9: Sequence 0D7B 0D4D must be preceded by C, L, M, V and must be followed by റ (0D31)">
      <look-behind>
        <choice>
          <class by-ref="C" />
          <class by-ref="L" />
          <class by-ref="M" />
          <class by-ref="V" />
        </choice>
      </look-behind>
      <anchor />
      <look-ahead>
        <char cp="0D31" />
      </look-ahead>
    </rule>
    <rule name="reordrant-matra" comment="Reordrant matras, including sequence U+0D4D U+0D30">
      <choice>
        <class by-ref="R" />
        <char cp="0D4D 0D30" />
      </choice>
    </rule>
    <rule name="followed-by-R" comment="variant not defined if followed by reordrant matra">
      <anchor />
      <look-ahead>
        <rule by-ref="reordrant-matra" />
      </look-ahead>
    </rule>
    <rule name="followed-by-0D31" comment="Section 6.1, V1: A variant is defined when followed by 0D31">
      <anchor />
      <look-ahead>
        <char cp="0D31" />
      </look-ahead>
    </rule>
    <rule name="follows-0D33-0D4D-or-followed-by-0D4D-0D33-or-R" comment="Section 6.1, V2: variant not defined if preceded by 0D33+Halant or followed by Halant+0D33 or R">
      <choice>
        <rule>
          <look-behind>
            <char cp="0D33 0D4D" />
          </look-behind>
          <anchor />
        </rule>
        <rule>
          <anchor />
          <look-ahead>
            <choice>
              <char cp="0D4D 0D33" />
              <rule by-ref="reordrant-matra" />
            </choice>
          </look-ahead>
        </rule>
      </choice>
    </rule>
    <rule name="follows-0D31-0D4D-or-followed-by-0D4D-0D31-or-R" comment="Section 6.1, V3: variant not defined if preceded by 0D31+Halant or followed by Halant+0D31 or R">
      <choice>
        <rule>
          <look-behind>
            <char cp="0D31 0D4D" />
          </look-behind>
          <anchor />
        </rule>
        <rule>
          <anchor />
          <look-ahead>
            <choice>
              <char cp="0D4D 0D31" />
              <rule by-ref="reordrant-matra" />
            </choice>
          </look-ahead>
        </rule>
      </choice>
    </rule>
    <rule name="only-RRA" comment="Section X.Y: Labels consisting solely of the letter RRA are disallowed to limit cross-script interaction">
      <start />
      <char cp="0D31" count="1+" />
      <end />
    </rule>
    <!--Action elements go here - order defines precedence-->
    <action disp="invalid" match="leading-combining-mark" comment="labels with leading combining marks are invalid &#x235F;" />
    <action disp="invalid" match="begins-with-L" comment="Section 7, WLE 6: Label does not begin with L" />
    <action disp="invalid" match="only-RRA" comment="Section 7, WLE 10: Label cannot contain only RRA" />
    <action disp="invalid" any-variant="out-of-repertoire-var" comment="any variant label with a code point out of repertoire is invalid &#x235F;" />
    <action disp="blocked" any-variant="blocked" comment="default action MSR-4 &#x235F;" />
    <action disp="allocatable" any-variant="allocatable" comment="default action MSR-4 &#x235F;" />
    <action disp="valid" comment="catch all; default action from MSR-4 &#x235F;" />
  </rules>
</lgr>