iXML Community Group Test Suite

23 Oct 2023 (22 Nov 2023)

Top-level catalog for tests in the iXML Community Group Test Suite.

Tests have been contributed from several sources, but the core of the test collection are the tests contributed by Steven Pemberton in December 2021.

ixml tests

01 Jun 2022

Tests provided by Steven Pemberton in December 2021, with corrections of 21 December. Reorganized by Norm Tovey-Walsh, February 2022.

ixml1

Created 16 Dec 2021 by SP

Invisible XML Grammar

ixml: S, rule+.
rule: mark?, name, S, ":", S, def, ".", S.
def: alt++(";", S).
alt: term**(",", S).
-term: factor; repeat0; repeat1; option.
repeat0: factor, "*", S, sep?.
sep: factor.
repeat1: factor, "+", S, sep?.
option: factor, "?", S.
-factor: nonterminal; terminal; "(", S, def, ")", S.
nonterminal: mark?, name, S.
terminal: mark?, (quoted; hex; charset; exclude).

charset: "[", S,  element++(";", S), "]", S.
exclude: "~", S, -charset.

-element: range; character, S; class, S.
range: from, S, "-", S, to, S.
@from: character.
@to: character.
class: letter, letter. {One of the Unicode character classes}

@name: letgit, xletter*.
-letgit: letter; digit.
-letter: ["a"-"z"; "A"-"Z"].
-digit: ["0"-"9"].
-xletter: letgit; "-".

@mark: "@", S; "^", S; "-", S.

quoted: -'"', dstring, -'"', S; -"'", sstring, -"'", S.
@dstring: dchar+.
@sstring: schar+.
dchar: ~['"']; '""'. {all characters, dquotes must be doubled}
schar: ~["'"]; "''". {all characters, squotes must be doubled}
-character: '"', dchar, '"'; "'", schar, "'"; hex.

hex: "#", number.
number: hexit+.
-hexit: digit; ["a"-"f"; "A"-"F"].

