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.

ixml3

Created 16 Dec 2021 by SP

Invisible XML Grammar

{A test for what happens with comments in nonterminal attributes}
ixml: S, rule+.
rule: mark?, name, ["=:"], S, -alts, ".", S.
alts: alt++([";|"], S).
alt: term**(",", S).
-term: factor;
       repeat0;
       repeat1;
       option.
repeat0: factor, "*", S, sep?.
repeat1: factor, "+", S, sep?.
option:  factor, "?", S.
sep:     factor.

-factor: nonterminal;
         terminal;
         "(", S, alts, ")", S.
nonterminal: mark?, name.
-terminal: literal; charset.
-literal: quoted; encoded.
-charset: inclusion; exclusion.

quoted: tmark?, -string.
encoded: tmark?, @hex, S.
inclusion: tmark?, "[", S,  element++([";|"], S), "]", S.
exclusion: tmark?, "~", S, "[", S,  element++([";|"], S), "]", S.

@tmark: ["^-"], S.
-element: range;
          string;
          hex;
          class.
range: from, S, "-", S, to, S.
@from: character.
@to: character.
-character: -'"', dchar, -'"';
            -"'", schar, -"'";
            hex.
class: letter, letter, S. {One of the Unicode character classes}
-letter: ["a"-"z"; "A"-"Z"].
@name: letgit, xletter*, S.
-letgit: ["a" - "z" {AAA}; "A"-"Z"; "0"-"9"].
-xletter: letgit; "-".

@mark: ["@^-"], S.

string: -'"', dstring, -'"', S;
        -"'", sstring, -"'", S.
@dstring: dchar+.
@sstring: schar+.
dchar: ~['"'];
       '""'. {all characters, dquotes must be doubled}
schar: ~["'"];
       "''". {all characters, squotes must be doubled}
hex: "#", ["0"-"9"; "a"-"f"; "A"-"F"]+.

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

{the end}

Test case: ixml3

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

Input string (1508 characters)

{A test for what happens with comments in nonterminal attributes}
ixml: S, rule+.
rule: mark?, name, ["=:"], S, -alts, ".", S.
alts: alt+([";|"], S).
alt: term*(",", S).
-term: factor;
       repeat0;
       repeat1;
       option.
repeat0: factor, "*", S, sep?.
repeat1: factor, "+", S, sep?.
option:  factor, "?", S.
sep:     factor.

-factor: nonterminal;
         terminal;
         "(", S, alts, ")", S.
nonterminal: mark?, name.
-terminal: literal; charset.
-literal: quoted; encoded.
-charset: inclusion; exclusion.

quoted: tmark?, -string.
encoded: tmark?, @hex.
inclusion: tmark?, "[", S,  element+([";|"], S), "]", S.
exclusion: tmark?, "~", S, "[", S,  element+([";|"], S), "]", S.

@tmark: ["^-"], S.
-element: range;
          string;
          hex;
          class.
range: from, S, "-", S, to, S.
@from: character.
@to: character.
-character: -'"', dchar, -'"';
            -"'", schar, -"'";
            hex.
class: letter, letter, S. {One of the Unicode character classes}
-letter: ["a"-"z"; "A"-"Z"].
@name: letgit, xletter*, S.
-letgit: ["a" - "z" {AAA}; "A"-"Z"; "0"-"9"].
-xletter: letgit; "-".

@mark: ["@^-"], S.

string: -'"', dstring, -'"', S;
        -"'", sstring, -"'", S.
@dstring: dchar+.
@sstring: schar+.
dchar: ~['"'];
       '""'. {all characters, dquotes must be doubled}
schar: ~["'"];
       "''". {all characters, squotes must be doubled}
hex: "#", ["0"-"9"; "a"-"f"; "A"-"F"]+.

