<span class="Apple-style-span" style="font-family: Garamond; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><b>Context Rules</b></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="font-weight: bold; "><br></span></p>Still needs&nbsp;a&nbsp;lot&nbsp;of&nbsp;work,&nbsp;and problems noted in&nbsp;<a id="i90l" href="http://www.alvestrand.no/pipermail/idna-update/2008-November/002964.html" title="http://www.alvestrand.no/pipermail/idna-update/2008-November/002964.html" style="color: rgb(85, 26, 139); ">http://www.alvestrand.no/pipermail/idna-update/2008-November/002964.html</a>&nbsp;&nbsp;haven&#39;t&nbsp;been&nbsp;done. Other items:<br>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><b><i>Location</i></b></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><i>Since this will not be part of the final document: the text will be moved to the IANA registry and be maintained there -- there needs to be a note to the readers and editor to that effect at the top of the section. There should also be an ed note there (in John&#39;s style) indicating that the following rules still require much work.</i></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><b><i>Pseudocode</i></b></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<i>There should be some explanation of the syntax and functions, even if not precise. The syntax needs to be a bit more extended to be useful.</i></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<span class="Apple-style-span" style="font-style: italic; "><br></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><i>I&#39;d suggest defining P to be the current position of the character being tested, F to be the position of the first character, and L to be the position of the last character. Then we don&#39;t need constructs such as LastChar, and can be more expressive,&nbsp;because we have to be able to look at more than one character before/after; eg we can then use Script(Character[P-2]) to get the script of the previous to last character. (Note: I include F just so we don&#39;t have to decide between zero-based or one-based, but it would be even simpler to do zero-based.)</i></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-style-span" style="font-style: italic; "><br></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<i>I&#39;d also prefer&nbsp;just using = instead of .eq., but that&#39;s just a preference.</i></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-style-span" style="font-style: italic; "><br>
</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><i>The rules need to be carefully reviewed for clarity and consistency with the text (and vice versa). For example, even for a simple case like Garesh there are many problems.</i></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></p>Overview: The&nbsp;script&nbsp;of&nbsp;the&nbsp;preceding&nbsp;character&nbsp;and&nbsp;the&nbsp;subsequent&nbsp;character,&nbsp;if&nbsp;any,&nbsp;MUST&nbsp;be&nbsp;Hebrew.<div style="margin-top: 0px; margin-bottom: 0px; ">
<span class="Apple-style-span" style="font-style: italic; ">// The scope of &quot;if any&quot; must be clear. Is it to apply to both the preceding and subsequent, or just the subsequent?</span></div><div style="margin-top: 0px; margin-bottom: 0px; ">
<span class="Apple-style-span" style="font-style: italic; ">// And it must not require the second, because it can be final in a word, which means it is fine to follow with &quot;-&quot; or other non-Hebrew.</span></div><div style="margin-top: 0px; margin-bottom: 0px; ">
<br><div style="margin-top: 0px; margin-bottom: 0px; ">Rule&nbsp;Set:</div><div style="margin-top: 0px; margin-bottom: 0px; ">If&nbsp;FirstChar&nbsp;.eq.&nbsp;True&nbsp;then&nbsp;False;&nbsp;</div><div style="margin-top: 0px; margin-bottom: 0px; ">Else&nbsp;If&nbsp;BeforeScript&nbsp;.eq.&nbsp;Hebrew&nbsp;Then&nbsp;</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp; &nbsp;If&nbsp;AfterScript&nbsp;.eq.&nbsp;Hebrew&nbsp;Then&nbsp;True;&nbsp;</div><div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp; &nbsp;Else&nbsp;False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">
<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><span class="Apple-style-span" style="font-style: italic; ">// This is missing a trailing Else (made clear by my block indentation)</span></div><div style="margin-top: 0px; margin-bottom: 0px; ">
<span class="Apple-style-span" style="font-style: italic; ">// While it shouldn&#39;t require an AfterScript, even the syntax is ill-defined:</span></div><div style="margin-top: 0px; margin-bottom: 0px; "><span class="Apple-style-span" style="font-style: italic; ">// &nbsp; &nbsp;What is the value of AfterScript if there is no character after? There is no check to make sure that it isn&#39;t LastChar.</span></div>
<div style="margin-top: 0px; margin-bottom: 0px; "><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">
<b>9. HYPHEN-MINUS</b></div><div style="margin-top: 0px; margin-bottom: 0px; ">Overview: Must&nbsp;appear&nbsp;at&nbsp;the&nbsp;beginning&nbsp;or&nbsp;end&nbsp;of&nbsp;a&nbsp;label.<br>...</div><div style="margin-top: 0px; margin-bottom: 0px; ">Rule&nbsp;Set:&nbsp;</div><div style="margin-top: 0px; margin-bottom: 0px; ">
If&nbsp;FirstChar&nbsp;.eq.&nbsp;True&nbsp;Then&nbsp;False;&nbsp;</div><div style="margin-top: 0px; margin-bottom: 0px; ">If&nbsp;LastChar&nbsp;.eq.&nbsp;Then&nbsp;False;&nbsp;</div><div style="margin-top: 0px; margin-bottom: 0px; ">Else&nbsp;True;<br>=&gt;</div><div style="margin-top: 0px; margin-bottom: 0px; ">
Overview: Must&nbsp;appear neither at&nbsp;the&nbsp;beginning nor at the end&nbsp;of&nbsp;a&nbsp;label, and must not be in both the third and fourth positions in the string.</div><div style="margin-top: 0px; margin-bottom: 0px; ">Rule Set:</div><div style="margin-top: 0px; margin-bottom: 0px; ">
If P = F OR P = L Then False;&nbsp;</div><div style="margin-top: 0px; margin-bottom: 0px; ">Else if P = F+2 And Character[P+1] = &quot;-&quot; Then False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">Else if P = F+3 And Character[P-1] = &quot;-&quot; Then False;</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">Else&nbsp;True;</div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Hyphen-Minus is quite unlike the rest of the rules in that we can NEVER have the above 3 conditions changed. We should just remove it from the CONTEXTO rules, since the conditions for its use are in Protocol as a separate condition (Hyphen - P4.3.2.1, although this needs fleshing out, see previous note) from the CONTEXT conditions (P4.3.2.3).</div>
<div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; "><b>10. ZERO&nbsp;WIDTH&nbsp;NON-JOINER</b></div><div style="margin-top: 0px; margin-bottom: 0px; ">
<span style="font-weight: normal; "><div style="margin-top: 0px; margin-bottom: 0px; ">For the rule sets I suggest the following.&nbsp;Rationale:&nbsp;As long as it is pseudocode&nbsp;--&nbsp;it is made up for this purpose and matches no real programming language&nbsp;--&nbsp;we should use a pseudocode that actually works to give the same meaning as the prose. And the conditions needed to be tighter, as per&nbsp;<a id="wvj." href="http://unicode.org/reports/tr31/#Layout_and_Format_Control_Characters" title="http://unicode.org/reports/tr31/#Layout_and_Format_Control_Characters">http://unicode.org/reports/tr31/#Layout_and_Format_Control_Characters</a></div>
<div style="margin-top: 0px; margin-bottom: 0px; ">===</div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; "><div style="margin-top: 0px; margin-bottom: 0px; ">
The script&nbsp;must&nbsp;be&nbsp;one&nbsp;in&nbsp;which&nbsp;the&nbsp;use&nbsp;of&nbsp;this&nbsp;character&nbsp;causes&nbsp;significant&nbsp;visual&nbsp;transformation&nbsp;of&nbsp;one&nbsp;or&nbsp;both&nbsp;of&nbsp;the&nbsp;adjacent&nbsp;characters.<br>=&gt;<br>The&nbsp;script&nbsp;must&nbsp;be&nbsp;one&nbsp;in&nbsp;which&nbsp;the&nbsp;use&nbsp;of&nbsp;this&nbsp;character&nbsp;causes visual&nbsp;transformation&nbsp;of&nbsp;one&nbsp;or&nbsp;both&nbsp;of&nbsp;the&nbsp;adjacent&nbsp;characters that are required for&nbsp;significant&nbsp;semantic distinctions in at least some cases. This includes ZWNJ after certain Virama characters, and between particular joining characters in&nbsp;cursive scripts like Arabic.</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">[[anchor9a:&nbsp;The&nbsp;script&nbsp;list&nbsp;for&nbsp;this&nbsp;character&nbsp;is&nbsp;_not_&nbsp;complete&nbsp;and,&nbsp;in&nbsp;particular,&nbsp;more&nbsp;Indic&nbsp;scripts&nbsp;certainly&nbsp;need&nbsp;to&nbsp;be&nbsp;listed.]]</div><div style="margin-top: 0px; margin-bottom: 0px; ">
<br></div></div></span><span style="font-weight: normal; "><div style="margin-top: 0px; margin-bottom: 0px; ">RuleSet</div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">
If&nbsp;<span style="font-family: Arial; "><span style="font-family: Garamond; "><font size="2">BeforeScript&nbsp;.eq.&nbsp;(&nbsp;Deva&nbsp;|&nbsp;Tamil |... )&nbsp;Then</font></span></span></div><div style="margin-top: 0px; margin-bottom: 0px; "><div style="margin-top: 0px; margin-bottom: 0px; ">
&nbsp;&nbsp;If P = F OR P = L Then False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else if Canonical_Combining_Class(Character[P-1])&nbsp;!= Virama&nbsp;Then False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else if Not IsLetter(Character[P-2]) Then False;</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else if Not ScriptCount(Character[P-2] + Character[P-1]) &gt; 1 Then False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">
Else if BeforeScript != Arabic Then False;</div>Else if&nbsp;Not&nbsp;MatchesBefore([[:jt=D:][:jt=L:]][:jt=T:]*)&nbsp;Then&nbsp;False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">Else if&nbsp;Not&nbsp;MatchesAfter([:jt=T:]*[[:jt=D:][:jt=R:]]) Then&nbsp;False;</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">Else True;</div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div>For more&nbsp;information&nbsp;see&nbsp;Section&nbsp;2.3&nbsp;Layout&nbsp;and&nbsp;Format&nbsp;Control&nbsp;Characters&nbsp;in&nbsp;[UAX31].&nbsp;</span></div>
<div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; "><span style="font-weight: normal; "><br></span><b>11.&nbsp;ZERO&nbsp;WIDTH&nbsp;JOINER<br></b><br><div style="margin-top: 0px; margin-bottom: 0px; ">
The script&nbsp;must&nbsp;be&nbsp;one&nbsp;in&nbsp;which&nbsp;the&nbsp;use&nbsp;of&nbsp;this&nbsp;character&nbsp;causes&nbsp;significant&nbsp;visual&nbsp;transformation&nbsp;of&nbsp;one&nbsp;or&nbsp;both&nbsp;of&nbsp;the&nbsp;adjacent&nbsp;characters.<br>=&gt;<br>The&nbsp;script&nbsp;must&nbsp;be&nbsp;one&nbsp;in&nbsp;which&nbsp;the&nbsp;use&nbsp;of&nbsp;this&nbsp;character&nbsp;causes visual&nbsp;transformation&nbsp;of&nbsp;one&nbsp;or&nbsp;both&nbsp;of&nbsp;the&nbsp;adjacent&nbsp;characters that are required for&nbsp;significant&nbsp;semantic distinctions in at least some cases. This includes ZWNJ after certain Virama characters, and between particular joining characters in&nbsp;cursive scripts like Arabic.</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">[[anchor9a:&nbsp;The&nbsp;script&nbsp;list&nbsp;for&nbsp;this&nbsp;character&nbsp;is&nbsp;_not_&nbsp;complete&nbsp;and,&nbsp;in&nbsp;particular,&nbsp;more&nbsp;Indic&nbsp;scripts&nbsp;certainly&nbsp;need&nbsp;to&nbsp;be&nbsp;listed.]]</div><div style="margin-top: 0px; margin-bottom: 0px; ">
<br></div></div><div style="margin-top: 0px; margin-bottom: 0px; ">RuleSet</div><div style="margin-top: 0px; margin-bottom: 0px; ">If&nbsp;<span style="font-family: Arial; "><span style="font-family: Garamond; "><font size="2">BeforeScript&nbsp;.eq.&nbsp;(&nbsp;Deva&nbsp;|&nbsp;Tamil |... )&nbsp;Then</font></span></span></div>
<div style="margin-top: 0px; margin-bottom: 0px; "><div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;If P = F OR P = L Then False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else if Canonical_Combining_Class(Character[P-1])&nbsp;!= Virama&nbsp;Then False;</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else if Not IsLetter(Character[P-2]) Then False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else if Not ScriptCount(Character[P-2] + Character[P-1]) &gt; 1 Then False;</div>
<div style="margin-top: 0px; margin-bottom: 0px; ">&nbsp;&nbsp;Else False;</div><div style="margin-top: 0px; margin-bottom: 0px; ">Else False;</div></div><div style="margin-top: 0px; margin-bottom: 0px; "><div style="margin-top: 0px; margin-bottom: 0px; ">
<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><b>14. MODIFIER&nbsp;LETTER&nbsp;PRIME&nbsp;</b><br><br>Add a description: also used in Cyrillic transcription, where it must be after a consonant.</div><div style="margin-top: 0px; margin-bottom: 0px; ">
<br></div>BeforeScript If&nbsp;.eq.&nbsp;Greek&nbsp;Then&nbsp;</div><div style="margin-top: 0px; margin-bottom: 0px; ">...<br>=&gt;<br>If&nbsp;IsLetter(Character[-1])&nbsp;And&nbsp;BeforeScript&nbsp;=&nbsp;Cyrillic&nbsp;Then True;</div><div style="margin-top: 0px; margin-bottom: 0px; ">
...</div></div></span>Mark<br>