-S: (" "; -#a; -#d; comment)*.
comment: "{", cchar*, "}".
-cchar: ~["}"].
{the end}

Test case: ixml1

Repository URI: …/tests/ixml/test-catalog.xml

Created 16 Dec 2021 by SP

Updated 30 Dec 2021 by MSM

stripped non-significant whitespace from result

Updated 01 Jan 2022 by MSM

stripped erroneous blanks from dchar rule in expected result

The exclude element in the rule for dchar included 18 extraneous blanks; after the exclude, the terminal element concluded with an extraneous blank line containing 12 blanks. These have now been removed.

Input string (1179 characters)

ixml: S, rule+.
rule: mark?, name, S, ":", S, def, ".", S.
def: alt+(";", S).
alt: term*(",", S).
-term: factor; repeat0; repeat1; option.
repeat0: factor, "*", S, sep?.
sep: factor.
repeat1: factor, "+", S, sep?.
option: factor, "?", S.
-factor: nonterminal; terminal; "(", S, def, ")", S.
nonterminal: mark?, name, S.
terminal: mark?, (quoted; hex; charset; exclude).

charset: "[", S,  element+(";", S), "]", S.
exclude: "~", S, -charset.

-element: range; character, S; class, S.
range: from, S, "-", S, to, S.
@from: character.
@to: character.
class: letter, letter. {One of the Unicode character classes}

@name: letgit, xletter*.
-letgit: letter; digit.
-letter: ["a"-"z"; "A"-"Z"].
-digit: ["0"-"9"].
-xletter: letgit; "-".

@mark: "@", S; "^", S; "-", S.

quoted: -'"', dstring, -'"', S; -"'", sstring, -"'", S.
@dstring: dchar+.
@sstring: schar+.
dchar: ~['"']; '""'. {all characters, dquotes must be doubled}
schar: ~["'"]; "''". {all characters, squotes must be doubled}
-character: '"', dchar, '"'; "'", schar, "'"; hex.

hex: "#", number.
number: hexit+.
-hexit: digit; ["a"-"f"; "A"-"F"].

-S: (" "; comment)*.
comment: "{", cchar*, "}".
-cchar: ~["}"].
{the end}

Expected result

<ixml>
   <rule name="ixml">: <def>
         <alt>
            <nonterminal name="S"/>, <repeat1>
               <nonterminal name="rule"/>+</repeat1>
         </alt>
      </def>.</rule>
   <rule name="rule">: <def>
         <alt>
            <option>
               <nonterminal name="mark"/>?</option>, <nonterminal name="name"/>, <nonterminal name="S"/>, <terminal>
               <quoted dstring=":"/>
            </terminal>, <nonterminal name="S"/>, <nonterminal name="def"/>, <terminal>
               <quoted dstring="."/>
            </terminal>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule name="def">: <def>
         <alt>
            <repeat1>
               <nonterminal name="alt"/>+<sep>(<def>
                     <alt>
                        <terminal>
                           <quoted dstring=";"/>
                        </terminal>, <nonterminal name="S"/>
                     </alt>
                  </def>)</sep>
            </repeat1>
         </alt>
      </def>.</rule>
   <rule name="alt">: <def>
         <alt>
            <repeat0>
               <nonterminal name="term"/>*<sep>(<def>
                     <alt>
                        <terminal>
                           <quoted dstring=","/>
                        </terminal>, <nonterminal name="S"/>
                     </alt>
                  </def>)</sep>
            </repeat0>
         </alt>
      </def>.</rule>
   <rule mark="-" name="term">: <def>
         <alt>
            <nonterminal name="factor"/>
         </alt>; <alt>
            <nonterminal name="repeat0"/>
         </alt>; <alt>
            <nonterminal name="repeat1"/>
         </alt>; <alt>
            <nonterminal name="option"/>
         </alt>
      </def>.</rule>
   <rule name="repeat0">: <def>
         <alt>
            <nonterminal name="factor"/>, <terminal>
               <quoted dstring="*"/>
            </terminal>, <nonterminal name="S"/>, <option>
               <nonterminal name="sep"/>?</option>
         </alt>
      </def>.</rule>
   <rule name="sep">: <def>
         <alt>
            <nonterminal name="factor"/>
         </alt>
      </def>.</rule>
   <rule name="repeat1">: <def>
         <alt>
            <nonterminal name="factor"/>, <terminal>
               <quoted dstring="+"/>
            </terminal>, <nonterminal name="S"/>, <option>
               <nonterminal name="sep"/>?</option>
         </alt>
      </def>.</rule>
   <rule name="option">: <def>
         <alt>
            <nonterminal name="factor"/>, <terminal>
               <quoted dstring="?"/>
            </terminal>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule mark="-" name="factor">: <def>
         <alt>
            <nonterminal name="nonterminal"/>
         </alt>; <alt>
            <nonterminal name="terminal"/>
         </alt>; <alt>
            <terminal>
               <quoted dstring="("/>
            </terminal>, <nonterminal name="S"/>, <nonterminal name="def"/>, <terminal>
               <quoted dstring=")"/>
            </terminal>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule name="nonterminal">: <def>
         <alt>
            <option>
               <nonterminal name="mark"/>?</option>, <nonterminal name="name"/>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule name="terminal">: <def>
         <alt>
            <option>
               <nonterminal name="mark"/>?</option>, (<def>
               <alt>
                  <nonterminal name="quoted"/>
               </alt>; <alt>
                  <nonterminal name="hex"/>
               </alt>; <alt>
                  <nonterminal name="charset"/>
               </alt>; <alt>
                  <nonterminal name="exclude"/>
               </alt>
            </def>)</alt>
      </def>.</rule>
   <rule name="charset">: <def>
         <alt>
            <terminal>
               <quoted dstring="["/>
            </terminal>, <nonterminal name="S"/>,  <repeat1>
               <nonterminal name="element"/>+<sep>(<def>
                     <alt>
                        <terminal>
                           <quoted dstring=";"/>
                        </terminal>, <nonterminal name="S"/>
                     </alt>
                  </def>)</sep>
            </repeat1>, <terminal>
               <quoted dstring="]"/>
            </terminal>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule name="exclude">: <def>
         <alt>
            <terminal>
               <quoted dstring="~"/>
            </terminal>, <nonterminal name="S"/>, <nonterminal mark="-" name="charset"/>
         </alt>
      </def>.</rule>
   <rule mark="-" name="element">: <def>
         <alt>
            <nonterminal name="range"/>
         </alt>; <alt>
            <nonterminal name="character"/>, <nonterminal name="S"/>
         </alt>; <alt>
            <nonterminal name="class"/>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule name="range">: <def>
         <alt>
            <nonterminal name="from"/>, <nonterminal name="S"/>, <terminal>
               <quoted dstring="-"/>
            </terminal>, <nonterminal name="S"/>, <nonterminal name="to"/>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule mark="@" name="from">: <def>
         <alt>
            <nonterminal name="character"/>
         </alt>
      </def>.</rule>
   <rule mark="@" name="to">: <def>
         <alt>
            <nonterminal name="character"/>
         </alt>
      </def>.</rule>
   <rule name="class">: <def>
         <alt>
            <nonterminal name="letter"/>, <nonterminal name="letter"/>
         </alt>
      </def>. <comment>{One of the Unicode character classes}</comment>
   </rule>
   <rule mark="@" name="name">: <def>
         <alt>
            <nonterminal name="letgit"/>, <repeat0>
               <nonterminal name="xletter"/>*</repeat0>
         </alt>
      </def>.</rule>
   <rule mark="-" name="letgit">: <def>
         <alt>
            <nonterminal name="letter"/>
         </alt>; <alt>
            <nonterminal name="digit"/>
         </alt>
      </def>.</rule>
   <rule mark="-" name="letter">: <def>
         <alt>
            <terminal>
               <charset>[<range from="&#34;a&#34;" to="&#34;z&#34;">-</range>; <range from="&#34;A&#34;" to="&#34;Z&#34;">-</range>]</charset>
            </terminal>
         </alt>
      </def>.</rule>
   <rule mark="-" name="digit">: <def>
         <alt>
            <terminal>
               <charset>[<range from="&#34;0&#34;" to="&#34;9&#34;">-</range>]</charset>
            </terminal>
         </alt>
      </def>.</rule>
   <rule mark="-" name="xletter">: <def>
         <alt>
            <nonterminal name="letgit"/>
         </alt>; <alt>
            <terminal>
               <quoted dstring="-"/>
            </terminal>
         </alt>
      </def>.</rule>
   <rule mark="@" name="mark">: <def>
         <alt>
            <terminal>
               <quoted dstring="@"/>
            </terminal>, <nonterminal name="S"/>
         </alt>; <alt>
            <terminal>
               <quoted dstring="^"/>
            </terminal>, <nonterminal name="S"/>
         </alt>; <alt>
            <terminal>
               <quoted dstring="-"/>
            </terminal>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule name="quoted">: <def>
         <alt>
            <terminal mark="-">
               <quoted sstring="&#34;"/>
            </terminal>, <nonterminal name="dstring"/>, <terminal mark="-">
               <quoted sstring="&#34;"/>
            </terminal>, <nonterminal name="S"/>
         </alt>; <alt>
            <terminal mark="-">
               <quoted dstring="'"/>
            </terminal>, <nonterminal name="sstring"/>, <terminal mark="-">
               <quoted dstring="'"/>
            </terminal>, <nonterminal name="S"/>
         </alt>
      </def>.</rule>
   <rule mark="@" name="dstring">: <def>
         <alt>
            <repeat1>
               <nonterminal name="dchar"/>+</repeat1>
         </alt>
      </def>.</rule>
   <rule mark="@" name="sstring">: <def>
         <alt>
            <repeat1>
               <nonterminal name="schar"/>+</repeat1>
         </alt>
      </def>.</rule>
   <rule name="dchar">: <def>
         <alt>
            <terminal>
               <exclude>~['<schar>"</schar>']</exclude>
            </terminal>
         </alt>; <alt>
            <terminal>
               <quoted sstring="&#34;&#34;"/>
            </terminal>
         </alt>
      </def>. <comment>{all characters, dquotes must be doubled}</comment>
   </rule>
   <rule name="schar">: <def>
         <alt>
            <terminal>
               <exclude>~["<dchar>'</dchar>"]</exclude>
            </terminal>
         </alt>; <alt>
            <terminal>
               <quoted dstring="''"/>
            </terminal>
         </alt>
      </def>. <comment>{all characters, squotes must be doubled}</comment>
   </rule>
   <rule mark="-" name="character">: <def>
         <alt>
            <terminal>
               <quoted sstring="&#34;"/>
            </terminal>, <nonterminal name="dchar"/>, <terminal>
               <quoted sstring="&#34;"/>
            </terminal>
         </alt>; <alt>
            <terminal>
               <quoted dstring="'"/>
            </terminal>, <nonterminal name="schar"/>, <terminal>
               <quoted dstring="'"/>
            </terminal>
         </alt>; <alt>
            <nonterminal name="hex"/>
         </alt>
      </def>.</rule>
   <rule name="hex">: <def>
         <alt>
            <terminal>
               <quoted dstring="#"/>
            </terminal>, <nonterminal name="number"/>
         </alt>
      </def>.</rule>
   <rule name="number">: <def>
         <alt>
            <repeat1>
               <nonterminal name="hexit"/>+</repeat1>
         </alt>
      </def>.</rule>
   <rule mark="-" name="hexit">: <def>
         <alt>
            <nonterminal name="digit"/>
         </alt>; <alt>
            <terminal>
               <charset>[<range from="&#34;a&#34;" to="&#34;f&#34;">-</range>; <range from="&#34;A&#34;" to="&#34;F&#34;">-</range>]</charset>
            </terminal>
         </alt>
      </def>.</rule>
   <rule mark="-" name="S">: <def>
         <alt>
            <repeat0>(<def>
                  <alt>
                     <terminal>
                        <quoted dstring=" "/>
                     </terminal>
                  </alt>; <alt>
                     <nonterminal name="comment"/>
                  </alt>
               </def>)*</repeat0>
         </alt>
      </def>.</rule>
   <rule name="comment">: <def>
         <alt>
            <terminal>
               <quoted dstring="{"/>
            </terminal>, <repeat0>
               <nonterminal name="cchar"/>*</repeat0>, <terminal>
               <quoted dstring="}"/>
            </terminal>
         </alt>
      </def>.</rule>
   <rule mark="-" name="cchar">: <def>
         <alt>
            <terminal>
               <exclude>~["<dchar>}</dchar>"]</exclude>
            </terminal>
         </alt>
      </def>.<comment>{the end}</comment>
   </rule>
</ixml>