-S: (" "; #9 {comment}; comment)*.
^comment: "{", cchar*, "}".
-cchar: ~["}"].

{the end}

Expected result

<ixml>
   <comment>{A test for what happens with comments in nonterminal attributes}</comment>
   <rule name="ixml">: <alt>
         <nonterminal name="S"/>, <repeat1>
            <nonterminal name="rule"/>+</repeat1>
      </alt>.</rule>
   <rule name="rule">: <alt>
         <option>
            <nonterminal name="mark"/>?</option>, <nonterminal name="name"/>, <inclusion>[<string dstring="=:"/>]</inclusion>, <nonterminal name="S"/>, <nonterminal mark="-" name="alts"/>, <quoted dstring="."/>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule name="alts">: <alt>
         <repeat1>
            <nonterminal name="alt"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<string dstring=";|"/>]</inclusion>, <nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>
      </alt>.</rule>
   <rule name="alt">: <alt>
         <repeat0>
            <nonterminal name="term"/>*<sep>(<alts>
                  <alt>
                     <quoted dstring=","/>, <nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>
      </alt>.</rule>
   <rule mark="-" name="term">: <alt>
         <nonterminal name="factor"/>
      </alt>;       <alt>
         <nonterminal name="repeat0"/>
      </alt>;       <alt>
         <nonterminal name="repeat1"/>
      </alt>;       <alt>
         <nonterminal name="option"/>
      </alt>.</rule>
   <rule name="repeat0">: <alt>
         <nonterminal name="factor"/>, <quoted dstring="*"/>, <nonterminal name="S"/>, <option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="repeat1">: <alt>
         <nonterminal name="factor"/>, <quoted dstring="+"/>, <nonterminal name="S"/>, <option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="option">:  <alt>
         <nonterminal name="factor"/>, <quoted dstring="?"/>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule name="sep">:     <alt>
         <nonterminal name="factor"/>
      </alt>.</rule>
   <rule mark="-" name="factor">: <alt>
         <nonterminal name="nonterminal"/>
      </alt>;         <alt>
         <nonterminal name="terminal"/>
      </alt>;         <alt>
         <quoted dstring="("/>, <nonterminal name="S"/>, <nonterminal name="alts"/>, <quoted dstring=")"/>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule name="nonterminal">: <alt>
         <option>
            <nonterminal name="mark"/>?</option>, <nonterminal name="name"/>
      </alt>.</rule>
   <rule mark="-" name="terminal">: <alt>
         <nonterminal name="literal"/>
      </alt>; <alt>
         <nonterminal name="charset"/>
      </alt>.</rule>
   <rule mark="-" name="literal">: <alt>
         <nonterminal name="quoted"/>
      </alt>; <alt>
         <nonterminal name="encoded"/>
      </alt>.</rule>
   <rule mark="-" name="charset">: <alt>
         <nonterminal name="inclusion"/>
      </alt>; <alt>
         <nonterminal name="exclusion"/>
      </alt>.</rule>
   <rule name="quoted">: <alt>
         <option>
            <nonterminal name="tmark"/>?</option>, <nonterminal mark="-" name="string"/>
      </alt>.</rule>
   <rule name="encoded">: <alt>
         <option>
            <nonterminal name="tmark"/>?</option>, <nonterminal mark="@" name="hex"/>
      </alt>.</rule>
   <rule name="inclusion">: <alt>
         <option>
            <nonterminal name="tmark"/>?</option>, <quoted dstring="["/>, <nonterminal name="S"/>,  <repeat1>
            <nonterminal name="element"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<string dstring=";|"/>]</inclusion>, <nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>, <quoted dstring="]"/>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule name="exclusion">: <alt>
         <option>
            <nonterminal name="tmark"/>?</option>, <quoted dstring="~"/>, <nonterminal name="S"/>, <quoted dstring="["/>, <nonterminal name="S"/>,  <repeat1>
            <nonterminal name="element"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<string dstring=";|"/>]</inclusion>, <nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>, <quoted dstring="]"/>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="@" name="tmark">: <alt>
         <inclusion>[<string dstring="^-"/>]</inclusion>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="element">: <alt>
         <nonterminal name="range"/>
      </alt>;          <alt>
         <nonterminal name="string"/>
      </alt>;          <alt>
         <nonterminal name="hex"/>
      </alt>;          <alt>
         <nonterminal name="class"/>
      </alt>.</rule>
   <rule name="range">: <alt>
         <nonterminal name="from"/>, <nonterminal name="S"/>, <quoted dstring="-"/>, <nonterminal name="S"/>, <nonterminal name="to"/>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="@" name="from">: <alt>
         <nonterminal name="character"/>
      </alt>.</rule>
   <rule mark="@" name="to">: <alt>
         <nonterminal name="character"/>
      </alt>.</rule>
   <rule mark="-" name="character">: <alt>
         <quoted tmark="-" sstring="&#34;"/>, <nonterminal name="dchar"/>, <quoted tmark="-" sstring="&#34;"/>
      </alt>;            <alt>
         <quoted tmark="-" dstring="'"/>, <nonterminal name="schar"/>, <quoted tmark="-" dstring="'"/>
      </alt>;            <alt>
         <nonterminal name="hex"/>
      </alt>.</rule>
   <rule name="class">: <alt>
         <nonterminal name="letter"/>, <nonterminal name="letter"/>, <nonterminal name="S"/>
      </alt>. <comment>{One of the Unicode character classes}</comment>
   </rule>
   <rule mark="-" name="letter">: <alt>
         <inclusion>[<range from="a" to="z">-</range>; <range from="A" to="Z">-</range>]</inclusion>
      </alt>.</rule>
   <rule mark="@" name="name">: <alt>
         <nonterminal name="letgit"/>, <repeat0>
            <nonterminal name="xletter"/>*</repeat0>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="letgit">: <alt>
         <inclusion>[<range from="a" to="z"> -  <comment>{AAA}</comment>
            </range>; <range from="A" to="Z">-</range>; <range from="0" to="9">-</range>]</inclusion>
      </alt>.</rule>
   <rule mark="-" name="xletter">: <alt>
         <nonterminal name="letgit"/>
      </alt>; <alt>
         <quoted dstring="-"/>
      </alt>.</rule>
   <rule mark="@" name="mark">: <alt>
         <inclusion>[<string dstring="@^-"/>]</inclusion>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule name="string">: <alt>
         <quoted tmark="-" sstring="&#34;"/>, <nonterminal name="dstring"/>, <quoted tmark="-" sstring="&#34;"/>, <nonterminal name="S"/>
      </alt>;        <alt>
         <quoted tmark="-" dstring="'"/>, <nonterminal name="sstring"/>, <quoted tmark="-" dstring="'"/>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="@" name="dstring">: <alt>
         <repeat1>
            <nonterminal name="dchar"/>+</repeat1>
      </alt>.</rule>
   <rule mark="@" name="sstring">: <alt>
         <repeat1>
            <nonterminal name="schar"/>+</repeat1>
      </alt>.</rule>
   <rule name="dchar">: <alt>
         <exclusion>~[<string sstring="&#34;"/>]</exclusion>
      </alt>;       <alt>
         <quoted sstring="&#34;&#34;"/>
      </alt>. <comment>{all characters, dquotes must be doubled}</comment>
   </rule>
   <rule name="schar">: <alt>
         <exclusion>~[<string dstring="'"/>]</exclusion>
      </alt>;       <alt>
         <quoted dstring="''"/>
      </alt>. <comment>{all characters, squotes must be doubled}</comment>
   </rule>
   <rule name="hex">: <alt>
         <quoted dstring="#"/>, <repeat1>
            <inclusion>[<range from="0" to="9">-</range>; <range from="a" to="f">-</range>; <range from="A" to="F">-</range>]</inclusion>+</repeat1>
      </alt>.</rule>
   <rule mark="-" name="S">: <alt>
         <repeat0>(<alts>
               <alt>
                  <quoted dstring=" "/>
               </alt>; <alt>
                  <encoded hex="#9">
                     <comment>{comment}</comment>
                  </encoded>
               </alt>; <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule mark="^" name="comment">: <alt>
         <quoted dstring="{"/>, <repeat0>
            <nonterminal name="cchar"/>*</repeat0>, <quoted dstring="}"/>
      </alt>.</rule>
   <rule mark="-" name="cchar">: <alt>
         <exclusion>~[<string dstring="}"/>]</exclusion>
      </alt>.<comment>{the end}</comment>
   </rule>
</ixml>