﻿<?xml version="1.0" encoding="utf-8"?>
<lgr xmlns="urn:ietf:params:xml:ns:lgr-1.0">
  <meta>
    <version comment="Root Zone LGR for Malayalam">3</version>
    <date>2019-07-10</date>
    <language>und-Mlym</language>
    <scope type="domain">.</scope>
    <unicode-version>6.3.0</unicode-version>
    <description type="text/html"><![CDATA[
    <h1>Root Zone Label Generation Rules for the Malayalam Script</h1>
    
    <h2>Overview</h2>
    <p>This file contains Label Generation Rules (LGR) for the Malayalam script for the Root zone. 
       For more details on this LGR and its development, see "Proposal for a Malayalam Script Root Zone 
       Label Generation Ruleset (LGR) [Proposal]". 
       This file is one of a set of LGR files that together form an integrated LGR for the DNS Root Zone [RZ-LGR-3]. The format of this file follows [RFC 7940].</p>

<h2>Repertoire</h2>
    <p>According to Section 5, "Repertoire" in [Proposal], the Malayalam LGR contains 70 unique code points. This  LGR caters to the Malayalam language written 
    using the Malayalam script.</p>
        
    <p>The repertoire is based on [MSR-4], which is a subset of [Unicode 6.3].</p>
    
    <p>Code points outside the Malayalam script that are listed in this file are targets
        for out-of-script variants and are identified by a reflexive (identity)
        variant of type "out-of-repertoire-var". They do not form part of the
        repertoire.</p>
    
     <p>Each code point is tagged with the script or scripts that
     the code point is used with, a category value, and one or more references documenting 
     sufficient justification for inclusion in the repertoire, see "References" below.
     For code points that are part of the repertoire, comments identify the languages using the code point.</p>

    <h2>Variants</h2>
    <p>According to Section 6, "Variants", in [Proposal], this LGR defines one in-script variant due to the multiple ways to write the conjunct "nta" in Malayalam. There are also variants defined between the conjunct and non conjunct forms of  ററ and ളള, because they cannot be reliably distinguished.</p>
    
    <p>This LGR also defines the cross-script variants which are "Confusing due to deviation from normally perceived character formations by larger linguistic 
    community". These cases are not of mere visual similarity; they can cause confusion even to a
    careful observer and hence have been defined 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 would be delegated
    any other equivalent label should be blocked. There is no preference among these variants.</p>

  <p>This LGR does not define allocatable variants.</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 explicit
    context rules on the code points (or by implicit context rules defined for the adjacent code points). 
     In such a case, any variants may require context rules that match the intersection
    between the effective 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>
   
   <p>Some of the sequences defined for Malayalam have the effect of allowing code points in contexts that are
   otherwise forbidden: context rules are never evaluated between elements of the same sequence.</p>
   
   <p>The specification of variants in the Root Zone LGR follows the guidelines in [RFC 8228].</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>Consonants: 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" in [Proposal].</p>

    <p>Vowels and Matras: Vowels other than the inherent vowel are written as vowel diacritics. They are referred to as Matras, 
    when they follow consonants. When they occur independently they are written with one of 13 independent vowels. 
     More details in Section 3.8, "The Structure of Malayalam Script" in [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" in [Proposal].</p>

    <p>Anusvaram: In Malayalam, Anusvara, encoded as U+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" in [Proposal].</p>

    <p>Visargam:  Visargam or Visarga, encoded as U+0D03, 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" in [Proposal].</p>

    <p>Chillus: Chillu letters, aka "Chillaksharam", represent pure consonants without any vowel sound. 
    More details in Section 3.8, "The Structure of Malayalam Script" in [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" in [Proposal].</p>

    <h2>Whole Label Evaluation (WLE) and Context Rules</h2>
    <h3>Default Whole Label Evaluation Rules and Actions</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;. The 
          default prohibition on leading combining marks is equivalent to ensuring that 
          a label only starts with a consonant or vowel.</p> 
        
    <h3>Malayalam-specific Rules and Action</h3>
    <p>The Malayalam LGR specifies a number of context rules that constrain possible labels so that
    they reasonably conform to Malayalam syllable structure An additional whole-label rule and associated action
    enforce the restriction that a label may not begin with a chillu.</p>
    <p>The 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 or U+07DB</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 U+0D33 cannot immediately follow U+0D33, except as part of a defined sequence</li>
        <li>8. The character U+0D31 cannot immediately follow U+0D31, except as part of a defined sequence</li>
     </ul>
    <p>The following context rules apply to variants:</p>
     <ul>
        <li>V1: A variant preceded by 0D33+Halant or followed by R or Halant+0D33 is not defined</li>
        <li>V2: A variant preceded by 0D31+Halant or followed by R of 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)" in [Proposal].</p>
    
    <p>Note: the implementation of Rules 7 and 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>
    
    <h2>Methodology and Contributors</h2>
    <p>The LGR for the Malayalam script was developed by the Neo-Brahmi Generation Panel (NBGP) the members 
     of which have experience in linguistics and computational linguistics in a wide variety of languages
     written with Neo-Brahmi scripts. Under the Neo-Brahmi Generation Panel, there are 
    nine scripts belonging to separate Unicode blocks. Each of these scripts has been assigned a 
    separate LGR, with the Neo-Brahmi GP ensuring that the fundamental philosophy behind building 
    each LGR is in sync with all other Brahmi derived scripts. For further details on methodology and
    contributors, see Sections 4 and 8 in [Proposal], as well as [RZ-LGR-3-Overview].</p>
    
    <h2>References</h2> 
    <p>The following general 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 2019, 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)", 22 April 2019, https://www.icann.org/en/system/files/files/proposal-malayalam-lgr-22apr19-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>[RFC 8228]</dt>
    <dd>A. Freytag, "Guidance on Designing Label Generation Rulesets (LGRs) Supporting Variant Labels", RFC 8228, August 2017,
    https://www.rfc-editor.org/info/rfc8228</dd>
      <dt>[RZ-LGR-3-Overview]</dt>
       <dd>Integration Panel, "Root Zone Label Generation Rules - LGR-3: Overview and Summary", 10 July 2019 (PDF), https://www.icann.org/sites/default/files/lgr/lgr-3-overview-10jul19-en.pdf</dd>

     <dt>[RZ-LGR-3]</dt>
     <dd>Integration Panel, "Label Generation Rules for the Root Zone &#x2014; LGR-3", 10 July 2019 (XML), https://www.icann.org/sites/default/files/lgr/lgr-3-common-10jul19-en.xml <br/>
     <i>non-normative HTML presentation: https://www.icann.org/sites/default/files/lgr/lgr-3-common-10jul19-en.html</i></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, &amp;quot;Malayalam (മലയാളം)&amp;quot; ,https://www.omniglot.com/writing/malayalam.htm (Accessed on 5  July, 2018)</reference>
    </references>
  </meta>
  <data>
    <char cp="0B20" tag="sc:Orya" 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" tag="sc:Taml" 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" tag="sc:Taml" 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" tag="sc:Taml" 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" tag="sc:Taml" 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" tag="sc:Taml" 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" tag="sc:Taml" 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 sc:Mlym" ref="106" />
    <char cp="0D03" when="follows-C-V-or-M" tag="sc:Mlym Visargam" ref="106" />
    <char cp="0D05" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D06" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D07" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D08" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D09" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D0A" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D0B" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D0E" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D0F" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D10" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D12" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D13" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D14" tag="sc:Mlym Vowel" ref="106" />
    <char cp="0D15" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D16" tag="Consonant sc:Mlym" ref="106">
      <var cp="0BB5" type="blocked" comment="Cross-script homoglyph" />
    </char>
    <char cp="0D17" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D18" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D19" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D1A" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D1B" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D1C" tag="Consonant sc:Mlym" ref="106">
      <var cp="0B9C" type="blocked" comment="Cross-script homoglyph" />
    </char>
    <char cp="0D1D" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D1E" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D1F" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D20" tag="Consonant sc:Mlym" ref="106">
      <var cp="0B20" type="blocked" comment="Cross-script homoglyph" />
    </char>
    <char cp="0D21" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D22" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D23" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D24" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D25" tag="Consonant sc:Mlym" ref="106">
      <var cp="0BAE" type="blocked" comment="Cross-script homoglyph" />
    </char>
    <char cp="0D26" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D27" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D28" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D28 0D4D 0D31" not-when="follows-B-X-or-H" ref="106">
      <var cp="0D7B 0D31" type="blocked" />
    </char>
    <char cp="0D2A" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D2B" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D2C" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D2D" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D2E" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D2F" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D30" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D31" not-when="follows-0D31" tag="Consonant sc:Mlym" ref="106" />
    <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 sc:Mlym" ref="106" />
    <char cp="0D33" not-when="follows-0D33" tag="Consonant sc:Mlym" ref="106" />
    <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 sc:Mlym" ref="106" />
    <char cp="0D35" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D36" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D37" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D38" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D39" tag="Consonant sc:Mlym" ref="106" />
    <char cp="0D3E" when="follows-C" tag="Matra sc:Mlym" ref="106" />
    <char cp="0D3F" when="follows-C" tag="Matra sc:Mlym" ref="106">
      <var cp="0BBF" type="blocked" comment="Cross-script homoglyph" />
    </char>
    <char cp="0D40" when="follows-C" tag="Matra sc:Mlym" ref="106" />
    <char cp="0D41" when="follows-C" tag="Matra sc:Mlym" ref="106" />
    <char cp="0D42" when="follows-C" tag="Matra sc:Mlym" ref="106" />
    <char cp="0D43" when="follows-C" tag="Matra sc:Mlym" ref="106" />
    <char cp="0D46" when="follows-C" tag="Matra R sc:Mlym" ref="106">
      <var cp="0BC6" type="blocked" comment="Cross-script homoglyph" />
    </char>
    <char cp="0D47" when="follows-C" tag="Matra R sc:Mlym" ref="106">
      <var cp="0BC7" type="blocked" comment="Cross-script homoglyph" />
    </char>
    <char cp="0D48" when="follows-C" tag="Matra R sc:Mlym" ref="106" />
    <char cp="0D4A" when="follows-C" tag="Matra R sc:Mlym" ref="106" />
    <char cp="0D4B" when="follows-C" tag="Matra R sc:Mlym" ref="106" />
    <char cp="0D4D" when="follows-C-or-0D41-or-0D7B" tag="Halant sc:Mlym" ref="106" />
    <char cp="0D57" when="follows-C" tag="Matra sc:Mlym" ref="106" />
    <char cp="0D7A" not-when="follows-B-X-or-H" tag="Chillu sc:Mlym" ref="106" />
    <char cp="0D7B" not-when="follows-B-X-or-H" tag="Chillu sc:Mlym" ref="106" />
    <char cp="0D7B 0D31" not-when="follows-B-X-or-H" ref="106">
      <var cp="0D28 0D4D 0D31" type="blocked" />
    </char>
    <char cp="0D7C" not-when="follows-B-X-or-H" tag="Chillu sc:Mlym" ref="106" />
    <char cp="0D7D" not-when="follows-B-X-or-H" tag="Chillu sc:Mlym" ref="106" />
    <char cp="0D7E" not-when="follows-B-X-or-H" tag="Chillu sc:Mlym" ref="106" />
    <char cp="0D7F" not-when="follows-B-X-or-H" tag="Chillu sc:Mlym" ref="106" />
  </data>
  <!--Rules section goes here-->
  <rules>
    <!--Character class definitions go here-->
    <class name="C" from-tag="Consonant" comment="Any Malayalam consonant" />
    <class name="V" from-tag="Vowel" comment="Any Malayalam independent vowel" />
    <class name="M" from-tag="Matra" comment="Any Malayalam vowel sign (matra)" />
    <class name="H" from-tag="Halant" comment="The Malayalam Halant / Virama" />
    <class name="B" from-tag="Anusvaram" comment="The Malayalam Anusvaram" />
    <class name="X" from-tag="Visargam" comment="The Malayalam Visargam" />
    <class name="L" from-tag="Chillu" comment="Any Malayalam consonant without any vowel sound" />
    <class name="R" from-tag="R" comment="Any Malayalam reordrant vowel sign" />
    <!--Whole label evaluation and context rules go here-->
    <rule name="leading-combining-mark" comment="Default WLE rule matching labels with leading combining marks &#x235F;">
      <start />
      <union>
        <class property="gc:Mn" />
        <class property="gc:Mc" />
      </union>
    </rule>
    <rule name="follows-C-or-0D41-or-0D7B" comment="Section 7, WLE 1: Rule 1: H must be preceded by C or U+0D41-or-U+0D7B">
      <look-behind>
        <choice>
          <class by-ref="C" />
          <char cp="0D41" />
          <char cp="0D7B" />
        </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 U+0D33 (ള) cannot immediately follow U+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 U+0D31 (റ) cannot immediately follow U+0D31 (റ), except as part of a defined sequence">
      <look-behind>
        <char cp="0D31" />
      </look-behind>
      <anchor />
    </rule>
    <rule name="reordrant-matra" comment="Section 7: Reordrant Malayalam 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="follows-0D33-0D4D-or-followed-by-0D4D-0D33-or-R" comment="Section 6.1, V1: 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, V2: 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>
    <!--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" any-variant="out-of-repertoire-var" comment="any variant label with a code point out of repertoire is invalid &#x235F;" />
    <action disp="invalid" match="begins-with-L" comment="Section 7, WLE 6: Label does not begin with L" />
    <action disp="blocked" any-variant="blocked" comment="any variant label containing blocked variants is blocked &#x235F;" />
    <action disp="allocatable" all-variants="allocatable" comment="variant labels with all variants allocatable are allocatable &#x235F;" />
    <action disp="valid" comment="catch all (default action) &#x235F;" />
  </rules>
</lgr>