Invisible XML Test Suite Report

CoffeeFilter version:
1.1.0
CoffeeGrinder version:
1.1.0
Date:
2022-04-16T16:33:45.794

Tests: 252. Passing: 250. Skipped: 2.

Table of contents
file:/home/circleci/project/ixml/tests/test-catalog.xml

Amsterdam Test Suite 1, 2021-12-16

Top-level catalog for tests provided by Steven Pemberton in December 2021.

There are two sub-groups, one general and one focused on syntax issues.

file:/home/circleci/project/ixml/tests/syntax/catalog-as-grammar-tests.xml

Amsterdam Test Suite 1 - Syntax tests, 2021-12-16

Syntax tests provided by Steven Pemberton in December 2021.

All tests are negative (the file.ixml files do not conform to the grammar for ixml).

Since these are all parsed against the grammar for ixml grammars, the expected result could be given as 'assert-not-a-grammar' as well as 'assert-not-a-sentence'. The inputs are not sentences in the language defined by the grammar for grammars, which means they are not ixml grammars.

Three catalogs are provided, using different formulations. This one describes all the tests as grammar tests and relies on the ixml grammar built into the processor.

class-range.ixml

Input grammar
a: class-range.
class-range: [L-N].
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="74"
        documentParse="3">
</result>
Grammar parse: 74. Document parse: 3.

Result: PASS

defn1.ixml

Input grammar
a: b, c.
b: c, d.
c: @".". {Not allowed for terminals}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="7"
        documentParse="2">
</result>
Grammar parse: 7. Document parse: 2.

Result: PASS

defn10.ixml

Input grammar
a: b, c.
b: c, d.
c: -(a, b, c). {No marker allowed}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="5"
        documentParse="1">
</result>
Grammar parse: 5. Document parse: 1.

Result: PASS

defn11.ixml

Input grammar
a: b, c.
b: c, d.
c: ^(a, b, c). {No marker allowed}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="8">
</result>
Grammar parse: 4. Document parse: 8.

Result: PASS

defn2.ixml

Input grammar
a: b, c.
b: c, d.
c: @'.'. {Not allowed for terminals}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

defn3.ixml

Input grammar
a: b, c.
b: c, d.
c: 'unterminated. {unterminated string}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="4">
</result>
Grammar parse: 3. Document parse: 4.

Result: PASS

defn4.ixml

Input grammar
a: b, c.
b: c, d.
c: "unterminated. {unterminated string}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="4">
</result>
Grammar parse: 3. Document parse: 4.

Result: PASS

defn5.ixml

Input grammar
a: b, c.
b: c, d.
c: @#9. {no @ for terminals}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

defn6.ixml

Input grammar
a: b, c.
b: c, d.
c: @~["abc"]. {No @ allowed}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

defn8.ixml

Input grammar
a: b, c.
b: c, d.
c: @["abc"]. {No @ allowed}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

defn9.ixml

Input grammar
a: b, c.
b: c, d.
c: @(a, b, c). {No @ allowed}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

elem1

Input grammar
a: "a", b, c.
b: "b", c, d.
c: "c", []. {it should block here, since nothing matches}
d: "d".
Test elem1
Input text
abcd
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="0">
</result>
Grammar parse: 4.

Result: PASS

elem2.ixml

Input grammar
a: b, c.
b: c, d.
c: [1]. {illegal}
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

elem3.ixml

Input grammar
a: b, c.
b: c, d.
c: ["a"-""]. {Must be length 1} 
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

elem4.ixml

Input grammar
a: b, c.
b: c, d.
c: ["a"-"dd"]. {Must be length 1} 
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

elem5.ixml

Input grammar
a: b, c.
b: c, d.
c: [""-"d"]. {Must be length 1} 
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

elem6.ixml

Input grammar
a: b, c.
b: c, d.
c: ["aa"-"d"]. {Must be length 1} 
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

elem7.ixml

Input grammar
a: b, c.
b: c, d.
c: ["a".."d"]. {Not ..} 
d: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="4">
</result>
Grammar parse: 2. Document parse: 4.

Result: PASS

empty-string.ixml

Input grammar
a: b, c, d.
b: "b".
c: "" {not allowed}.
d: "d".
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

expr10.ixml

Input grammar
expr: factor+("*"; "/").
term: 
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

hex2.ixml

Input grammar
hex: "a", #, "b".
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

illegal-class.ixml

Input grammar
a: class.
class: [Xx]. {Non-existent class}
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

name-with-spaces.ixml

Input grammar
a b: b c. {No spaces in names}
b: .
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

rule.ixml

Input grammar
a: b, c. 
b . {missing colon}
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="0">
</result>
Grammar parse: 3.

Result: PASS

rule1.ixml

Input grammar
a: b, c. 
b: b. c. {extra .}
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

rule10.ixml

Input grammar
a: "(" num ")". {missing commas}
num: "1".
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

rule2.ixml

Input grammar
a: b, c. 
a: b, c. {double defined}

Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

rule3.ixml

Input grammar
a: b, c. 
b: b, c, . {spurious comma}
c: ".".
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

rule4.ixml

Input grammar
a: b, c. 
b: b, c . 
c: ".") {Rule ends wrong}
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

rule5.ixml

Input grammar
a: b, c. 
$b: b, c. {illegal name} 
c: ".".
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

rule6.ixml

Input grammar
a: b, c. 
b:: b, c. {double colon} 
c: ".".
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

rule7.ixml

Input grammar
a: b, c. 
^^b: b, c. {double marker} 
c: ".".
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="3">
</result>
Grammar parse: 2. Document parse: 3.

Result: PASS

rule8.ixml

Input grammar
a: "", ""
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

rule9.ixml

Input grammar
a: 1, b, c. {illegal terminal}
b: .
c: .

Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

unterminated-comment.ixml

Input grammar
a: b. {This is an unterminated comment
b: c.
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="3">
</result>
Grammar parse: 2. Document parse: 3.

Result: PASS

unterminated-comment1.ixml

Input grammar
a: b. {This is an unterminated comment
{with a nested comment}
b: c.
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

unterminated-comment2.ixml

Input grammar
a: b. {This is an unterminated comment

b: c.
{with a nested unterminated comment
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="3">
</result>
Grammar parse: 2. Document parse: 3.

Result: PASS

unused-rule

Input grammar
a: b.
b: c.
c: .
unused: 'x'.
Test unused-rule

Input text

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml>
      <a xmlns="">
         <b>
            <c/>
         </b>
      </a>
   </assert-xml>
</result>
<a>
   <b>
      <c/>
   </b>
</a>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <a>
               <b>
                  <c/>
               </b>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a>
               <b>
                  <c/>
               </b>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<a>
   <b>
      <c/>
   </b>
</a>

unused-rules

Input grammar
a: b.
b: c.
c:.
unused1: e.
e: f.
unused2: .
f: .
Test unused-rules

Input text

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml>
      <a xmlns="">
         <b>
            <c/>
         </b>
      </a>
   </assert-xml>
</result>
<a>
   <b>
      <c/>
   </b>
</a>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <a>
               <b>
                  <c/>
               </b>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a>
               <b>
                  <c/>
               </b>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

Actual:
<a>
   <b>
      <c/>
   </b>
</a>

undefined-symbol

Input grammar
a: b, undefined.
b: c.
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

undefined-symbols

Input grammar
a: b, undefined.
b: c.
c: .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

file:/home/circleci/project/ixml/tests/syntax/catalog-as-instance-tests-ixml.xml

Amsterdam Test Suite 1 - Syntax tests, 2021-12-16

Syntax tests provided by Steven Pemberton in December 2021.

All tests are negative (the file.ixml files do not conform to the grammar for ixml).

Since these are all parsed against the grammar for ixml grammars, the expected result could be given as 'assert-not-a-grammar' as well as 'assert-not-a-sentence'. The inputs are not sentences in the language defined by the grammar for grammars, which means they are not ixml grammars.

Three catalogs are provided, using different formulations. This one uses the ixml form of the ixml grammar and describes all the tests as instance tests.

syntax-ixml

Input grammar
{ From the 2022-01-25 draft specification }

         ixml: s, rule+s, s.

           -s: (whitespace; comment)*.
  -whitespace: -[Zs]; tab; lf; cr.
         -tab: -#9.
          -lf: -#a.
          -cr: -#d.
      comment: -"{", (cchar; comment)*, -"}".
       -cchar: ~["{}"].

         rule: (mark, s)?, name, s, -["=:"], s, -alts, -".".
        @mark: ["@^-"].
         alts: alt+(-[";|"], s).
          alt: term*(-",", s).
        -term: factor;
               option;
               repeat0;
               repeat1.
      -factor: terminal;
               nonterminal;
               -"(", s, alts, -")", s.
      repeat0: factor, -"*", s, sep?.
      repeat1: factor, -"+", s, sep?.
       option: factor, -"?", s.
          sep: factor.
  nonterminal: (mark, s)?, name, s.

    -terminal: literal; 
               charset.
      literal: quoted;
               encoded.
      -quoted: (tmark, s)?, string.

        @name: namestart, namefollower*.
   -namestart: ["_"; L].
-namefollower: namestart; ["-.·‿⁀"; Nd; Mn].

       @tmark: ["^-"].
      @string: -'"', dchar+, -'"', s;
               -"'", schar+, -"'", s.
        dchar: ~['"'; #a; #d];
               '"', -'"'. {all characters except line breaks; quotes must be doubled}
        schar: ~["'"; #a; #d];
               "'", -"'". {all characters except line breaks; quotes must be doubled}
     -encoded: (tmark, s)?, -"#", @hex, s.
          hex: ["0"-"9"; "a"-"f"; "A"-"F"]+.

     -charset: inclusion; 
               exclusion.
    inclusion: (tmark, s)?,          set.
    exclusion: (tmark, s)?, -"~", s, set.
         -set: -"[", s,  member*(-[";|"], s), -"]", s.
      -member: literal;
               range;
               class.
        range: from, s, -"-", s, to, s.
        @from: character.
          @to: character.
   -character: -'"', dchar, -'"';
               -"'", schar, -"'";
               "#", hex.
        class: code, s.
        @code: capital, letter?.
     -capital: ["A"-"Z"].
      -letter: ["a"-"z"].
Test class-range
Input text
a: class-range.
class-range: [L-N].
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test defn1
Input text
a: b, c.
b: c, d.
c: @".". {Not allowed for terminals}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="6">
</result>
Grammar parse: 4. Document parse: 6.

Result: PASS

Test defn2
Input text
a: b, c.
b: c, d.
c: @'.'. {Not allowed for terminals}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="7">
</result>
Grammar parse: 4. Document parse: 7.

Result: PASS

Test defn3
Input text
a: b, c.
b: c, d.
c: 'unterminated. {unterminated string}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test defn4
Input text
a: b, c.
b: c, d.
c: "unterminated. {unterminated string}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="3">
</result>
Grammar parse: 3. Document parse: 3.

Result: PASS

Test defn5
Input text
a: b, c.
b: c, d.
c: @#9. {no @ for terminals}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="3">
</result>
Grammar parse: 3. Document parse: 3.

Result: PASS

Test defn6
Input text
a: b, c.
b: c, d.
c: @~["abc"]. {No @ allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test defn8
Input text
a: b, c.
b: c, d.
c: @["abc"]. {No @ allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test defn9
Input text
a: b, c.
b: c, d.
c: @(a, b, c). {No @ allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test defn10
Input text
a: b, c.
b: c, d.
c: -(a, b, c). {No marker allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test defn11
Input text
a: b, c.
b: c, d.
c: ^(a, b, c). {No marker allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test elem2
Input text
a: b, c.
b: c, d.
c: [1]. {illegal}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test elem3
Input text
a: b, c.
b: c, d.
c: ["a"-""]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test elem4
Input text
a: b, c.
b: c, d.
c: ["a"-"dd"]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test elem5
Input text
a: b, c.
b: c, d.
c: [""-"d"]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test elem6
Input text
a: b, c.
b: c, d.
c: ["aa"-"d"]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="0">
</result>
Grammar parse: 3.

Result: PASS

Test elem7
Input text
a: b, c.
b: c, d.
c: ["a".."d"]. {Not ..} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="11"
        documentParse="0">
</result>
Grammar parse: 11.

Result: PASS

Test empty-string
Input text
a: b, c, d.
b: "b".
c: "" {not allowed}.
d: "d".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test expr10
Input text
expr: factor+("*"; "/").
term: 
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="3">
</result>
Grammar parse: 3. Document parse: 3.

Result: PASS

Test hex2
Input text
hex: "a", #, "b".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test name-with-spaces
Input text
a b: b c. {No spaces in names}
b: .
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="3">
</result>
Grammar parse: 4. Document parse: 3.

Result: PASS

Test rule
Input text
a: b, c. 
b . {missing colon}
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
</result>
Grammar parse: 1.

Result: PASS

Test rule1
Input text
a: b, c. 
b: b. c. {extra .}
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
</result>
Grammar parse: 1.

Result: PASS

Test rule3
Input text
a: b, c. 
b: b, c, . {spurious comma}
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
</result>
Grammar parse: 1.

Result: PASS

Test rule4
Input text
a: b, c. 
b: b, c . 
c: ".") {Rule ends wrong}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="1">
</result>
Grammar parse: 1. Document parse: 1.

Result: PASS

Test rule5
Input text
a: b, c. 
$b: b, c. {illegal name} 
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test rule6
Input text
a: b, c. 
b:: b, c. {double colon} 
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test rule7
Input text
a: b, c. 
^^b: b, c. {double marker} 
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test rule8
Input text
a: "", ""
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test rule9
Input text
a: 1, b, c. {illegal terminal}
b: .
c: .

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="4">
</result>
Grammar parse: 1. Document parse: 4.

Result: PASS

Test rule10
Input text
a: "(" num ")". {missing commas}
num: "1".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

Test unterminated-comment
Input text
a: b. {This is an unterminated comment
b: c.
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="1">
</result>
Grammar parse: 1. Document parse: 1.

Result: PASS

Test unterminated-comment1
Input text
a: b. {This is an unterminated comment
{with a nested comment}
b: c.
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test unterminated-comment2
Input text
a: b. {This is an unterminated comment

b: c.
{with a nested unterminated comment
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="3">
</result>
Grammar parse: 1. Document parse: 3.

Result: PASS

file:/home/circleci/project/ixml/tests/syntax/catalog-as-instance-tests-xml.xml

Amsterdam Test Suite 1 - Syntax tests, 2021-12-16

Syntax tests provided by Steven Pemberton in December 2021.

All tests are negative (the file.ixml files do not conform to the grammar for ixml).

Since these are all parsed against the grammar for ixml grammars, the expected result could be given as 'assert-not-a-grammar' as well as 'assert-not-a-sentence'. The inputs are not sentences in the language defined by the grammar for grammars, which means they are not ixml grammars.

Three catalogs are provided, using different formulations. This one uses the XML form of the ixml grammar and describes all the tests as instance tests.

syntax-xml

Input grammar
<ixml>
   <rule name='ixml'>
      <alt>
         <nonterminal name='s'/>
         <repeat1>
            <nonterminal name='rule'/>
            <sep>
               <nonterminal name='s'/>
            </sep>
         </repeat1>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule mark='-' name='s'>
      <alt>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name='whitespace'/>
               </alt>
               <alt>
                  <nonterminal name='comment'/>
               </alt>
            </alts>
         </repeat0>
      </alt>
   </rule>
   <rule mark='-' name='whitespace'>
      <alt>
         <inclusion tmark='-'>
            <class code='Zs'/>
         </inclusion>
      </alt>
      <alt>
         <nonterminal name='tab'/>
      </alt>
      <alt>
         <nonterminal name='lf'/>
      </alt>
      <alt>
         <nonterminal name='cr'/>
      </alt>
   </rule>
   <rule mark='-' name='tab'>
      <alt>
         <literal tmark='-' hex='9'/>
      </alt>
   </rule>
   <rule mark='-' name='lf'>
      <alt>
         <literal tmark='-' hex='a'/>
      </alt>
   </rule>
   <rule mark='-' name='cr'>
      <alt>
         <literal tmark='-' hex='d'/>
      </alt>
   </rule>
   <rule name='comment'>
      <alt>
         <literal tmark='-' string='{'/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name='cchar'/>
               </alt>
               <alt>
                  <nonterminal name='comment'/>
               </alt>
            </alts>
         </repeat0>
         <literal tmark='-' string='}'/>
      </alt>
   </rule>
   <rule mark='-' name='cchar'>
      <alt>
         <exclusion>
            <literal string='{}'/>
         </exclusion>
      </alt>
   </rule>
   <rule name='rule'>
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name='mark'/>
                  <nonterminal name='s'/>
               </alt>
            </alts>
         </option>
         <nonterminal name='name'/>
         <nonterminal name='s'/>
         <inclusion tmark='-'>
            <literal string='=:'/>
         </inclusion>
         <nonterminal name='s'/>
         <nonterminal mark='-' name='alts'/>
         <literal tmark='-' string='.'/>
      </alt>
   </rule>
   <rule mark='@' name='mark'>
      <alt>
         <inclusion>
            <literal string='@^-'/>
         </inclusion>
      </alt>
   </rule>
   <rule name='alts'>
      <alt>
         <repeat1>
            <nonterminal name='alt'/>
            <sep>
               <alts>
                  <alt>
                     <inclusion tmark='-'>
                        <literal string=';|'/>
                     </inclusion>
                     <nonterminal name='s'/>
                  </alt>
               </alts>
            </sep>
         </repeat1>
      </alt>
   </rule>
   <rule name='alt'>
      <alt>
         <repeat0>
            <nonterminal name='term'/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark='-' string=','/>
                     <nonterminal name='s'/>
                  </alt>
               </alts>
            </sep>
         </repeat0>
      </alt>
   </rule>
   <rule mark='-' name='term'>
      <alt>
         <nonterminal name='factor'/>
      </alt>
      <alt>
         <nonterminal name='option'/>
      </alt>
      <alt>
         <nonterminal name='repeat0'/>
      </alt>
      <alt>
         <nonterminal name='repeat1'/>
      </alt>
   </rule>
   <rule mark='-' name='factor'>
      <alt>
         <nonterminal name='terminal'/>
      </alt>
      <alt>
         <nonterminal name='nonterminal'/>
      </alt>
      <alt>
         <literal tmark='-' string='('/>
         <nonterminal name='s'/>
         <nonterminal name='alts'/>
         <literal tmark='-' string=')'/>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule name='repeat0'>
      <alt>
         <nonterminal name='factor'/>
         <literal tmark='-' string='*'/>
         <nonterminal name='s'/>
         <option>
            <nonterminal name='sep'/>
         </option>
      </alt>
   </rule>
   <rule name='repeat1'>
      <alt>
         <nonterminal name='factor'/>
         <literal tmark='-' string='+'/>
         <nonterminal name='s'/>
         <option>
            <nonterminal name='sep'/>
         </option>
      </alt>
   </rule>
   <rule name='option'>
      <alt>
         <nonterminal name='factor'/>
         <literal tmark='-' string='?'/>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule name='sep'>
      <alt>
         <nonterminal name='factor'/>
      </alt>
   </rule>
   <rule name='nonterminal'>
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name='mark'/>
                  <nonterminal name='s'/>
               </alt>
            </alts>
         </option>
         <nonterminal name='name'/>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule mark='-' name='terminal'>
      <alt>
         <nonterminal name='literal'/>
      </alt>
      <alt>
         <nonterminal name='charset'/>
      </alt>
   </rule>
   <rule name='literal'>
      <alt>
         <nonterminal name='quoted'/>
      </alt>
      <alt>
         <nonterminal name='encoded'/>
      </alt>
   </rule>
   <rule mark='-' name='quoted'>
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name='tmark'/>
                  <nonterminal name='s'/>
               </alt>
            </alts>
         </option>
         <nonterminal name='string'/>
      </alt>
   </rule>
   <rule mark='@' name='name'>
      <alt>
         <nonterminal name='namestart'/>
         <repeat0>
            <nonterminal name='namefollower'/>
         </repeat0>
      </alt>
   </rule>
   <rule mark='-' name='namestart'>
      <alt>
         <inclusion>
            <literal string='_'/>
            <class code='L'/>
         </inclusion>
      </alt>
   </rule>
   <rule mark='-' name='namefollower'>
      <alt>
         <nonterminal name='namestart'/>
      </alt>
      <alt>
         <inclusion>
            <literal string='-.·‿⁀'/>
            <class code='Nd'/>
            <class code='Mn'/>
         </inclusion>
      </alt>
   </rule>
   <rule mark='@' name='tmark'>
      <alt>
         <inclusion>
            <literal string='^-'/>
         </inclusion>
      </alt>
   </rule>
   <rule mark='@' name='string'>
      <alt>
         <literal tmark='-' string='"'/>
         <repeat1>
            <nonterminal name='dchar'/>
         </repeat1>
         <literal tmark='-' string='"'/>
         <nonterminal name='s'/>
      </alt>
      <alt>
         <literal tmark='-' string='&apos;'/>
         <repeat1>
            <nonterminal name='schar'/>
         </repeat1>
         <literal tmark='-' string='&apos;'/>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule name='dchar'>
      <alt>
         <exclusion>
            <literal string='"'/>
            <literal hex='a'/>
            <literal hex='d'/>
         </exclusion>
      </alt>
      <alt>
         <literal string='"'/>
         <literal tmark='-' string='"'/>
      </alt>
   </rule>
   <comment>all characters except line breaks; quotes must be doubled</comment>
   <rule name='schar'>
      <alt>
         <exclusion>
            <literal string='&apos;'/>
            <literal hex='a'/>
            <literal hex='d'/>
         </exclusion>
      </alt>
      <alt>
         <literal string='&apos;'/>
         <literal tmark='-' string='&apos;'/>
      </alt>
   </rule>
   <comment>all characters except line breaks; quotes must be doubled</comment>
   <rule mark='-' name='encoded'>
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name='tmark'/>
                  <nonterminal name='s'/>
               </alt>
            </alts>
         </option>
         <literal tmark='-' string='#'/>
         <nonterminal mark='@' name='hex'/>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule name='hex'>
      <alt>
         <repeat1>
            <inclusion>
               <range from='0' to='9'/>
               <range from='a' to='f'/>
               <range from='A' to='F'/>
            </inclusion>
         </repeat1>
      </alt>
   </rule>
   <rule mark='-' name='charset'>
      <alt>
         <nonterminal name='inclusion'/>
      </alt>
      <alt>
         <nonterminal name='exclusion'/>
      </alt>
   </rule>
   <rule name='inclusion'>
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name='tmark'/>
                  <nonterminal name='s'/>
               </alt>
            </alts>
         </option>
         <nonterminal name='set'/>
      </alt>
   </rule>
   <rule name='exclusion'>
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name='tmark'/>
                  <nonterminal name='s'/>
               </alt>
            </alts>
         </option>
         <literal tmark='-' string='~'/>
         <nonterminal name='s'/>
         <nonterminal name='set'/>
      </alt>
   </rule>
   <rule mark='-' name='set'>
      <alt>
         <literal tmark='-' string='['/>
         <nonterminal name='s'/>
         <repeat0>
            <nonterminal name='member'/>
            <sep>
               <alts>
                  <alt>
                     <inclusion tmark='-'>
                        <literal string=';|'/>
                     </inclusion>
                     <nonterminal name='s'/>
                  </alt>
               </alts>
            </sep>
         </repeat0>
         <literal tmark='-' string=']'/>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule mark='-' name='member'>
      <alt>
         <nonterminal name='literal'/>
      </alt>
      <alt>
         <nonterminal name='range'/>
      </alt>
      <alt>
         <nonterminal name='class'/>
      </alt>
   </rule>
   <rule name='range'>
      <alt>
         <nonterminal name='from'/>
         <nonterminal name='s'/>
         <literal tmark='-' string='-'/>
         <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>
         <literal tmark='-' string='"'/>
         <nonterminal name='dchar'/>
         <literal tmark='-' string='"'/>
      </alt>
      <alt>
         <literal tmark='-' string='&apos;'/>
         <nonterminal name='schar'/>
         <literal tmark='-' string='&apos;'/>
      </alt>
      <alt>
         <literal string='#'/>
         <nonterminal name='hex'/>
      </alt>
   </rule>
   <rule name='class'>
      <alt>
         <nonterminal name='code'/>
         <nonterminal name='s'/>
      </alt>
   </rule>
   <rule mark='@' name='code'>
      <alt>
         <nonterminal name='capital'/>
         <option>
            <nonterminal name='letter'/>
         </option>
      </alt>
   </rule>
   <rule mark='-' name='capital'>
      <alt>
         <inclusion>
            <range from='A' to='Z'/>
         </inclusion>
      </alt>
   </rule>
   <rule mark='-' name='letter'>
      <alt>
         <inclusion>
            <range from='a' to='z'/>
         </inclusion>
      </alt>
   </rule>
</ixml>
Test class-range
Input text
a: class-range.
class-range: [L-N].
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="7">
</result>
Grammar parse: 3. Document parse: 7.

Result: PASS

Test defn1
Input text
a: b, c.
b: c, d.
c: @".". {Not allowed for terminals}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="2">
</result>
Grammar parse: 4. Document parse: 2.

Result: PASS

Test defn2
Input text
a: b, c.
b: c, d.
c: @'.'. {Not allowed for terminals}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test defn3
Input text
a: b, c.
b: c, d.
c: 'unterminated. {unterminated string}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="6">
</result>
Grammar parse: 3. Document parse: 6.

Result: PASS

Test defn4
Input text
a: b, c.
b: c, d.
c: "unterminated. {unterminated string}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test defn5
Input text
a: b, c.
b: c, d.
c: @#9. {no @ for terminals}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test defn6
Input text
a: b, c.
b: c, d.
c: @~["abc"]. {No @ allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test defn8
Input text
a: b, c.
b: c, d.
c: @["abc"]. {No @ allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test defn9
Input text
a: b, c.
b: c, d.
c: @(a, b, c). {No @ allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test defn10
Input text
a: b, c.
b: c, d.
c: -(a, b, c). {No marker allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="1">
</result>
Grammar parse: 1. Document parse: 1.

Result: PASS

Test defn11
Input text
a: b, c.
b: c, d.
c: ^(a, b, c). {No marker allowed}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test elem2
Input text
a: b, c.
b: c, d.
c: [1]. {illegal}
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test elem3
Input text
a: b, c.
b: c, d.
c: ["a"-""]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="3">
</result>
Grammar parse: 3. Document parse: 3.

Result: PASS

Test elem4
Input text
a: b, c.
b: c, d.
c: ["a"-"dd"]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Test elem5
Input text
a: b, c.
b: c, d.
c: [""-"d"]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

Test elem6
Input text
a: b, c.
b: c, d.
c: ["aa"-"d"]. {Must be length 1} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test elem7
Input text
a: b, c.
b: c, d.
c: ["a".."d"]. {Not ..} 
d: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test empty-string
Input text
a: b, c, d.
b: "b".
c: "" {not allowed}.
d: "d".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test expr10
Input text
expr: factor+("*"; "/").
term: 
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="1">
</result>
Grammar parse: 1. Document parse: 1.

Result: PASS

Test hex2
Input text
hex: "a", #, "b".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="1">
</result>
Grammar parse: 1. Document parse: 1.

Result: PASS

Test name-with-spaces
Input text
a b: b c. {No spaces in names}
b: .
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test rule
Input text
a: b, c. 
b . {missing colon}
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

Test rule1
Input text
a: b, c. 
b: b. c. {extra .}
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

Test rule3
Input text
a: b, c. 
b: b, c, . {spurious comma}
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

Test rule4
Input text
a: b, c. 
b: b, c . 
c: ".") {Rule ends wrong}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

Test rule5
Input text
a: b, c. 
$b: b, c. {illegal name} 
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test rule6
Input text
a: b, c. 
b:: b, c. {double colon} 
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="2">
</result>
Grammar parse: 2. Document parse: 2.

Result: PASS

Test rule7
Input text
a: b, c. 
^^b: b, c. {double marker} 
c: ".".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test rule8
Input text
a: "", ""
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Test rule9
Input text
a: 1, b, c. {illegal terminal}
b: .
c: .

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="3">
</result>
Grammar parse: 2. Document parse: 3.

Result: PASS

Test rule10
Input text
a: "(" num ")". {missing commas}
num: "1".
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="4">
</result>
Grammar parse: 3. Document parse: 4.

Result: PASS

Test unterminated-comment
Input text
a: b. {This is an unterminated comment
b: c.
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="7">
</result>
Grammar parse: 3. Document parse: 7.

Result: PASS

Test unterminated-comment1
Input text
a: b. {This is an unterminated comment
{with a nested comment}
b: c.
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="0">
</result>
Grammar parse: 3.

Result: PASS

Test unterminated-comment2
Input text
a: b. {This is an unterminated comment

b: c.
{with a nested unterminated comment
c: .
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

file:/home/circleci/project/ixml/tests/syntax/catalog-of-correct-tests.xml

Syntax tests, 2022-03-26

Syntax tests for grammar features. These tests all make assertions about grammars that are syntactically correct.

comment

This test was written to test comments, but it tests ixml and rule too.

Input grammar
{ a comment }
S: { another comment } 'a' { and another } .
{ a final comment }
Grammar test

rulemark

Input grammar
^S: A .
@A: B .
-B: 'a' .

Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="rulemark.output.xml"/>
</result>
<ixml>
   <rule mark="^" name="S">
      <alt>
         <nonterminal name="A"/>
      </alt>
   </rule>
   <rule mark="@" name="A">
      <alt>
         <nonterminal name="B"/>
      </alt>
   </rule>
   <rule mark="-" name="B">
      <alt>
         <literal string="a"/>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule mark="^" name="S">
                  <alt>
                     <nonterminal name="A"/>
                  </alt>
               </rule>
               <rule mark="@" name="A">
                  <alt>
                     <nonterminal name="B"/>
                  </alt>
               </rule>
               <rule mark="-" name="B">
                  <alt>
                     <literal string="a"/>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule mark="^" name="S">
                  <alt>
                     <nonterminal name="A"/>
                  </alt>
               </rule>
               <rule mark="@" name="A">
                  <alt>
                     <nonterminal name="B"/>
                  </alt>
               </rule>
               <rule mark="-" name="B">
                  <alt>
                     <literal string="a"/>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Actual:
<ixml>
   <rule mark="^" name="S">
      <alt>
         <nonterminal name="A"/>
      </alt>
   </rule>
   <rule mark="@" name="A">
      <alt>
         <nonterminal name="B"/>
      </alt>
   </rule>
   <rule mark="-" name="B">
      <alt>
         <literal string="a"/>
      </alt>
   </rule>
</ixml>

alts

Input grammar
S: ('a'; 'b'; 'c').

Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="alts.output.xml"/>
</result>
<ixml>
   <rule name="S">
      <alt>
         <alts>
            <alt>
               <literal string="a"/>
            </alt>
            <alt>
               <literal string="b"/>
            </alt>
            <alt>
               <literal string="c"/>
            </alt>
         </alts>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <alts>
                        <alt>
                           <literal string="a"/>
                        </alt>
                        <alt>
                           <literal string="b"/>
                        </alt>
                        <alt>
                           <literal string="c"/>
                        </alt>
                     </alts>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <alts>
                        <alt>
                           <literal string="a"/>
                        </alt>
                        <alt>
                           <literal string="b"/>
                        </alt>
                        <alt>
                           <literal string="c"/>
                        </alt>
                     </alts>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <alts>
            <alt>
               <literal string="a"/>
            </alt>
            <alt>
               <literal string="b"/>
            </alt>
            <alt>
               <literal string="c"/>
            </alt>
         </alts>
      </alt>
   </rule>
</ixml>

repeat0

Input grammar
S: 'a'**' '.
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="repeat0.output.xml"/>
</result>
<ixml>
   <rule name="S">
      <alt>
         <repeat0>
            <literal string="a"/>
            <sep>
               <literal string=" "/>
            </sep>
         </repeat0>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <repeat0>
                        <literal string="a"/>
                        <sep>
                           <literal string=" "/>
                        </sep>
                     </repeat0>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <repeat0>
                        <literal string="a"/>
                        <sep>
                           <literal string=" "/>
                        </sep>
                     </repeat0>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <repeat0>
            <literal string="a"/>
            <sep>
               <literal string=" "/>
            </sep>
         </repeat0>
      </alt>
   </rule>
</ixml>

repeat1

Input grammar
S: 'a'++' '.
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="repeat1.output.xml"/>
</result>
<ixml>
   <rule name="S">
      <alt>
         <repeat1>
            <literal string="a"/>
            <sep>
               <literal string=" "/>
            </sep>
         </repeat1>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <repeat1>
                        <literal string="a"/>
                        <sep>
                           <literal string=" "/>
                        </sep>
                     </repeat1>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <repeat1>
                        <literal string="a"/>
                        <sep>
                           <literal string=" "/>
                        </sep>
                     </repeat1>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <repeat1>
            <literal string="a"/>
            <sep>
               <literal string=" "/>
            </sep>
         </repeat1>
      </alt>
   </rule>
</ixml>

option

Input grammar
S: 'a'? .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="option.output.xml"/>
</result>
<ixml>
   <rule name="S">
      <alt>
         <option>
            <literal string="a"/>
         </option>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <option>
                        <literal string="a"/>
                     </option>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <option>
                        <literal string="a"/>
                     </option>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <option>
            <literal string="a"/>
         </option>
      </alt>
   </rule>
</ixml>

literal

Input grammar
S: "double"; 'single'; #41 .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="literal.output.xml"/>
</result>
<ixml>
   <rule name="S">
      <alt>
         <literal string="double"/>
      </alt>
      <alt>
         <literal string="single"/>
      </alt>
      <alt>
         <literal hex="41"/>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <literal string="double"/>
                  </alt>
                  <alt>
                     <literal string="single"/>
                  </alt>
                  <alt>
                     <literal hex="41"/>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <literal string="double"/>
                  </alt>
                  <alt>
                     <literal string="single"/>
                  </alt>
                  <alt>
                     <literal hex="41"/>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <literal string="double"/>
      </alt>
      <alt>
         <literal string="single"/>
      </alt>
      <alt>
         <literal hex="41"/>
      </alt>
   </rule>
</ixml>

sets

Input grammar
S: atoz; AtoZ; NotZeroToNine; NotAtoF; Letters; NotLetters .
atoz: ^["a"-"z"] .
AtoZ: -["A"-"Z"] .
NotZeroToNine: ~['0'-'9'] .
NotAtoF: -~[#41-#46] .
Letters: [L] .
NotLetters: -~[L] .
Grammar test
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="sets.output.xml"/>
</result>
<ixml>
   <rule name="S">
      <alt>
         <nonterminal name="atoz"/>
      </alt>
      <alt>
         <nonterminal name="AtoZ"/>
      </alt>
      <alt>
         <nonterminal name="NotZeroToNine"/>
      </alt>
      <alt>
         <nonterminal name="NotAtoF"/>
      </alt>
      <alt>
         <nonterminal name="Letters"/>
      </alt>
      <alt>
         <nonterminal name="NotLetters"/>
      </alt>
   </rule>
   <rule name="atoz">
      <alt>
         <inclusion tmark="^">
            <member from="a" to="z"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="AtoZ">
      <alt>
         <inclusion tmark="-">
            <member from="A" to="Z"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="NotZeroToNine">
      <alt>
         <exclusion>
            <member from="0" to="9"/>
         </exclusion>
      </alt>
   </rule>
   <rule name="NotAtoF">
      <alt>
         <exclusion tmark="-">
            <member from="#41" to="#46"/>
         </exclusion>
      </alt>
   </rule>
   <rule name="Letters">
      <alt>
         <inclusion>
            <member code="L"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="NotLetters">
      <alt>
         <exclusion tmark="-">
            <member code="L"/>
         </exclusion>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="13">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <nonterminal name="atoz"/>
                  </alt>
                  <alt>
                     <nonterminal name="AtoZ"/>
                  </alt>
                  <alt>
                     <nonterminal name="NotZeroToNine"/>
                  </alt>
                  <alt>
                     <nonterminal name="NotAtoF"/>
                  </alt>
                  <alt>
                     <nonterminal name="Letters"/>
                  </alt>
                  <alt>
                     <nonterminal name="NotLetters"/>
                  </alt>
               </rule>
               <rule name="atoz">
                  <alt>
                     <inclusion tmark="^">
                        <member from="a" to="z"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="AtoZ">
                  <alt>
                     <inclusion tmark="-">
                        <member from="A" to="Z"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="NotZeroToNine">
                  <alt>
                     <exclusion>
                        <member from="0" to="9"/>
                     </exclusion>
                  </alt>
               </rule>
               <rule name="NotAtoF">
                  <alt>
                     <exclusion tmark="-">
                        <member from="#41" to="#46"/>
                     </exclusion>
                  </alt>
               </rule>
               <rule name="Letters">
                  <alt>
                     <inclusion>
                        <member code="L"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="NotLetters">
                  <alt>
                     <exclusion tmark="-">
                        <member code="L"/>
                     </exclusion>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <nonterminal name="atoz"/>
                  </alt>
                  <alt>
                     <nonterminal name="AtoZ"/>
                  </alt>
                  <alt>
                     <nonterminal name="NotZeroToNine"/>
                  </alt>
                  <alt>
                     <nonterminal name="NotAtoF"/>
                  </alt>
                  <alt>
                     <nonterminal name="Letters"/>
                  </alt>
                  <alt>
                     <nonterminal name="NotLetters"/>
                  </alt>
               </rule>
               <rule name="atoz">
                  <alt>
                     <inclusion tmark="^">
                        <member from="a" to="z"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="AtoZ">
                  <alt>
                     <inclusion tmark="-">
                        <member from="A" to="Z"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="NotZeroToNine">
                  <alt>
                     <exclusion>
                        <member from="0" to="9"/>
                     </exclusion>
                  </alt>
               </rule>
               <rule name="NotAtoF">
                  <alt>
                     <exclusion tmark="-">
                        <member from="#41" to="#46"/>
                     </exclusion>
                  </alt>
               </rule>
               <rule name="Letters">
                  <alt>
                     <inclusion>
                        <member code="L"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="NotLetters">
                  <alt>
                     <exclusion tmark="-">
                        <member code="L"/>
                     </exclusion>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2. Document parse: 13.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <nonterminal name="atoz"/>
      </alt>
      <alt>
         <nonterminal name="AtoZ"/>
      </alt>
      <alt>
         <nonterminal name="NotZeroToNine"/>
      </alt>
      <alt>
         <nonterminal name="NotAtoF"/>
      </alt>
      <alt>
         <nonterminal name="Letters"/>
      </alt>
      <alt>
         <nonterminal name="NotLetters"/>
      </alt>
   </rule>
   <rule name="atoz">
      <alt>
         <inclusion tmark="^">
            <member from="a" to="z"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="AtoZ">
      <alt>
         <inclusion tmark="-">
            <member from="A" to="Z"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="NotZeroToNine">
      <alt>
         <exclusion>
            <member from="0" to="9"/>
         </exclusion>
      </alt>
   </rule>
   <rule name="NotAtoF">
      <alt>
         <exclusion tmark="-">
            <member from="#41" to="#46"/>
         </exclusion>
      </alt>
   </rule>
   <rule name="Letters">
      <alt>
         <inclusion>
            <member code="L"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="NotLetters">
      <alt>
         <exclusion tmark="-">
            <member code="L"/>
         </exclusion>
      </alt>
   </rule>
</ixml>
file:/home/circleci/project/ixml/tests/ambiguous/test-catalog.xml

Amsterdam Test Suite 1, ambiguous tests, 2021-12-21

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

ambig

Input grammar
expr: e.
e: e, "+", e; e, "-", e; "i".

Test ambig
Input text
i+i+i
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ambig.output.xml"/>
   <assert-xml-ref href="ambig.alt.output.xml"/>
</result>
<expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <e>
      <e>i</e>+<e>
         <e>i</e>+<e>i</e>
      </e>
   </e>
</expr>
<expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <e>
      <e>
         <e>i</e>+<e>i</e>
      </e>+<e>i</e>
   </e>
</expr>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <e>
                  <e>i</e>+<e>
                     <e>i</e>+<e>i</e>
                  </e>
               </e>
            </expr>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <e>
                  <e>i</e>+<e>
                     <e>i</e>+<e>i</e>
                  </e>
               </e>
            </expr>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Actual:
<expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <e>
      <e>i</e>+<e>
         <e>i</e>+<e>i</e>
      </e>
   </e>
</expr>

ambig2

Input grammar
a: "a"* ; "b"*.
Test ambig2

The grammar is a: "a"* ; "b"*. and the input is the empty string.

If the grammar is rewritten to BNF, it will clearly have two parse trees against the BNF grammar, but it does not have two parse trees against the EBNF grammar.

So MSM has added an alternative result which does not mark the result ambiguous.

What the spec should say will require careful discussion.

Input text

                  
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ambig2.output.xml"/>
   <assert-xml-ref href="ambig2.alt.output.xml"/>
</result>
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous"/>
<a/>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous"/>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a/>
         </ns>
      </actual>
      <message/>
   </comparison>
   <comparison>
      <expected>
         <ns xmlns="">
            <a/>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a/>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>

Result: PASS

Alternative 1
Actual:
<a/>
Alternative 2
Actual:
<a/>

ambig3

Input grammar
a: "a", spaces, b.
b: spaces, "b".
spaces: " "*.
Test ambig3
Input text
a   b
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ambig3.output.xml"/>
   <assert-xml-ref href="ambig3.alt.output.xml"/>
   <assert-xml-ref href="ambig3.alt-2.output.xml"/>
   <assert-xml-ref href="ambig3.alt-3.output.xml"/>
</result>
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces/>
   <b>
      <spaces>   </spaces>b</b>
</a>
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces> </spaces>
   <b>
      <spaces>  </spaces>b</b>
</a>
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces>  </spaces>
   <b>
      <spaces> </spaces>b</b>
</a>
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces>   </spaces>
   <b>
      <spaces/>b</b>
</a>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces/>
               <b>
                  <spaces>   </spaces>b</b>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces> </spaces>
               <b>
                  <spaces>  </spaces>b</b>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
   <comparison>
      <expected>
         <ns xmlns="">
            <a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces> </spaces>
               <b>
                  <spaces>  </spaces>b</b>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces> </spaces>
               <b>
                  <spaces>  </spaces>b</b>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Alternative 1
Actual:
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces> </spaces>
   <b>
      <spaces>  </spaces>b</b>
</a>
Alternative 2
Actual:
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">a<spaces> </spaces>
   <b>
      <spaces>  </spaces>b</b>
</a>

ambig4

Input grammar
properties: property+.
property: name, "=", value++",", eol.
name: [L]+.
value: ~[","]+.
eol: -#a.
Test ambig4
Input text
red=#f00
green=#0f0
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ambig4.output.xml"/>
   <assert-xml-ref href="ambig4.alt.output.xml"/>
</result>
<properties xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <property>
      <name>red</name>=<value>#f00</value>
      <eol/>
   </property>
   <property>
      <name>green</name>=<value>#0f0</value>
      <eol/>
   </property>
</properties>
<properties xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <property>
      <name>red</name>=<value>#f00
green=#0f0</value>
      <eol/>
   </property>
</properties>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="5"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <properties xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <property>
                  <name>red</name>=<value>#f00</value>
                  <eol/>
               </property>
               <property>
                  <name>green</name>=<value>#0f0</value>
                  <eol/>
               </property>
            </properties>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <properties xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <property>
                  <name>red</name>=<value>#f00</value>
                  <eol/>
               </property>
               <property>
                  <name>green</name>=<value>#0f0</value>
                  <eol/>
               </property>
            </properties>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 5. Document parse: 1.

Result: PASS

Actual:
<properties xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <property>
      <name>red</name>=<value>#f00</value>
      <eol/>
   </property>
   <property>
      <name>green</name>=<value>#0f0</value>
      <eol/>
   </property>
</properties>

ambig5

Input grammar
data: number+.
number: digit+.
digit: ["0"-"9"].
Test ambig5
Input text
12
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ambig5.output.xml"/>
   <assert-xml-ref href="ambig5.alt.output.xml"/>
</result>
<data xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <number>
      <digit>1</digit>
   </number>
   <number>
      <digit>2</digit>
   </number>
</data>
<data xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <number>
      <digit>1</digit>
      <digit>2</digit>
   </number>
</data>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <data xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <number>
                  <digit>1</digit>
               </number>
               <number>
                  <digit>2</digit>
               </number>
            </data>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <data xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <number>
                  <digit>1</digit>
               </number>
               <number>
                  <digit>2</digit>
               </number>
            </data>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Actual:
<data xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <number>
      <digit>1</digit>
   </number>
   <number>
      <digit>2</digit>
   </number>
</data>

ambig6

Input grammar
block: "{", rule**";", "}".
rule: name, "=", value; .
name: [L]+.
value: [Nd]+.
Test ambig6
Input text
{}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ambig6.output.xml"/>
   <assert-xml-ref href="ambig6.alt.output.xml"/>
</result>
<block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{}</block>
<block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{<rule/>}</block>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{}</block>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{<rule/>}</block>
         </ns>
      </actual>
      <message/>
   </comparison>
   <comparison>
      <expected>
         <ns xmlns="">
            <block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{<rule/>}</block>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{<rule/>}</block>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 4.

Result: PASS

Alternative 1
Actual:
<block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{<rule/>}</block>
Alternative 2
Actual:
<block xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">{<rule/>}</block>

ambig7

Input grammar
a: b, ()?, c.
b: "b".
c: "c".
Test ambig6

The grammar is a: b, ()?, c. b: "b". c: "c". and the input is bc.

As with ambig2, this is or is not ambiguous depending on exactly how we define ambiguity. The parse may interpret the middle term as present or as absent, so there are two derivations, or may be depending on how we define 'derivation'. There is only one parse tree for the EBNF grammar.

So MSM has specified two alternative results which differ only in including or excluding the ambiguity flag.

What the spec should say will require careful discussion.

Input text
bc
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ambig7.output.xml"/>
   <assert-xml-ref href="ambig7.alt.output.xml"/>
</result>
<a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <b>b</b>
   <c>c</c>
</a>
<a>
   <b>b</b>
   <c>c</c>
</a>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <a xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <b>b</b>
               <c>c</c>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a>
               <b>b</b>
               <c>c</c>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
   <comparison>
      <expected>
         <ns xmlns="">
            <a>
               <b>b</b>
               <c>c</c>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a>
               <b>b</b>
               <c>c</c>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Alternative 1
Actual:
<a>
   <b>b</b>
   <c>c</c>
</a>
Alternative 2
Actual:
<a>
   <b>b</b>
   <c>c</c>
</a>

css

Input grammar
css: S, rule+.
rule: selector, block.
block: -"{", S, property**(-";", S), -"}", S.
property:  @name, S, -":", S, value; empty.
selector: name, S.
name: letter+.
-letter: ["a"-"z"; "-"].
digit: ["0"-"9"].
value: (@name; @number), S.
number: digit+.
-empty: .
-S: -[" "; #a]*.
Test css
Input text
body { color: blue; font-weight: bold; margin: 0; }
head {}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="css.output.xml"/>
   <assert-xml-ref href="css.alt.output.xml"/>
</result>
<css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <rule>
      <selector>
         <name>body</name>
      </selector>
      <block>
         <property name="color">
            <value name="blue"/>
         </property>
         <property name="font-weight">
            <value name="bold"/>
         </property>
         <property name="margin">
            <value number="0"/>
         </property>
         <property/>
      </block>
   </rule>
   <rule>
      <selector>
         <name>head</name>
      </selector>
      <block/>
   </rule>
</css>
<css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <rule>
      <selector>
         <name>body</name>
      </selector>
      <block>
         <property name="color">
            <value name="blue"/>
         </property>
         <property name="font-weight">
            <value name="bold"/>
         </property>
         <property name="margin">
            <value number="0"/>
         </property>
         <property/>
      </block>
   </rule>
   <rule>
      <selector>
         <name>head</name>
      </selector>
      <block>
         <property/>
      </block>
   </rule>
</css>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="23"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <rule>
                  <selector>
                     <name>body</name>
                  </selector>
                  <block>
                     <property name="color">
                        <value name="blue"/>
                     </property>
                     <property name="font-weight">
                        <value name="bold"/>
                     </property>
                     <property name="margin">
                        <value number="0"/>
                     </property>
                     <property/>
                  </block>
               </rule>
               <rule>
                  <selector>
                     <name>head</name>
                  </selector>
                  <block/>
               </rule>
            </css>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <rule>
                  <selector>
                     <name>body</name>
                  </selector>
                  <block>
                     <property name="color">
                        <value name="blue"/>
                     </property>
                     <property name="font-weight">
                        <value name="bold"/>
                     </property>
                     <property name="margin">
                        <value number="0"/>
                     </property>
                     <property/>
                  </block>
               </rule>
               <rule>
                  <selector>
                     <name>head</name>
                  </selector>
                  <block>
                     <property/>
                  </block>
               </rule>
            </css>
         </ns>
      </actual>
      <message/>
   </comparison>
   <comparison>
      <expected>
         <ns xmlns="">
            <css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <rule>
                  <selector>
                     <name>body</name>
                  </selector>
                  <block>
                     <property name="color">
                        <value name="blue"/>
                     </property>
                     <property name="font-weight">
                        <value name="bold"/>
                     </property>
                     <property name="margin">
                        <value number="0"/>
                     </property>
                     <property/>
                  </block>
               </rule>
               <rule>
                  <selector>
                     <name>head</name>
                  </selector>
                  <block>
                     <property/>
                  </block>
               </rule>
            </css>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <rule>
                  <selector>
                     <name>body</name>
                  </selector>
                  <block>
                     <property name="color">
                        <value name="blue"/>
                     </property>
                     <property name="font-weight">
                        <value name="bold"/>
                     </property>
                     <property name="margin">
                        <value number="0"/>
                     </property>
                     <property/>
                  </block>
               </rule>
               <rule>
                  <selector>
                     <name>head</name>
                  </selector>
                  <block>
                     <property/>
                  </block>
               </rule>
            </css>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 23. Document parse: 1.

Result: PASS

Alternative 1
Actual:
<css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <rule>
      <selector>
         <name>body</name>
      </selector>
      <block>
         <property name="color">
            <value name="blue"/>
         </property>
         <property name="font-weight">
            <value name="bold"/>
         </property>
         <property name="margin">
            <value number="0"/>
         </property>
         <property/>
      </block>
   </rule>
   <rule>
      <selector>
         <name>head</name>
      </selector>
      <block>
         <property/>
      </block>
   </rule>
</css>
Alternative 2
Actual:
<css xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <rule>
      <selector>
         <name>body</name>
      </selector>
      <block>
         <property name="color">
            <value name="blue"/>
         </property>
         <property name="font-weight">
            <value name="bold"/>
         </property>
         <property name="margin">
            <value number="0"/>
         </property>
         <property/>
      </block>
   </rule>
   <rule>
      <selector>
         <name>head</name>
      </selector>
      <block>
         <property/>
      </block>
   </rule>
</css>

date

Input grammar
date: bla, day, S, number, S, month, S, year, bla;
      bla, number, S, month, S, year, bla;
      bla, day, ",", S, number, S, month, S, year, bla. 
day: Monday; Tuesday; Wednesday; Thursday; Friday; Saturday; Sunday.
Monday: "Mon"; "Monday".
Tuesday: "Tue"; "Tuesday".
Wednesday: "Wed"; "Weds"; "Wednesday".
Thursday: "Thu"; "Thur"; "Thurs"; "Thursday".
Friday: "Fri"; "Friday".
Saturday: "Sat"; "Saturday".
Sunday: "Sun"; "Sunday".
number: cardinal; ordinal.
cardinal: digits1, "st"; digits2, "nd"; digits3, "rd"; digits4,"th".
ordinal: digits.
-digits: digit+.
-digit: ["0"-"9"].
-digits1: "1"; digits, "1".
-digits2: "2"; digits, "2".
-digits3: "3"; digits, "3".
-digits4: digit4; digits, digit4.
-digit4: ["4"-"9"]; "0".
-bla: ; char, bla.
-char: [" "-"~"].
month: January; February; March; April; May; June; July; August; September; October; November; December.
year: digit, digit, digit, digit.
January: "January"; "Jan".
February: "February"; "Feb".
March: "March"; "Mar".
April: "April"; "Apr".
May: "May".
June: "June"; "Jun".
July: "July"; "Jul".
August: "August"; "Aug".
September: "September"; "Sept"; "Sep".
October: "October"; "Oct".
November: "November"; "Nov".
December: "December"; "Dec".
-S: " "*.
Test date
Input text
The conference starts Thursday, 9th Feb 2017 at 10:00.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="date.output.xml"/>
   <assert-xml-ref href="date.alt.output.xml"/>
</result>
<date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts <day>
      <Thursday>Thursday</Thursday>
   </day>, <number>
      <cardinal>9th</cardinal>
   </number>
   <month>
      <February>Feb</February>
   </month>
   <year>2017</year> at 10:00.</date>
<date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts Thursday, <number>
      <cardinal>9th</cardinal>
   </number>
   <month>
      <February>Feb</February>
   </month>
   <year>2017</year> at 10:00.</date>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="61"
        documentParse="7">
   <comparison>
      <expected>
         <ns xmlns="">
            <date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts <day>
                  <Thursday>Thursday</Thursday>
               </day>, <number>
                  <cardinal>9th</cardinal>
               </number>
               <month>
                  <February>Feb</February>
               </month>
               <year>2017</year> at 10:00.</date>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts Thursday, <number>
                  <cardinal>9th</cardinal>
               </number>
               <month>
                  <February>Feb</February>
               </month>
               <year>2017</year> at 10:00.</date>
         </ns>
      </actual>
      <message/>
   </comparison>
   <comparison>
      <expected>
         <ns xmlns="">
            <date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts Thursday, <number>
                  <cardinal>9th</cardinal>
               </number>
               <month>
                  <February>Feb</February>
               </month>
               <year>2017</year> at 10:00.</date>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts Thursday, <number>
                  <cardinal>9th</cardinal>
               </number>
               <month>
                  <February>Feb</February>
               </month>
               <year>2017</year> at 10:00.</date>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 61. Document parse: 7.

Result: PASS

Alternative 1
Actual:
<date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts Thursday, <number>
      <cardinal>9th</cardinal>
   </number>
   <month>
      <February>Feb</February>
   </month>
   <year>2017</year> at 10:00.</date>
Alternative 2
Actual:
<date xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">The conference starts Thursday, <number>
      <cardinal>9th</cardinal>
   </number>
   <month>
      <February>Feb</February>
   </month>
   <year>2017</year> at 10:00.</date>

empty-parens

Input grammar
a: "a"; ()?.
Test empty-parens
Input text

                  
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="empty-parens.output.xml"/>
</result>
<a/>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <a/>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a/>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<a/>

expr0

Input grammar
{expr: operand+operator.
operand: id; number.
-id: @name.
name: letter+.
-number: @value.
value: digit+.
letter: ["a"-"z"].
digit: ["0"-"9"].
operator: "+"; "-"; "×"; "÷".
                             }
expr: id; number; expr, operator, expr.
id: ["a"-"z"]+.
number: ["0"-"9"]+.
operator: "+"; "-"; "×"; "÷".
Test expr0
Input text
a÷b÷c
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="expr0.output.xml"/>
   <assert-xml-ref href="expr0.alt.output.xml"/>
</result>
<expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <expr>
      <id>a</id>
   </expr>
   <operator>÷</operator>
   <expr>
      <expr>
         <id>b</id>
      </expr>
      <operator>÷</operator>
      <expr>
         <id>c</id>
      </expr>
   </expr>
</expr>
<expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <expr>
      <expr>
         <id>a</id>
      </expr>
      <operator>÷</operator>
      <expr>
         <id>b</id>
      </expr>
   </expr>
   <operator>÷</operator>
   <expr>
      <id>c</id>
   </expr>
</expr>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="99"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <expr>
                  <id>a</id>
               </expr>
               <operator>÷</operator>
               <expr>
                  <expr>
                     <id>b</id>
                  </expr>
                  <operator>÷</operator>
                  <expr>
                     <id>c</id>
                  </expr>
               </expr>
            </expr>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <expr>
                  <id>a</id>
               </expr>
               <operator>÷</operator>
               <expr>
                  <expr>
                     <id>b</id>
                  </expr>
                  <operator>÷</operator>
                  <expr>
                     <id>c</id>
                  </expr>
               </expr>
            </expr>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 99. Document parse: 1.

Result: PASS

Actual:
<expr xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <expr>
      <id>a</id>
   </expr>
   <operator>÷</operator>
   <expr>
      <expr>
         <id>b</id>
      </expr>
      <operator>÷</operator>
      <expr>
         <id>c</id>
      </expr>
   </expr>
</expr>

lf2

Input grammar
input: line++lf, lf?.
line: ~[#a]*.
lf: -#a.
Test lf2
Input text
Now is the time
For all good people
To have fun.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="lf2.output.xml"/>
   <assert-xml-ref href="lf2.alt.output.xml"/>
</result>
<input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <line>Now is the time</line>
   <lf/>
   <line>For all good people</line>
   <lf/>
   <line>To have fun.</line>
   <lf/>
</input>
<input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <line>Now is the time</line>
   <lf/>
   <line>For all good people</line>
   <lf/>
   <line>To have fun.</line>
   <lf/>
   <line/>
</input>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="2">
   <comparison>
      <expected>
         <ns xmlns="">
            <input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <line>Now is the time</line>
               <lf/>
               <line>For all good people</line>
               <lf/>
               <line>To have fun.</line>
               <lf/>
            </input>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <line>Now is the time</line>
               <lf/>
               <line>For all good people</line>
               <lf/>
               <line>To have fun.</line>
               <lf/>
               <line/>
            </input>
         </ns>
      </actual>
      <message/>
   </comparison>
   <comparison>
      <expected>
         <ns xmlns="">
            <input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <line>Now is the time</line>
               <lf/>
               <line>For all good people</line>
               <lf/>
               <line>To have fun.</line>
               <lf/>
               <line/>
            </input>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
               <line>Now is the time</line>
               <lf/>
               <line>For all good people</line>
               <lf/>
               <line>To have fun.</line>
               <lf/>
               <line/>
            </input>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 3. Document parse: 2.

Result: PASS

Alternative 1
Actual:
<input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <line>Now is the time</line>
   <lf/>
   <line>For all good people</line>
   <lf/>
   <line>To have fun.</line>
   <lf/>
   <line/>
</input>
Alternative 2
Actual:
<input xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <line>Now is the time</line>
   <lf/>
   <line>For all good people</line>
   <lf/>
   <line>To have fun.</line>
   <lf/>
   <line/>
</input>
file:/home/circleci/project/ixml/tests/correct/test-catalog.xml

Amsterdam Test Suite 1, correct tests, 2021-12-21

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

ixml tests

address

Input grammar
address: person, lf, street, lf, postcode, city, lf, country, lf; 
         person, lf, street, lf, city, postcode, lf, country, lf.
person: (title, S?)?, (initials; given, S), surname, S?.
title: "Mr."; "Mrs."; "Dr."; "Ms.".
initials: initial+.
initial: LETTER, ".", S?.
surname: name.
given: name.
-name: LETTER, letters.
street: no, S?, streetname; streetname, S?, no, S?.
streetname: name, S; name, S, name.
city: name, S; name, S, name, S.
country: name, S?; name, S, name, S?.
postcode: digits, S, LETTER, LETTER, S?; 
          LETTER, LETTER, digits, S, digit, LETTER, LETTER, S?.
no: digits.
-LETTER: ["A"-"Z"].
-letters: ["a"-"z"]*.
-digit: ["0"-"9"].
-digits: ["0"-"9"]+.
-S: " "+.
-lf: -#a.
Test address
Input text
Steven Pemberton
21 Sandridge Road
St Albans AL1 4BY
United Kingdom
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="address.output.xml"/>
</result>
<address>
   <person>
      <given>Steven</given>
      <surname>Pemberton</surname>
   </person>
   <street>
      <no>21</no>
      <streetname>Sandridge Road</streetname>
   </street>
   <city>St Albans </city>
   <postcode>AL1 4BY</postcode>
   <country>United Kingdom</country>
</address>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="50"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <address>
               <person>
                  <given>Steven</given>
                  <surname>Pemberton</surname>
               </person>
               <street>
                  <no>21</no>
                  <streetname>Sandridge Road</streetname>
               </street>
               <city>St Albans </city>
               <postcode>AL1 4BY</postcode>
               <country>United Kingdom</country>
            </address>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <address>
               <person>
                  <given>Steven</given>
                  <surname>Pemberton</surname>
               </person>
               <street>
                  <no>21</no>
                  <streetname>Sandridge Road</streetname>
               </street>
               <city>St Albans </city>
               <postcode>AL1 4BY</postcode>
               <country>United Kingdom</country>
            </address>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 50. Document parse: 1.

Result: PASS

Actual:
<address>
   <person>
      <given>Steven</given>
      <surname>Pemberton</surname>
   </person>
   <street>
      <no>21</no>
      <streetname>Sandridge Road</streetname>
   </street>
   <city>St Albans </city>
   <postcode>AL1 4BY</postcode>
   <country>United Kingdom</country>
</address>

arith

Input grammar
expr: open, -arith, close.
open: "(".
close: ")".
arith: left, -op, right.
op: @plus.
plus: "+".
left: "a".
right:"b".
Test arith
Input text
(a+b)
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="arith.output.xml"/>
</result>
<expr plus="+">
   <open>(</open>
   <left>a</left>
   <right>b</right>
   <close>)</close>
</expr>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="7"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <expr plus="+">
               <open>(</open>
               <left>a</left>
               <right>b</right>
               <close>)</close>
            </expr>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expr plus="+">
               <open>(</open>
               <left>a</left>
               <right>b</right>
               <close>)</close>
            </expr>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 7.

Result: PASS

Actual:
<expr plus="+">
   <open>(</open>
   <left>a</left>
   <right>b</right>
   <close>)</close>
</expr>

attribute-value

Input grammar
test: a, ".".
@a: ~["."]*.
Test attribute-value
Input text
"'<>/&.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="attribute-value.output.xml"/>
</result>
<test a="&#34;'&lt;&gt;/&amp;">.</test>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <test a="&#34;'&lt;&gt;/&amp;">.</test>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <test a="&#34;'&lt;&gt;/&amp;">.</test>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<test a="&#34;'&lt;&gt;/&amp;">.</test>

attribute-multipart

Test that an attribute value constructed from multiple children is correctly interpreted.

Input grammar
date: month, -',', -' '*, year . 
@month: 'Feb', 'ruary' .
year: ['0'-'9']+ .
Test attribute-multipart

Input text

February, 2022
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml>
      <date xmlns="" month="February">
         <year>2022</year>
      </date>
   </assert-xml>
</result>
<date month="February">
   <year>2022</year>
</date>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <date month="February">
               <year>2022</year>
            </date>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <date month="February">
               <year>2022</year>
            </date>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 3.

Result: PASS

Actual:
<date month="February">
   <year>2022</year>
</date>

diary

Input grammar
diary: entry+.
entry: date, para.
date: day, s, month, s,  year, -#a.
day: digit, digit?.
-digit:["0"-"9"].
month: "January"; "February"; "March"; "April"; "May"; "June";
       "July"; "August"; "September"; "October"; "November"; "December".
year: digit, digit, digit, digit.

para: word++s, s?, blank.
-blank: -#a, -#a.
-word: (letter; punctuation)+.
-letter: [L].
-punctuation: [".;:,'?!"].
-s: " "+.
Test diary
Input text
24 December 2021
Panic shopping! Panic packing! Will we make it before midnight?

25 December 2021
Food! Presents!

26 December 2021
Groan.

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="diary.output.xml"/>
</result>
<diary>
   <entry>
      <date>
         <day>24</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
   </entry>
   <entry>
      <date>
         <day>25</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Food! Presents!</para>
   </entry>
   <entry>
      <date>
         <day>26</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Groan.</para>
   </entry>
</diary>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="18"
        documentParse="2">
   <comparison>
      <expected>
         <ns xmlns="">
            <diary>
               <entry>
                  <date>
                     <day>24</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
               </entry>
               <entry>
                  <date>
                     <day>25</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Food! Presents!</para>
               </entry>
               <entry>
                  <date>
                     <day>26</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Groan.</para>
               </entry>
            </diary>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <diary>
               <entry>
                  <date>
                     <day>24</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
               </entry>
               <entry>
                  <date>
                     <day>25</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Food! Presents!</para>
               </entry>
               <entry>
                  <date>
                     <day>26</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Groan.</para>
               </entry>
            </diary>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 18. Document parse: 2.

Result: PASS

Actual:
<diary>
   <entry>
      <date>
         <day>24</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
   </entry>
   <entry>
      <date>
         <day>25</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Food! Presents!</para>
   </entry>
   <entry>
      <date>
         <day>26</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Groan.</para>
   </entry>
</diary>

diary2

Input grammar
diary: entry+.
entry: date, para.
date: day, s, month, s,  year, -#a.
day: digit, digit?.
-digit:["0"-"9"].
month: "January"; "February"; "March"; "April"; "May"; "June";
       "July"; "August"; "September"; "October"; "November"; "December".
year: digit, digit, digit, digit.

para: char*, blank.
-blank: -#a, -#a.
-char: letter; punctuation; s.
-letter: [L].
-punctuation: [".;:,'?!"].
-s: " ".
Test diary2
Input text
24 December 2021
Panic shopping! Panic packing! Will we make it before midnight?

25 December 2021
Food! Presents!

26 December 2021
Groan.

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="diary2.output.xml"/>
</result>
<diary>
   <entry>
      <date>
         <day>24</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
   </entry>
   <entry>
      <date>
         <day>25</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Food! Presents!</para>
   </entry>
   <entry>
      <date>
         <day>26</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Groan.</para>
   </entry>
</diary>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="18"
        documentParse="5">
   <comparison>
      <expected>
         <ns xmlns="">
            <diary>
               <entry>
                  <date>
                     <day>24</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
               </entry>
               <entry>
                  <date>
                     <day>25</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Food! Presents!</para>
               </entry>
               <entry>
                  <date>
                     <day>26</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Groan.</para>
               </entry>
            </diary>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <diary>
               <entry>
                  <date>
                     <day>24</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
               </entry>
               <entry>
                  <date>
                     <day>25</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Food! Presents!</para>
               </entry>
               <entry>
                  <date>
                     <day>26</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Groan.</para>
               </entry>
            </diary>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 18. Document parse: 5.

Result: PASS

Actual:
<diary>
   <entry>
      <date>
         <day>24</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
   </entry>
   <entry>
      <date>
         <day>25</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Food! Presents!</para>
   </entry>
   <entry>
      <date>
         <day>26</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Groan.</para>
   </entry>
</diary>

diary3

Input grammar
diary: entry+.
entry: date, para.
date: day, s, month, s,  year, -#a.
-s: -" "+.
day: digit, digit?.
-digit:["0"-"9"].
month: "January"; "February"; "March"; "April"; "May"; "June";
       "July"; "August"; "September"; "October"; "November"; "December".
year: digit, digit, digit, digit.

para: char*, blank.
-blank: -#a, -#a.
-char: ~[#a].
Test diary3
Input text
24 December 2021
Panic shopping! Panic packing! Will we make it before midnight?

25 December 2021
Food! Presents!

26 December 2021
Groan.

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="diary3.output.xml"/>
</result>
<diary>
   <entry>
      <date>
         <day>24</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
   </entry>
   <entry>
      <date>
         <day>25</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Food! Presents!</para>
   </entry>
   <entry>
      <date>
         <day>26</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Groan.</para>
   </entry>
</diary>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="15"
        documentParse="4">
   <comparison>
      <expected>
         <ns xmlns="">
            <diary>
               <entry>
                  <date>
                     <day>24</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
               </entry>
               <entry>
                  <date>
                     <day>25</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Food! Presents!</para>
               </entry>
               <entry>
                  <date>
                     <day>26</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Groan.</para>
               </entry>
            </diary>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <diary>
               <entry>
                  <date>
                     <day>24</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
               </entry>
               <entry>
                  <date>
                     <day>25</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Food! Presents!</para>
               </entry>
               <entry>
                  <date>
                     <day>26</day>
                     <month>December</month>
                     <year>2021</year>
                  </date>
                  <para>Groan.</para>
               </entry>
            </diary>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 15. Document parse: 4.

Result: PASS

Actual:
<diary>
   <entry>
      <date>
         <day>24</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Panic shopping! Panic packing! Will we make it before midnight?</para>
   </entry>
   <entry>
      <date>
         <day>25</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Food! Presents!</para>
   </entry>
   <entry>
      <date>
         <day>26</day>
         <month>December</month>
         <year>2021</year>
      </date>
      <para>Groan.</para>
   </entry>
</diary>

email

Input grammar
email: user, -"@", host.
@user: atom++".".
-atom: char+.
@host: domain++".".
-domain: word++"-".
-word: letgit+.
-letgit: ["A"-"Z"; "a"-"z"; "0"-"9"].
-char:   letgit; ["!#$%&'*+-/=?^_`{|}~"].
Test email
Input text
~my_mail+{nospam}$?@sub-domain.example.info
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="email.output.xml"/>
</result>
<email user="~my_mail+{nospam}$?" host="sub-domain.example.info"/>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="8"
        documentParse="2">
   <comparison>
      <expected>
         <ns xmlns="">
            <email user="~my_mail+{nospam}$?" host="sub-domain.example.info"/>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <email user="~my_mail+{nospam}$?" host="sub-domain.example.info"/>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 8. Document parse: 2.

Result: PASS

Actual:
<email user="~my_mail+{nospam}$?" host="sub-domain.example.info"/>

expr

Input grammar
expression: expr.
-expr: term; sum; diff.
sum: expr, -"+", term.
diff: expr, "-", term.
-term: factor; prod; div.
prod: term, -"×", factor.
div: term, "÷", factor.
-factor: id; number; bracketed.
bracketed: -"(", expr, -")".
id: @name.
name: letter+.
number: @value.
value: digit+.
-letter: ["a"-"z"].
-digit: ["0"-"9"].
Test expr
Input text
pi+(10×b)
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="expr.output.xml"/>
</result>
<expression>
   <sum>
      <id name="pi"/>
      <bracketed>
         <prod>
            <number value="10"/>
            <id name="b"/>
         </prod>
      </bracketed>
   </sum>
</expression>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="17"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <expression>
               <sum>
                  <id name="pi"/>
                  <bracketed>
                     <prod>
                        <number value="10"/>
                        <id name="b"/>
                     </prod>
                  </bracketed>
               </sum>
            </expression>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expression>
               <sum>
                  <id name="pi"/>
                  <bracketed>
                     <prod>
                        <number value="10"/>
                        <id name="b"/>
                     </prod>
                  </bracketed>
               </sum>
            </expression>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 17.

Result: PASS

Actual:
<expression>
   <sum>
      <id name="pi"/>
      <bracketed>
         <prod>
            <number value="10"/>
            <id name="b"/>
         </prod>
      </bracketed>
   </sum>
</expression>

expr1

Input grammar
expression: expr.
-expr: term+plusop.
@plusop: "+"; "-".
term: -factor; factor, mulop, factor+mulop.
@mulop: "*"; "/".
factor: id; number; bracketed.
bracketed: -"(", expr, -")".
id: @name.
name: letter+.
number: @value.
value: digit+.
-letter: ["a"-"z"].
-digit: ["0"-"9"].
Test expr1
Input text
1+2+3*4+5

We may need a new assertion: if taken literally this grammar produces non-XML output (multiple occurrences of an attribute on the same element).

For now I'll class it as a run-time error in the grammar. But is it an error in the grammar?

To be discussed, probably at length.

expr2

Input grammar
expression: expr. 
-expr: term; sum; diff.
sum: term, "+", term++"+".
diff: term, "-", term++"-".
-term: factor; prod; div.
prod: factor, "×", factor++"×".
div: factor, "÷", factor++"÷".
-factor: name; number; "(", ^expr, ")".
name: ["a"-"z"]+.
number: ["0"-"9"]+.
Test expr2
Input text
234×(bbbb+cccc+dddd)×12
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="expr2.output.xml"/>
</result>
<expression>
   <prod>
      <number>234</number>×(<expr>
         <sum>
            <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
         </sum>
      </expr>)×<number>12</number>
   </prod>
</expression>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="13"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <expression>
               <prod>
                  <number>234</number>×(<expr>
                     <sum>
                        <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
                     </sum>
                  </expr>)×<number>12</number>
               </prod>
            </expression>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expression>
               <prod>
                  <number>234</number>×(<expr>
                     <sum>
                        <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
                     </sum>
                  </expr>)×<number>12</number>
               </prod>
            </expression>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 13. Document parse: 1.

Result: PASS

Actual:
<expression>
   <prod>
      <number>234</number>×(<expr>
         <sum>
            <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
         </sum>
      </expr>)×<number>12</number>
   </prod>
</expression>

expr3

Input grammar
expression: expr. 
-expr: term; sum; diff.
sum: term, "+", term++"+".
diff: term, "-", term++"-".
-term: factor; prod; div.
prod: factor, "×", factor++"×".
div: factor, "÷", factor++"÷".
-factor: name; number; bracketed.
bracketed: "(", expr, ")".
name: ["a"-"z"]+.
number: ["0"-"9"]+.
Test expr3
Input text
234×(bbbb+cccc+dddd)×12
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="expr3.output.xml"/>
</result>
<expression>
   <prod>
      <number>234</number>×<bracketed>(<sum>
            <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
         </sum>)</bracketed>×<number>12</number>
   </prod>
</expression>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="15"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <expression>
               <prod>
                  <number>234</number>×<bracketed>(<sum>
                        <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
                     </sum>)</bracketed>×<number>12</number>
               </prod>
            </expression>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expression>
               <prod>
                  <number>234</number>×<bracketed>(<sum>
                        <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
                     </sum>)</bracketed>×<number>12</number>
               </prod>
            </expression>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 15.

Result: PASS

Actual:
<expression>
   <prod>
      <number>234</number>×<bracketed>(<sum>
            <name>bbbb</name>+<name>cccc</name>+<name>dddd</name>
         </sum>)</bracketed>×<number>12</number>
   </prod>
</expression>

expr4

Input grammar
expression: expr. 
-expr: term; sum.
sum: term, "+", term++"+".
-term: factor; prod.
prod: factor, "×", factor++"×".
-factor: id; number; "(", expr, ")".
id: ["a"-"z"]+.
number: ["0"-"9"]+, (".", ["0"-"9"]+)?.
Test expr4
Input text
pi+(10×a×b)+3.14
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="expr4.output.xml"/>
</result>
<expression>
   <sum>
      <id>pi</id>+(<prod>
         <number>10</number>×<id>a</id>×<id>b</id>
      </prod>)+<number>3.14</number>
   </sum>
</expression>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="10"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <expression>
               <sum>
                  <id>pi</id>+(<prod>
                     <number>10</number>×<id>a</id>×<id>b</id>
                  </prod>)+<number>3.14</number>
               </sum>
            </expression>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expression>
               <sum>
                  <id>pi</id>+(<prod>
                     <number>10</number>×<id>a</id>×<id>b</id>
                  </prod>)+<number>3.14</number>
               </sum>
            </expression>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 10.

Result: PASS

Actual:
<expression>
   <sum>
      <id>pi</id>+(<prod>
         <number>10</number>×<id>a</id>×<id>b</id>
      </prod>)+<number>3.14</number>
   </sum>
</expression>

expr5

Input grammar
expression: expr.
-expr: term; sum; diff.
sum: expr, -"+", term.
diff: expr, "-", term.
-term: factor; prod; div.
prod: term, -"×", factor.
div: term, "÷", factor.
-factor: id; number; bracketed.
bracketed: -"(", expr, -")".
id: @name.
name: letter+.
number: digit+.
-letter: ["a"-"z"].
-digit: ["0"-"9"].
Test expr5
Input text
(3)
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="expr5.output.xml"/>
</result>
<expression>
   <bracketed>
      <number>3</number>
   </bracketed>
</expression>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="16"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <expression>
               <bracketed>
                  <number>3</number>
               </bracketed>
            </expression>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expression>
               <bracketed>
                  <number>3</number>
               </bracketed>
            </expression>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 16.

Result: PASS

Actual:
<expression>
   <bracketed>
      <number>3</number>
   </bracketed>
</expression>

expr6

Input grammar
expression: expr.
-expr: term; sum; diff.
sum: term, "+", term++"+".
diff: term, "-", term++"-".
-term: power; prod; div.
prod: power, "×", power++"×".
div: power, "÷", power++"÷".
-power: fact; exp.
exp: fact, "^", fact++"^".
-fact: id; number; bracketed.
bracketed: "(", exp, ")".
id: letter+.
number: digit+.
-letter: ["a"-"z"].
-digit: ['0'-'9'].
Test expr6
Input text
a^2+b×3+c^2
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="expr6.output.xml"/>
</result>
<expression>
   <sum>
      <exp>
         <id>a</id>^<number>2</number>
      </exp>+<prod>
         <id>b</id>×<number>3</number>
      </prod>+<exp>
         <id>c</id>^<number>2</number>
      </exp>
   </sum>
</expression>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="17"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <expression>
               <sum>
                  <exp>
                     <id>a</id>^<number>2</number>
                  </exp>+<prod>
                     <id>b</id>×<number>3</number>
                  </prod>+<exp>
                     <id>c</id>^<number>2</number>
                  </exp>
               </sum>
            </expression>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <expression>
               <sum>
                  <exp>
                     <id>a</id>^<number>2</number>
                  </exp>+<prod>
                     <id>b</id>×<number>3</number>
                  </prod>+<exp>
                     <id>c</id>^<number>2</number>
                  </exp>
               </sum>
            </expression>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 17.

Result: PASS

Actual:
<expression>
   <sum>
      <exp>
         <id>a</id>^<number>2</number>
      </exp>+<prod>
         <id>b</id>×<number>3</number>
      </prod>+<exp>
         <id>c</id>^<number>2</number>
      </exp>
   </sum>
</expression>

hash

Input grammar
hashes: hash**S, ".".
hash: "#", d6.
@d6: d, (d, (d, (d, (d, d?)?)?)?)?.
-d: ["0"-"9"].
-S: " "+.
Test hash
Input text
#1 #12 #123 #1234 #12345 #123456 #1.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="hash.output.xml"/>
</result>
<hashes>
   <hash d6="1">#</hash>
   <hash d6="12">#</hash>
   <hash d6="123">#</hash>
   <hash d6="1234">#</hash>
   <hash d6="12345">#</hash>
   <hash d6="123456">#</hash>
   <hash d6="1">#</hash>.</hashes>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="4"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <hashes>
               <hash d6="1">#</hash>
               <hash d6="12">#</hash>
               <hash d6="123">#</hash>
               <hash d6="1234">#</hash>
               <hash d6="12345">#</hash>
               <hash d6="123456">#</hash>
               <hash d6="1">#</hash>.</hashes>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <hashes>
               <hash d6="1">#</hash>
               <hash d6="12">#</hash>
               <hash d6="123">#</hash>
               <hash d6="1234">#</hash>
               <hash d6="12345">#</hash>
               <hash d6="123456">#</hash>
               <hash d6="1">#</hash>.</hashes>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 4. Document parse: 1.

Result: PASS

Actual:
<hashes>
   <hash d6="1">#</hash>
   <hash d6="12">#</hash>
   <hash d6="123">#</hash>
   <hash d6="1234">#</hash>
   <hash d6="12345">#</hash>
   <hash d6="123456">#</hash>
   <hash d6="1">#</hash>.</hashes>

hex

Input grammar
hex: "a", [#20], "b".
Test hex
Input text
a b
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="hex.output.xml"/>
</result>
<hex>a b</hex>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <hex>a b</hex>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <hex>a b</hex>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<hex>a b</hex>

hex1

Input grammar
hex: "a", #20, "b".
Test hex1
Input text
a b
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="hex1.output.xml"/>
</result>
<hex>a b</hex>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <hex>a b</hex>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <hex>a b</hex>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<hex>a b</hex>

hex3

Input grammar
hex: "a", [#1-#7e], "b".
Test hex3
Input text
a!b
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="hex3.output.xml"/>
</result>
<hex>a!b</hex>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <hex>a!b</hex>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <hex>a!b</hex>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<hex>a!b</hex>

json

Input grammar
json: element.
element: value.
-value: string;
        number;
        object;
        array;
        "true", S;
        "false", S;
        "null", S.
object: "{", S, members, "}", S.
-members: member**(",", S).
member: @string, S, ":", S, element.
array: "[", S, elements, "]", S.
elements: element**(",", S).
string: -'"', character*, -'"'.
-character: ~['"\'; #0-#19];
           "\", escape.
escape: ['"\/bfnrt'];
       "u", hex, hex, hex, hex.
hex: digit; ["A"-"F"; "a"-"f"].
number: int, frac, exp.
int: "-"?, digit;
     "-"?, onenine, digit*.
digit: ["0"-"9"].
onenine: ["1"-"9"].
frac: (".", digit+)?.
exp: (["eE"], sign, digit+)?.
sign: ["+-"]?.
-S: -[#9; #a; #d; " "]*.
Test json
Input text
{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
 },
 "number": -0.0e+00,
 "string": "\uffff",
 "bool": true,
 "also": false,
 "no": null
}

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="json.output.xml"/>
</result>
<json>
   <element>
      <object>{<member string="menu">:<element>
               <object>{<member string="id">:<element>
                        <string>file</string>
                     </element>
                  </member>,<member string="value">:<element>
                        <string>File</string>
                     </element>
                  </member>,<member string="popup">:<element>
                        <object>{<member string="menuitem">:<element>
                                 <array>[<elements>
                                       <element>
                                          <object>{<member string="value">:<element>
                                                   <string>New</string>
                                                </element>
                                             </member>,<member string="onclick">:<element>
                                                   <string>CreateNewDoc()</string>
                                                </element>
                                             </member>}</object>
                                       </element>,<element>
                                          <object>{<member string="value">:<element>
                                                   <string>Open</string>
                                                </element>
                                             </member>,<member string="onclick">:<element>
                                                   <string>OpenDoc()</string>
                                                </element>
                                             </member>}</object>
                                       </element>,<element>
                                          <object>{<member string="value">:<element>
                                                   <string>Close</string>
                                                </element>
                                             </member>,<member string="onclick">:<element>
                                                   <string>CloseDoc()</string>
                                                </element>
                                             </member>}</object>
                                       </element>
                                    </elements>]</array>
                              </element>
                           </member>}</object>
                     </element>
                  </member>}</object>
            </element>
         </member>,<member string="number">:<element>
               <number>
                  <int>-<digit>0</digit>
                  </int>
                  <frac>.<digit>0</digit>
                  </frac>
                  <exp>e<sign>+</sign>
                     <digit>0</digit>
                     <digit>0</digit>
                  </exp>
               </number>
            </element>
         </member>,<member string="string">:<element>
               <string>\<escape>u<hex>f</hex>
                     <hex>f</hex>
                     <hex>f</hex>
                     <hex>f</hex>
                  </escape>
               </string>
            </element>
         </member>,<member string="bool">:<element>true</element>
         </member>,<member string="also">:<element>false</element>
         </member>,<member string="no">:<element>null</element>
         </member>}</object>
   </element>
</json>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="36"
        documentParse="2">
   <comparison>
      <expected>
         <ns xmlns="">
            <json>
               <element>
                  <object>{<member string="menu">:<element>
                           <object>{<member string="id">:<element>
                                    <string>file</string>
                                 </element>
                              </member>,<member string="value">:<element>
                                    <string>File</string>
                                 </element>
                              </member>,<member string="popup">:<element>
                                    <object>{<member string="menuitem">:<element>
                                             <array>[<elements>
                                                   <element>
                                                      <object>{<member string="value">:<element>
                                                               <string>New</string>
                                                            </element>
                                                         </member>,<member string="onclick">:<element>
                                                               <string>CreateNewDoc()</string>
                                                            </element>
                                                         </member>}</object>
                                                   </element>,<element>
                                                      <object>{<member string="value">:<element>
                                                               <string>Open</string>
                                                            </element>
                                                         </member>,<member string="onclick">:<element>
                                                               <string>OpenDoc()</string>
                                                            </element>
                                                         </member>}</object>
                                                   </element>,<element>
                                                      <object>{<member string="value">:<element>
                                                               <string>Close</string>
                                                            </element>
                                                         </member>,<member string="onclick">:<element>
                                                               <string>CloseDoc()</string>
                                                            </element>
                                                         </member>}</object>
                                                   </element>
                                                </elements>]</array>
                                          </element>
                                       </member>}</object>
                                 </element>
                              </member>}</object>
                        </element>
                     </member>,<member string="number">:<element>
                           <number>
                              <int>-<digit>0</digit>
                              </int>
                              <frac>.<digit>0</digit>
                              </frac>
                              <exp>e<sign>+</sign>
                                 <digit>0</digit>
                                 <digit>0</digit>
                              </exp>
                           </number>
                        </element>
                     </member>,<member string="string">:<element>
                           <string>\<escape>u<hex>f</hex>
                                 <hex>f</hex>
                                 <hex>f</hex>
                                 <hex>f</hex>
                              </escape>
                           </string>
                        </element>
                     </member>,<member string="bool">:<element>true</element>
                     </member>,<member string="also">:<element>false</element>
                     </member>,<member string="no">:<element>null</element>
                     </member>}</object>
               </element>
            </json>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <json>
               <element>
                  <object>{<member string="menu">:<element>
                           <object>{<member string="id">:<element>
                                    <string>file</string>
                                 </element>
                              </member>,<member string="value">:<element>
                                    <string>File</string>
                                 </element>
                              </member>,<member string="popup">:<element>
                                    <object>{<member string="menuitem">:<element>
                                             <array>[<elements>
                                                   <element>
                                                      <object>{<member string="value">:<element>
                                                               <string>New</string>
                                                            </element>
                                                         </member>,<member string="onclick">:<element>
                                                               <string>CreateNewDoc()</string>
                                                            </element>
                                                         </member>}</object>
                                                   </element>,<element>
                                                      <object>{<member string="value">:<element>
                                                               <string>Open</string>
                                                            </element>
                                                         </member>,<member string="onclick">:<element>
                                                               <string>OpenDoc()</string>
                                                            </element>
                                                         </member>}</object>
                                                   </element>,<element>
                                                      <object>{<member string="value">:<element>
                                                               <string>Close</string>
                                                            </element>
                                                         </member>,<member string="onclick">:<element>
                                                               <string>CloseDoc()</string>
                                                            </element>
                                                         </member>}</object>
                                                   </element>
                                                </elements>]</array>
                                          </element>
                                       </member>}</object>
                                 </element>
                              </member>}</object>
                        </element>
                     </member>,<member string="number">:<element>
                           <number>
                              <int>-<digit>0</digit>
                              </int>
                              <frac>.<digit>0</digit>
                              </frac>
                              <exp>e<sign>+</sign>
                                 <digit>0</digit>
                                 <digit>0</digit>
                              </exp>
                           </number>
                        </element>
                     </member>,<member string="string">:<element>
                           <string>\<escape>u<hex>f</hex>
                                 <hex>f</hex>
                                 <hex>f</hex>
                                 <hex>f</hex>
                              </escape>
                           </string>
                        </element>
                     </member>,<member string="bool">:<element>true</element>
                     </member>,<member string="also">:<element>false</element>
                     </member>,<member string="no">:<element>null</element>
                     </member>}</object>
               </element>
            </json>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 36. Document parse: 2.

Result: PASS

Actual:
<json>
   <element>
      <object>{<member string="menu">:<element>
               <object>{<member string="id">:<element>
                        <string>file</string>
                     </element>
                  </member>,<member string="value">:<element>
                        <string>File</string>
                     </element>
                  </member>,<member string="popup">:<element>
                        <object>{<member string="menuitem">:<element>
                                 <array>[<elements>
                                       <element>
                                          <object>{<member string="value">:<element>
                                                   <string>New</string>
                                                </element>
                                             </member>,<member string="onclick">:<element>
                                                   <string>CreateNewDoc()</string>
                                                </element>
                                             </member>}</object>
                                       </element>,<element>
                                          <object>{<member string="value">:<element>
                                                   <string>Open</string>
                                                </element>
                                             </member>,<member string="onclick">:<element>
                                                   <string>OpenDoc()</string>
                                                </element>
                                             </member>}</object>
                                       </element>,<element>
                                          <object>{<member string="value">:<element>
                                                   <string>Close</string>
                                                </element>
                                             </member>,<member string="onclick">:<element>
                                                   <string>CloseDoc()</string>
                                                </element>
                                             </member>}</object>
                                       </element>
                                    </elements>]</array>
                              </element>
                           </member>}</object>
                     </element>
                  </member>}</object>
            </element>
         </member>,<member string="number">:<element>
               <number>
                  <int>-<digit>0</digit>
                  </int>
                  <frac>.<digit>0</digit>
                  </frac>
                  <exp>e<sign>+</sign>
                     <digit>0</digit>
                     <digit>0</digit>
                  </exp>
               </number>
            </element>
         </member>,<member string="string">:<element>
               <string>\<escape>u<hex>f</hex>
                     <hex>f</hex>
                     <hex>f</hex>
                     <hex>f</hex>
                  </escape>
               </string>
            </element>
         </member>,<member string="bool">:<element>true</element>
         </member>,<member string="also">:<element>false</element>
         </member>,<member string="no">:<element>null</element>
         </member>}</object>
   </element>
</json>

json1

Input grammar
json: S, object.
object: "{", S, members, "}", S.
-members: pair**(",", S).
pair: @string, S, ":", S, value.
array: "[", S, value**(",", S), "]", S.
-value: string, S; number, S; object; array; "true", S; "false", S; "null", S.
string: -"""", char*, -"""".
-char: ~['"'; "\" {;[#0-#1F];}]; '\', ('"'; "\"; "/"; "b"; "f"; "n"; "r"; "t"; "u", hexdigits).
number: "-"?, int, frac?, exp?.
-int: "0"; digit19, digit*.
-frac: ".", digit+.
-exp: ("e"; "E"), sign?, digit+.
-sign: "+"; "-".
-S: " "*.
-digit: ["0"-"9"].
-digit19: ["1"-"9"].
-hexdigits: hexdigit, hexdigit, hexdigit, hexdigit.
-hexdigit: digit; ["a"-"f"]; ["A"-"F"].

Test json1
Input text
{"name": "pi", "value": 3.145926}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="json1.output.xml"/>
</result>
<json>
   <object>{<pair string="name">: <string>pi</string>
      </pair>, <pair string="value">: <number>3.145926</number>
      </pair>}</object>
</json>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="34"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <json>
               <object>{<pair string="name">: <string>pi</string>
                  </pair>, <pair string="value">: <number>3.145926</number>
                  </pair>}</object>
            </json>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <json>
               <object>{<pair string="name">: <string>pi</string>
                  </pair>, <pair string="value">: <number>3.145926</number>
                  </pair>}</object>
            </json>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 34. Document parse: 1.

Result: PASS

Actual:
<json>
   <object>{<pair string="name">: <string>pi</string>
      </pair>, <pair string="value">: <number>3.145926</number>
      </pair>}</object>
</json>

lf

Input grammar
input: line++lf.
line: ~[#a]*.
lf: -#a.
Test lf
Input text
Now is the time
For all good people
To have fun.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="lf.output.xml"/>
</result>
<input>
   <line>Now is the time</line>
   <lf/>
   <line>For all good people</line>
   <lf/>
   <line>To have fun.</line>
</input>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <input>
               <line>Now is the time</line>
               <lf/>
               <line>For all good people</line>
               <lf/>
               <line>To have fun.</line>
            </input>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <input>
               <line>Now is the time</line>
               <lf/>
               <line>For all good people</line>
               <lf/>
               <line>To have fun.</line>
            </input>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Actual:
<input>
   <line>Now is the time</line>
   <lf/>
   <line>For all good people</line>
   <lf/>
   <line>To have fun.</line>
</input>

marked

Input grammar
a: @b; "!", c.
b: c.
c: "d".
Test marked
Input text
!d
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="marked.output.xml"/>
</result>
<a>!<c>d</c>
</a>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <a>!<c>d</c>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a>!<c>d</c>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Actual:
<a>!<c>d</c>
</a>

nested-comment

Input grammar
a: b, c.
b: "b". {here is a comment
{with a nested comment
b: "c".
}}
c: .
Test nested-comment
Input text
b
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="nested-comment.output.xml"/>
</result>
<a>
   <b>b</b>
   <c/>
</a>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <a>
               <b>b</b>
               <c/>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a>
               <b>b</b>
               <c/>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Actual:
<a>
   <b>b</b>
   <c/>
</a>

para-test

Input grammar
section: para, lf.
para: line+.
line: ~[#a]+, lf.
lf: -#a.

Test para-test
Input text
AB December 2021
Para entry.

Here is annother section
See.

And another.
The end.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
   <!--
	      <assert-xml-ref href="para-test.output.xml"/>
	  -->
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="1">
</result>
Grammar parse: 3. Document parse: 1.

Result: PASS

The grammar as written allows only one section; the input has several. The error was probably in the formulation of the grammar, but the simplest change to bring it into a consistent state is to change the result.

For the record, the originally asserted result is now in file 'para-test.disputed-output.xml'.

poly

Input grammar
polynomial: f, (plus; minus)*. {4x2+3x-2}
plus: -"+", -f.
minus: -"-", -f.
@power: exp.
@constant: @n.
-f: @n, -"x", @power?; constant.
n: ["0"-"9"]+.
exp: ("⁰"; "¹"; "²";"³"; "⁴"; "⁵"; "⁶"; "⁷"; "⁸"; "⁹")+.

Test poly
Input text
44x⁷⁸⁹+13x²-20x+1
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="poly.output.xml"/>
</result>
<polynomial n="44" power="⁷⁸⁹">
   <plus n="13" power="²"/>
   <minus n="20"/>
   <plus constant="1"/>
</polynomial>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="9"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <polynomial n="44" power="⁷⁸⁹">
               <plus n="13" power="²"/>
               <minus n="20"/>
               <plus constant="1"/>
            </polynomial>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <polynomial n="44" power="⁷⁸⁹">
               <plus n="13" power="²"/>
               <minus n="20"/>
               <plus constant="1"/>
            </polynomial>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 9. Document parse: 1.

Result: PASS

Actual:
<polynomial n="44" power="⁷⁸⁹">
   <plus n="13" power="²"/>
   <minus n="20"/>
   <plus constant="1"/>
</polynomial>

program

Input grammar
program: block.
block: "{", S, statement**(";", S), "}", S.
statement: if-statement; while-statement; assignment; call; block; .
if-statement: "if", S, condition, "then", S, statement, else-part?.
else-part: "else", S, statement.
while-statement: "while", S, condition, "do", S, statement.
assignment: variable, "=", S, expression.
variable: identifier.
call: identifier, "(", S, parameter**(",", S), ")", S.
parameter: -expression.
identifier: letter+, S.
expression: identifier; number.
number: digit+, S.
-letter: ["a"-"z"]; ["A"-"Z"].
-digit: ["0"-"9"].
condition: identifier.
-S: " "*.
Test program
Input text
{a=0;f(a, 0);}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="program.output.xml"/>
</result>
<program>
   <block>{<statement>
         <assignment>
            <variable>
               <identifier>a</identifier>
            </variable>=<expression>
               <number>0</number>
            </expression>
         </assignment>
      </statement>;<statement>
         <call>
            <identifier>f</identifier>(<parameter>
               <identifier>a</identifier>
            </parameter>, <parameter>
               <number>0</number>
            </parameter>)</call>
      </statement>;<statement/>}</block>
</program>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="35"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <program>
               <block>{<statement>
                     <assignment>
                        <variable>
                           <identifier>a</identifier>
                        </variable>=<expression>
                           <number>0</number>
                        </expression>
                     </assignment>
                  </statement>;<statement>
                     <call>
                        <identifier>f</identifier>(<parameter>
                           <identifier>a</identifier>
                        </parameter>, <parameter>
                           <number>0</number>
                        </parameter>)</call>
                  </statement>;<statement/>}</block>
            </program>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <program>
               <block>{<statement>
                     <assignment>
                        <variable>
                           <identifier>a</identifier>
                        </variable>=<expression>
                           <number>0</number>
                        </expression>
                     </assignment>
                  </statement>;<statement>
                     <call>
                        <identifier>f</identifier>(<parameter>
                           <identifier>a</identifier>
                        </parameter>, <parameter>
                           <number>0</number>
                        </parameter>)</call>
                  </statement>;<statement/>}</block>
            </program>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 35.

Result: PASS

Actual:
<program>
   <block>{<statement>
         <assignment>
            <variable>
               <identifier>a</identifier>
            </variable>=<expression>
               <number>0</number>
            </expression>
         </assignment>
      </statement>;<statement>
         <call>
            <identifier>f</identifier>(<parameter>
               <identifier>a</identifier>
            </parameter>, <parameter>
               <number>0</number>
            </parameter>)</call>
      </statement>;<statement/>}</block>
</program>

range

Input grammar
data: range1, range2, -".".
range1: ["0"-"9"].
range2: [#0-#9].

Possible problem: range [#0 - #9] includes non-XML characters. Legal?

Test range
Input text
5	.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="range.output.xml"/>
</result>
<data>
   <range1>5</range1>
   <range2>	</range2>
</data>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <data>
               <range1>5</range1>
               <range2>	</range2>
            </data>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <data>
               <range1>5</range1>
               <range2>	</range2>
            </data>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 3.

Result: PASS

Actual:
<data>
   <range1>5</range1>
   <range2>	</range2>
</data>

string

Input grammar
S : @able, baker, @charlie.
able: string.
baker: string.
charlie: string.
string: ["abc"]*, ".".
Test string
Input text
aaa.bbb.ccc.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="string.output.xml"/>
</result>
<S able="aaa." charlie="ccc.">
   <baker>
      <string>bbb.</string>
   </baker>
</S>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="5"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <S able="aaa." charlie="ccc.">
               <baker>
                  <string>bbb.</string>
               </baker>
            </S>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <S able="aaa." charlie="ccc.">
               <baker>
                  <string>bbb.</string>
               </baker>
            </S>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 5.

Result: PASS

Actual:
<S able="aaa." charlie="ccc.">
   <baker>
      <string>bbb.</string>
   </baker>
</S>

tab

Input grammar
data: s?, word. 
-s: [#20; #9]+.
word: [L]+.
Test tab
Input text
		abc
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="tab.output.xml"/>
</result>
<data>
   <word>abc</word>
</data>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <data>
               <word>abc</word>
            </data>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <data>
               <word>abc</word>
            </data>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2.

Result: PASS

Actual:
<data>
   <word>abc</word>
</data>

test

Input grammar
test: foo, bar.
foo: -".".
bar: ".".

Test test
Input text
..
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="test.output.xml"/>
</result>
<test>
   <foo/>
   <bar>.</bar>
</test>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <test>
               <foo/>
               <bar>.</bar>
            </test>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <test>
               <foo/>
               <bar>.</bar>
            </test>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<test>
   <foo/>
   <bar>.</bar>
</test>

unicode-range

Input grammar
latin: ["À"-"ž"]+.
Test unicode-range
Input text
ŤĤıŞıŞÀŤėšť
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="unicode-range.output.xml"/>
</result>
<latin>ŤĤıŞıŞÀŤėšť</latin>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <latin>ŤĤıŞıŞÀŤėšť</latin>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <latin>ŤĤıŞıŞÀŤėšť</latin>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>

Result: PASS

Actual:
<latin>ŤĤıŞıŞÀŤėšť</latin>

unicode-range1

Input grammar
chars: [#1-"÷"]+.
Test unicode-range1
Input text
¡¢£¤¥¦§¨©«¬®¯°±²³´µ¶·¸¹»¼½¾¿×÷
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="unicode-range1.output.xml"/>
</result>
<chars>¡¢£¤¥¦§¨©«¬®¯°±²³´µ¶·¸¹»¼½¾¿×÷</chars>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <chars>¡¢£¤¥¦§¨©«¬®¯°±²³´µ¶·¸¹»¼½¾¿×÷</chars>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <chars>¡¢£¤¥¦§¨©«¬®¯°±²³´µ¶·¸¹»¼½¾¿×÷</chars>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1. Document parse: 1.

Result: PASS

Actual:
<chars>¡¢£¤¥¦§¨©«¬®¯°±²³´µ¶·¸¹»¼½¾¿×÷</chars>

unicode-range2

Input grammar
chars: [#60-#70]+.
Test unicode-range1
Input text
abc
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="unicode-range2.output.xml"/>
</result>
<chars>abc</chars>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <chars>abc</chars>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <chars>abc</chars>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>

Result: PASS

Actual:
<chars>abc</chars>

vcard

Input grammar
card: -"BEGIN:", name, eoln, property+, -"END:", endname, eoln.
property: name, parameters, -":", attribute++-";", -eoln.
parameters: (-";", parameter)*.
parameter: name, -"=", pvalue.
@pvalue: ~[";:"; #a]+.
attribute: value.
@value: achar*.
-achar: ~["#;"; #a].
@name: ["a"-"z"; "A"-"Z"]+.
@endname: name.
-eoln: -#a.
Test vcard
Input text
BEGIN:VCARD
VERSION:3.0
N:Lastname;Surname
FN:Displayname
ORG:EVenX
URL:http://www.evenx.com/
EMAIL:info@evenx.com
TEL;TYPE=voice,work,pref:+49 1234 56788
ADR;TYPE=intl,work,postal,parcel:;;Wallstr. 1;Berlin;;12345;Germany
END:VCARD
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="vcard.output.xml"/>
</result>
<card name="VCARD" endname="VCARD">
   <property name="VERSION">
      <parameters/>
      <attribute value="3.0"/>
   </property>
   <property name="N">
      <parameters/>
      <attribute value="Lastname"/>
      <attribute value="Surname"/>
   </property>
   <property name="FN">
      <parameters/>
      <attribute value="Displayname"/>
   </property>
   <property name="ORG">
      <parameters/>
      <attribute value="EVenX"/>
   </property>
   <property name="URL">
      <parameters/>
      <attribute value="http://www.evenx.com/"/>
   </property>
   <property name="EMAIL">
      <parameters/>
      <attribute value="info@evenx.com"/>
   </property>
   <property name="TEL">
      <parameters>
         <parameter name="TYPE" pvalue="voice,work,pref"/>
      </parameters>
      <attribute value="+49 1234 56788"/>
   </property>
   <property name="ADR">
      <parameters>
         <parameter name="TYPE" pvalue="intl,work,postal,parcel"/>
      </parameters>
      <attribute value=""/>
      <attribute value=""/>
      <attribute value="Wallstr. 1"/>
      <attribute value="Berlin"/>
      <attribute value=""/>
      <attribute value="12345"/>
      <attribute value="Germany"/>
   </property>
</card>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="15"
        documentParse="5">
   <comparison>
      <expected>
         <ns xmlns="">
            <card name="VCARD" endname="VCARD">
               <property name="VERSION">
                  <parameters/>
                  <attribute value="3.0"/>
               </property>
               <property name="N">
                  <parameters/>
                  <attribute value="Lastname"/>
                  <attribute value="Surname"/>
               </property>
               <property name="FN">
                  <parameters/>
                  <attribute value="Displayname"/>
               </property>
               <property name="ORG">
                  <parameters/>
                  <attribute value="EVenX"/>
               </property>
               <property name="URL">
                  <parameters/>
                  <attribute value="http://www.evenx.com/"/>
               </property>
               <property name="EMAIL">
                  <parameters/>
                  <attribute value="info@evenx.com"/>
               </property>
               <property name="TEL">
                  <parameters>
                     <parameter name="TYPE" pvalue="voice,work,pref"/>
                  </parameters>
                  <attribute value="+49 1234 56788"/>
               </property>
               <property name="ADR">
                  <parameters>
                     <parameter name="TYPE" pvalue="intl,work,postal,parcel"/>
                  </parameters>
                  <attribute value=""/>
                  <attribute value=""/>
                  <attribute value="Wallstr. 1"/>
                  <attribute value="Berlin"/>
                  <attribute value=""/>
                  <attribute value="12345"/>
                  <attribute value="Germany"/>
               </property>
            </card>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <card name="VCARD" endname="VCARD">
               <property name="VERSION">
                  <parameters/>
                  <attribute value="3.0"/>
               </property>
               <property name="N">
                  <parameters/>
                  <attribute value="Lastname"/>
                  <attribute value="Surname"/>
               </property>
               <property name="FN">
                  <parameters/>
                  <attribute value="Displayname"/>
               </property>
               <property name="ORG">
                  <parameters/>
                  <attribute value="EVenX"/>
               </property>
               <property name="URL">
                  <parameters/>
                  <attribute value="http://www.evenx.com/"/>
               </property>
               <property name="EMAIL">
                  <parameters/>
                  <attribute value="info@evenx.com"/>
               </property>
               <property name="TEL">
                  <parameters>
                     <parameter name="TYPE" pvalue="voice,work,pref"/>
                  </parameters>
                  <attribute value="+49 1234 56788"/>
               </property>
               <property name="ADR">
                  <parameters>
                     <parameter name="TYPE" pvalue="intl,work,postal,parcel"/>
                  </parameters>
                  <attribute value=""/>
                  <attribute value=""/>
                  <attribute value="Wallstr. 1"/>
                  <attribute value="Berlin"/>
                  <attribute value=""/>
                  <attribute value="12345"/>
                  <attribute value="Germany"/>
               </property>
            </card>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 15. Document parse: 5.

Result: PASS

Actual:
<card name="VCARD" endname="VCARD">
   <property name="VERSION">
      <parameters/>
      <attribute value="3.0"/>
   </property>
   <property name="N">
      <parameters/>
      <attribute value="Lastname"/>
      <attribute value="Surname"/>
   </property>
   <property name="FN">
      <parameters/>
      <attribute value="Displayname"/>
   </property>
   <property name="ORG">
      <parameters/>
      <attribute value="EVenX"/>
   </property>
   <property name="URL">
      <parameters/>
      <attribute value="http://www.evenx.com/"/>
   </property>
   <property name="EMAIL">
      <parameters/>
      <attribute value="info@evenx.com"/>
   </property>
   <property name="TEL">
      <parameters>
         <parameter name="TYPE" pvalue="voice,work,pref"/>
      </parameters>
      <attribute value="+49 1234 56788"/>
   </property>
   <property name="ADR">
      <parameters>
         <parameter name="TYPE" pvalue="intl,work,postal,parcel"/>
      </parameters>
      <attribute value=""/>
      <attribute value=""/>
      <attribute value="Wallstr. 1"/>
      <attribute value="Berlin"/>
      <attribute value=""/>
      <attribute value="12345"/>
      <attribute value="Germany"/>
   </property>
</card>

xml

Input grammar
xml: element.
element: -"<", name, (" "+, attribute)*, (-">", content, -"</", close, -">"; -"/>").
@name: ["a"-"z"; "A"-"Z"]+.
@close: name.
attribute: name, -"=", value.
@value: -'"', dchar*, -'"'; -"'", schar*, -"'".
content: (cchar; element)*.
-dchar: ~['"'].
-schar: ~["'"].
-cchar: ~["<"].

Test xml
Input text
<test att="abc" class="test">
  Now is the <em>time</em> for stuff.
</test>
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="xml.output.xml"/>
</result>
<xml>
   <element name="test" close="test">
      <attribute name="att" value="abc"/>
      <attribute name="class" value="test"/>
      <content>
  Now is the <element name="em" close="em">
            <content>time</content>
         </element> for stuff.
</content>
   </element>
</xml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="13"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <xml>
               <element name="test" close="test">
                  <attribute name="att" value="abc"/>
                  <attribute name="class" value="test"/>
                  <content>
  Now is the <element name="em" close="em">
                        <content>time</content>
                     </element> for stuff.
</content>
               </element>
            </xml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <xml>
               <element name="test" close="test">
                  <attribute name="att" value="abc"/>
                  <attribute name="class" value="test"/>
                  <content>
  Now is the <element name="em" close="em">
                        <content>time</content>
                     </element> for stuff.
</content>
               </element>
            </xml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 13. Document parse: 1.

Result: PASS

Actual:
<xml>
   <element name="test" close="test">
      <attribute name="att" value="abc"/>
      <attribute name="class" value="test"/>
      <content>
  Now is the <element name="em" close="em">
            <content>time</content>
         </element> for stuff.
</content>
   </element>
</xml>

xml1

Input grammar
xml: element.
element: -"<", name, (-" "+, attribute)*, (-">", content, -"</", close, -">"; -"/>").
@name: ["a"-"z"; "A"-"Z"]+.
@close: name.
attribute: name, -"=", value.
@value: -'"', dchar*, -'"'; -"'", schar*, -"'".
content: (cchar; element)*.
-dchar: ~['"'; "<"].
-schar: ~["'"; "<"].
-cchar: ~["<"].
Test xml1
Input text
<test lang="en" class="test">
  This <em>is</em> a test.
</test>
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="xml1.output.xml"/>
</result>
<xml>
   <element name="test" close="test">
      <attribute name="lang" value="en"/>
      <attribute name="class" value="test"/>
      <content>
  This <element name="em" close="em">
            <content>is</content>
         </element> a test.
</content>
   </element>
</xml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="13"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <xml>
               <element name="test" close="test">
                  <attribute name="lang" value="en"/>
                  <attribute name="class" value="test"/>
                  <content>
  This <element name="em" close="em">
                        <content>is</content>
                     </element> a test.
</content>
               </element>
            </xml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <xml>
               <element name="test" close="test">
                  <attribute name="lang" value="en"/>
                  <attribute name="class" value="test"/>
                  <content>
  This <element name="em" close="em">
                        <content>is</content>
                     </element> a test.
</content>
               </element>
            </xml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 13. Document parse: 1.

Result: PASS

Actual:
<xml>
   <element name="test" close="test">
      <attribute name="lang" value="en"/>
      <attribute name="class" value="test"/>
      <content>
  This <element name="em" close="em">
            <content>is</content>
         </element> a test.
</content>
   </element>
</xml>

xpath

Input grammar
XPath: Expr.

ParamList: Param, ( ',', Param )*.
Param: '$', EQName, TypeDeclaration?.
FunctionBody: EnclosedExpr.
EnclosedExpr: '{', Expr?, '}'.

Expr: ExprSingle, ( s?,',',s?, ExprSingle )*.

-ExprSingle: OrExpr; OrExprSingle.


-OrExprSingle: AndExpr.
OrExpr: AndExpr, (s?, 'or', s?,  AndExpr )+.
AndExpr: ComparisonExpr, (s?, 'and', s?, ComparisonExpr )*.
ComparisonExpr: StringConcatExpr, (s, ( @ValueComp ; @GeneralComp ;@ NodeComp ), s, StringConcatExpr )?.
StringConcatExpr: RangeExpr, (s?, '||', s?, RangeExpr )*.
RangeExpr: AdditiveExpr, ( s, 'to', s, AdditiveExpr )?.
AdditiveExpr: MultiplicativeExpr;
   MultiplicativeExpr,  s?, @AddOp, s?, AdditiveExpr.
@AddOp: ( '+' ; '-' ).
MultiplicativeExpr: UnionExpr;
   UnionExpr,  s?, @MultOp, s?, MultiplicativeExpr.
@MultOp:  '*' ; 'div' ; 'idiv' ; 'mod'.
UnionExpr: IntersectExceptExpr, ( ( 'union' ; '|' ), IntersectExceptExpr )*.
IntersectExceptExpr: InstanceofExpr, ( s, ( 'intersect' ;'except' ), s, InstanceofExpr )*.
InstanceofExpr: TreatExpr, ( s, 'instance', s, 'of', s, @SequenceType )?.
TreatExpr: CastExpr, ( s, -'treat', s, -'as', s, @SequenceType )?.
CastExpr: ArrowExpr, ( s, -'cast', s,-'as', s, @SingleType )?.
ArrowExpr: UnaryExpr, ( '=>', ArrowFunctionSpecifier, ArgumentList )*.


UnaryExpr: ( '-' ; '+' )*, ValueExpr.
-ValueExpr: SimpleMapExpr.
GeneralComp: '='; '!='; '<'; '<='; '>'; '>='.
ValueComp: 'eq'; 'ne'; 'lt'; 'le'; 'gt'; 'ge'.
NodeComp: 'is'; '<<'; '>>'.
SimpleMapExpr: PathExpr, ( '!', PathExpr )*.
PathExpr: '/', ( RelativePathExpr );
   '//', RelativePathExpr;
   RelativePathExpr.
RelativePathExpr: StepExpr, ( ( '/'; '//' ), StepExpr )*.

-StepExpr: PostfixExpr; AxisStep.
-AxisStep: ( ReverseStep;ForwardStep ).
ForwardStep: @ForwardAxis, NodeTest;
   AbbrevForwardStep.
ForwardAxis: 'child::';
   'descendant::';
   'attribute::';
   'self::';
   'descendant-or-self::';
   'following-sibling::';
   'following::';
   'namespace::'.
AbbrevForwardStep: '@'?, QName.
ReverseStep: @ReverseAxis, NodeTest;
   @AbbrevReverseStep.
ReverseAxis: 'parent::';
   'ancestor::';
   'preceding-sibling::';
   'preceding::';
   'ancestor-or-self::'.
AbbrevReverseStep: '..'.


-NodeTest:  KindTest; NameTest.
-NameTest: EQName; Wildcard.

PostfixExpr: PrimaryExpr.
ArgumentList: -'(',s?, ( -Argument,(s?,  -',', s?, -Argument )* )?, s?, -')'.

KeySpecifier: NCName;| IntegerLiteral; ParenthesizedExpr; '*'.
-ArrowFunctionSpecifier: EQName; VarRef; ParenthesizedExpr.

-PrimaryExpr: Literal;
   VarRef;
   ParenthesizedExpr;
   ContextItemExpr;
   FunctionCall;
   FunctionItemExpr;
   MapConstructor;
   ArrayConstructor;
   UnaryLookup.
-Literal: NumericLiteral; StringLiteral.
-NumericLiteral: IntegerLiteral; DecimalLiteral;| DoubleLiteral.
VarRef: -'$', @VarName.
VarName: EQName.
ParenthesizedExpr: -'(', Expr?, -')'.
ContextItemExpr: -'.'.
FunctionCall: @FunctionEQName, -ArgumentList.
-Argument: ExprSingle; ArgumentPlaceholder.
ArgumentPlaceholder: -'?'.
FunctionItemExpr: NamedFunctionRef; InlineFunctionExpr.
NamedFunctionRef: FunctionEQName, '#', IntegerLiteral.
InlineFunctionExpr: -'function', -'(', ParamList?, ')', ( s, 'as', s, SequenceType )?, FunctionBody.
MapConstructor: -'map', -'{', ( MapConstructorEntry, ( ',', MapConstructorEntry )* )?, -'}'.
MapConstructorEntry: MapKeyExpr, -':', MapValueExpr.
MapKeyExpr: ExprSingle.
MapValueExpr: ExprSingle.
ArrayConstructor: SquareArrayConstructor; CurlyArrayConstructor.
SquareArrayConstructor: -'[', ( ExprSingle, ( -',', ExprSingle )* )?, -']'.
CurlyArrayConstructor: -'array', '{', Expr?, -'}'.
UnaryLookup: -'?', KeySpecifier.

SingleType: SimpleTypeName, '?'?.
TypeDeclaration: 'as', SequenceType.
SequenceType: 'empty-sequence()';
   ItemType, OccurrenceIndicator?.
@OccurrenceIndicator: '?'; '*'; '+'.
ItemType: KindTest;
 'item()';
 FunctionTest;
 MapTest;
 ArrayTest;
 AtomicOrUnionType;
 ParenthesizedItemType.
AtomicOrUnionType: EQName.


-KindTest: DocumentTest;
   ElementTest;
   AttributeTest;
   SchemaElementTest;
   SchemaAttributeTest;
   PITest;
   CommentTest;
   TextTest;
   NamespaceNodeTest;
   AnyKindTest.
AnyKindTest: 'node()'.
DocumentTest: -'document-node(' , ( ElementTest ; SchemaElementTest )?, -')'.
TextTest: -'text()'.
CommentTest: -'comment()'.
NamespaceNodeTest: -'namespace-node()'.
PITest:  -'processing-instruction(' , ( NCName ; StringLiteral )?, -')'.
AttributeTest: -'attribute(' ,( AttribNameOrWildcard, ( ',', TypeName )? )?, -')'.
AttribNameOrWildcard: AttributeName; '*'.
SchemaAttributeTest: -'schema-attribute(', AttributeDeclaration, -')'.
AttributeDeclaration: AttributeName.
ElementTest: -'element(' , ( ElementNameOrWildcard, ( ',', TypeName, '?'? )? )?, -')'.
ElementNameOrWildcard: ElementName;'*'.
SchemaElementTest: -'schema-element(', ElementDeclaration, -')'.
ElementDeclaration: ElementName.

AttributeName: EQName.
ElementName: EQName.
SimpleTypeName: EQName.
TypeName: EQName.

FunctionTest: AnyFunctionTest; TypedFunctionTest.
AnyFunctionTest: -'function(*)'.
TypedFunctionTest: -'function(', ( SequenceType, ( -',', SequenceType )* )?, -')', s, 'as', s, SequenceType.
MapTest: AnyMapTest; TypedMapTest.
AnyMapTest: -'map(*)'.
TypedMapTest: -'map(', s, AtomicOrUnionType,s,  -',', s,  SequenceType, s, -')'.
ArrayTest: AnyArrayTest; TypedArrayTest.
AnyArrayTest: -'array(*)'.
TypedArrayTest: -'array(', s, SequenceType, s, -')'.
ParenthesizedItemType: -'(',s, ItemType,s, -')'.

FunctionEQName: FunctionName; URIQualifiedName.
EQName: QName; URIQualifiedName.

QName: FunctionName;
    'array';
    'attribute';
    'comment';
    'document-node';
    'element';
    'empty-sequence';
    'function';
    'if';
    'item';
    'map';
    'namespace-node';
    'node';
    'processing-instruction';
    'schema-attribute';
    'schema-element';
    'switch';
    'text';
    'typeswitch'.
 
 -FunctionName: QNameToken;
    'ancestor';
    'ancestor-or-self';
    'and';
    'cast';
    'castable';
    'child';
    'descendant';
    'descendant-or-self';
    'div';
    'else';
    'eq';
    'every';
    'except';
    'following';
    'following-sibling';
    'for';
    'ge';
    'gt';
    'idiv';
    'instance';
    'intersect';
    'is';
    'le';
    'let';
    'lt';
    'mod';
    'namespace';
    'ne';
    'or';
    'parent';
    'preceding';
    'preceding-sibling';
    'return';
    'satisfies';
    'self';
    'some';
    'to';
    'treat';
    'union'.

StringLiteral: -'"', ( EscapeQuot; ~['"'] )*, -'"';
   -"'", ( EscapeApos ; ~["'"] )*, -"'".
IntegerLiteral: -Digits.
DecimalLiteral: '.', -Digits;
   -Digits, '.', ['0'-'9']*.
DoubleLiteral: ( '.', -Digits ; -Digits, ( '.', ['0'-'9']* )? ), ['e'; 'E'], -Digits.

-URIQualifiedName: BracedURILiteral, NCName.
BracedURILiteral: 'Q', '{', ~['{';'}']*, '}'.
EscapeQuot: '""'.
EscapeApos: "''".

QNameToken: PrefixedName;  UnprefixedName.
PrefixedName: @Prefix, -':', @LocalPart.
UnprefixedName: LocalPart.
Prefix: NCName.
LocalPart: NCName.
NCName: @Name.

-NameStartChar: ['A'-'Z'];
   '_';
   ['a'-'z'].
-NameChar: NameStartChar;
   '-';
   '.';
   ['0'-'9'].  
Name: NameStartChar, NameChar*.
-s: -' '+.
Wildcard: '*';
   NCName, ':', '*';
   '*', ':', NCName;
   BracedURILiteral, '*'.
Digits: ['0'-'9']+.


Test xpath

The input is a[.!=''] but the grammar does not provide for predicates. So although the input is a perfectly fine XPath expression, it is not a sentence in the language defined by the grammar specified for the test.

Input text
a[.!='']
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
   <!-- <assert-xml-ref href="xpath.output.xml"/> -->
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="284"
        documentParse="0">
</result>
Grammar parse: 284.

Result: PASS

element-content

Input grammar
content: -a, -".".
a: ~["."]*.
Test element-content
Input text
"'<>/&.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="element-content.output.xml"/>
</result>
<content>"'&lt;&gt;/&amp;</content>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <content>"'&lt;&gt;/&amp;</content>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <content>"'&lt;&gt;/&amp;</content>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<content>"'&lt;&gt;/&amp;</content>

empty-group

Input grammar
a: b, (), c.
b: "b".
c: "c".
Test empty-group
Input text
bc
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="empty-group.output.xml"/>
</result>
<a>
   <b>b</b>
   <c>c</c>
</a>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <a>
               <b>b</b>
               <c>c</c>
            </a>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <a>
               <b>b</b>
               <c>c</c>
            </a>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1. Document parse: 1.

Result: PASS

Actual:
<a>
   <b>b</b>
   <c>c</c>
</a>

range-comments

Input grammar
name: letter*.
letter: [{comment}"a"{comment}-{comment}"z"{comment}].
Test range-comments
Input text
name
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="range-comments.output.xml"/>
</result>
<name>
   <letter>n</letter>
   <letter>a</letter>
   <letter>m</letter>
   <letter>e</letter>
</name>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <name>
               <letter>n</letter>
               <letter>a</letter>
               <letter>m</letter>
               <letter>e</letter>
            </name>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <name>
               <letter>n</letter>
               <letter>a</letter>
               <letter>m</letter>
               <letter>e</letter>
            </name>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<name>
   <letter>n</letter>
   <letter>a</letter>
   <letter>m</letter>
   <letter>e</letter>
</name>

ranges

Input grammar
test: other, digit, other, cap, other, lc, other, lf?.
other: ~[#a; #30-#39; #41-#5A; #61-#7A]+.
cap: [#41-#5A]+.
lc: [#61-#7A]+.
digit: [#30-#39]+.
-lf: -#a.
{
0123456789abcdef
 !"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
`abcdefghijklmno
pqrstuvwxyz{|}~
}
Test ranges
Input text
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ranges.output.xml"/>
</result>
<test>
   <other> !"#$%&amp;'()*+,-./</other>
   <digit>0123456789</digit>
   <other>:;&lt;=&gt;?@</other>
   <cap>ABCDEFGHIJKLMNOPQRSTUVWXYZ</cap>
   <other>[\]^_`</other>
   <lc>abcdefghijklmnopqrstuvwxyz</lc>
   <other>{|}~</other>
</test>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="13"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <test>
               <other> !"#$%&amp;'()*+,-./</other>
               <digit>0123456789</digit>
               <other>:;&lt;=&gt;?@</other>
               <cap>ABCDEFGHIJKLMNOPQRSTUVWXYZ</cap>
               <other>[\]^_`</other>
               <lc>abcdefghijklmnopqrstuvwxyz</lc>
               <other>{|}~</other>
            </test>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <test>
               <other> !"#$%&amp;'()*+,-./</other>
               <digit>0123456789</digit>
               <other>:;&lt;=&gt;?@</other>
               <cap>ABCDEFGHIJKLMNOPQRSTUVWXYZ</cap>
               <other>[\]^_`</other>
               <lc>abcdefghijklmnopqrstuvwxyz</lc>
               <other>{|}~</other>
            </test>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 13. Document parse: 1.

Result: PASS

Actual:
<test>
   <other> !"#$%&amp;'()*+,-./</other>
   <digit>0123456789</digit>
   <other>:;&lt;=&gt;?@</other>
   <cap>ABCDEFGHIJKLMNOPQRSTUVWXYZ</cap>
   <other>[\]^_`</other>
   <lc>abcdefghijklmnopqrstuvwxyz</lc>
   <other>{|}~</other>
</test>

ranges1

Input grammar
chars: punctuation, nonpunct?; upper, nonupper?; lower, nonlower?; digit, nondigit?.
-nonpunct: upper, nonupper?; lower, nonlower?; digit, nondigit?.
-nonupper: punctuation, nonpunct?; lower, nonlower?; digit, nondigit?.
-nonlower: punctuation, nonpunct?; upper, nonupper?; digit, nondigit?.
-nondigit: punctuation, nonpunct?; upper, nonupper?; lower, nonlower?.

upper: [#41-#5A]+.
lower: [#61-#7A]+.
digit: [#30-#39]+.
punctuation: ~[#a; #30-#39; #41-#5A; #61-#7A]+.
{-lf: -#a.}
{
0123456789abcdef
 !"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
`abcdefghijklmno
pqrstuvwxyz{|}~
}
Test ranges1
Input text
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ranges1.output.xml"/>
</result>
<chars>
   <punctuation>!"#$%&amp;'()*+,-./</punctuation>
   <digit>0123456789</digit>
   <punctuation>:;&lt;=&gt;?@</punctuation>
   <upper>ABCDEFGHIJKLMNOPQRSTUVWXYZ</upper>
   <punctuation>[\]^_`</punctuation>
   <lower>abcdefghijklmnopqrstuvwxyz</lower>
   <punctuation>{|}~</punctuation>
</chars>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="24"
        documentParse="2">
   <comparison>
      <expected>
         <ns xmlns="">
            <chars>
               <punctuation>!"#$%&amp;'()*+,-./</punctuation>
               <digit>0123456789</digit>
               <punctuation>:;&lt;=&gt;?@</punctuation>
               <upper>ABCDEFGHIJKLMNOPQRSTUVWXYZ</upper>
               <punctuation>[\]^_`</punctuation>
               <lower>abcdefghijklmnopqrstuvwxyz</lower>
               <punctuation>{|}~</punctuation>
            </chars>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <chars>
               <punctuation>!"#$%&amp;'()*+,-./</punctuation>
               <digit>0123456789</digit>
               <punctuation>:;&lt;=&gt;?@</punctuation>
               <upper>ABCDEFGHIJKLMNOPQRSTUVWXYZ</upper>
               <punctuation>[\]^_`</punctuation>
               <lower>abcdefghijklmnopqrstuvwxyz</lower>
               <punctuation>{|}~</punctuation>
            </chars>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 24. Document parse: 2.

Result: PASS

Actual:
<chars>
   <punctuation>!"#$%&amp;'()*+,-./</punctuation>
   <digit>0123456789</digit>
   <punctuation>:;&lt;=&gt;?@</punctuation>
   <upper>ABCDEFGHIJKLMNOPQRSTUVWXYZ</upper>
   <punctuation>[\]^_`</punctuation>
   <lower>abcdefghijklmnopqrstuvwxyz</lower>
   <punctuation>{|}~</punctuation>
</chars>
file:/home/circleci/project/ixml/tests/ixml/test-catalog.xml

Amsterdam Test Suite 1, ixml tests, 2021-12-21

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

ixml-no-spaces

Input grammar
ixml:S,rule++S,S.
-S:(whitespace;comment)*.
-whitespace:-[Zs];tab;lf;cr.
-tab:-#9.
-lf:-#a.
-cr:-#d.
comment:-"{",(cchar;comment)*,-"}".
-cchar:~["{}"].
rule:(mark,S)?,name,S,["=:"],S,-alts,".".
@mark:["@^-"].
alts:alt++([";|"],S).
alt:term**(",",S).
-term:factor;
option;
repeat0;
repeat1.
-factor:terminal;
nonterminal;
"(",S,alts,")",S.
repeat0:factor,"*",S,sep?.
repeat1:factor,"+",S,sep?.
option:factor,"?",S.
sep:factor.
nonterminal:(mark,S)?,name,S.
-terminal:literal;
charset.
literal:quoted;
encoded.
-quoted:(tmark,S)?,-string.
@name:namestart,namefollower*.
-namestart:["_";Ll;Lu;Lm;Lt;Lo].
-namefollower:namestart;["-.·‿⁀";Nd;Mn].
@tmark:["^-"].
string:-'"',dstring,-'"',S;
-"'",sstring,-"'",S.
@dstring:dchar+.
@sstring:schar+.
dchar:~['"'];
'"',-'"'.{allcharacters,quotesmustbedoubled}
schar:~["'"];
"'",-"'".{allcharacters,quotesmustbedoubled}
-encoded:(tmark,S)?,-"#",@hex,S.
hex:["0"-"9";"a"-"f";"A"-"F"]+.
-charset:inclusion;
exclusion.
inclusion:(tmark,S)?,set.
exclusion:(tmark,S)?,"~",S,set.
-set:"[",S,member**([";|"],S),"]",S.
-member:literal;
range;
class.
range:from,"-",S,to.
@from:character.
@to:character.
-character:-'"',dchar,-'"',S;
-"'",schar,-"'",S;
"#",hex,S.
class:@code,S.
code:letter,letter.
-letter:["a"-"z";"A"-"Z"].
Test ixml-no-spaces
Input text
ixml:S,rule+S,S.
-S:(whitespace;comment)*.
-whitespace:-[Zs];tab;{lf;}cr.
-tab:-#9.
{-lf:-#a.}
-cr:-#d.
comment:-"{",(cchar;comment)*,-"}".
-cchar:~["{}"].
rule:(mark,S)?,name,S,["=:"],S,-alts,".".
@mark:["@^-"].
alts:alt+([";|"],S).
alt:term*(",",S).
-term:factor;
option;
repeat0;
repeat1.
-factor:terminal;
nonterminal;
"(",S,alts,")",S.
repeat0:factor,"*",S,sep?.
repeat1:factor,"+",S,sep?.
option:factor,"?",S.
sep:factor.
nonterminal:(mark,S)?,name,S.
-terminal:literal;
charset.
literal:quoted;
encoded.
-quoted:(tmark,S)?,-string.
@name:namestart,namefollower*.
-namestart:["_";Ll;Lu;Lm;Lt;Lo].
-namefollower:namestart;["-.·‿⁀";Nd;Mn].
@tmark:["^-"].
string:-'"',dstring,-'"',S;
-"'",sstring,-"'",S.
@dstring:dchar+.
@sstring:schar+.
dchar:~['"'];
'"',-'"'.{allcharacters,quotesmustbedoubled}
schar:~["'"];
"'",-"'".{allcharacters,quotesmustbedoubled}
-encoded:(tmark,S)?,-"#",@hex,S.
hex:["0"-"9";"a"-"f";"A"-"F"]+.
-charset:inclusion;
exclusion.
inclusion:(tmark,S)?,set.
exclusion:(tmark,S)?,"~",S,set.
-set:"[",S,member*([";|"],S),"]",S.
-member:literal;
range;
class.
range:from,"-",S,to.
@from:character.
@to:character.
-character:-'"',dchar,-'"',S;
-"'",schar,-"'",S;
"#",hex,S.
class:@code,S.
code:letter,letter.
-letter:["a"-"z";"A"-"Z"].
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ixml-no-spaces.output.xml"/>
</result>
<ixml>
   <rule name="ixml">:<alt>
         <nonterminal name="S"/>,<repeat1>
            <nonterminal name="rule"/>+<sep>
               <nonterminal name="S"/>
            </sep>
         </repeat1>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">:<alt>
         <repeat0>(<alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="whitespace">:<alt>
         <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
      </alt>;<alt>
         <nonterminal name="tab"/>
      </alt>;<comment>lf;</comment>
      <alt>
         <nonterminal name="cr"/>
      </alt>.</rule>
   <rule mark="-" name="tab">:<alt>
         <literal tmark="-" hex="9"/>
      </alt>.</rule>
   <comment>-lf:-#a.</comment>
   <rule mark="-" name="cr">:<alt>
         <literal tmark="-" hex="d"/>
      </alt>.</rule>
   <rule name="comment">:<alt>
         <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
      </alt>.</rule>
   <rule mark="-" name="cchar">:<alt>
         <exclusion>~[<literal dstring="{}"/>]</exclusion>
      </alt>.</rule>
   <rule name="rule">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
      </alt>.</rule>
   <rule mark="@" name="mark">:<alt>
         <inclusion>[<literal dstring="@^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="alts">:<alt>
         <repeat1>
            <nonterminal name="alt"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>
      </alt>.</rule>
   <rule name="alt">:<alt>
         <repeat0>
            <nonterminal name="term"/>*<sep>(<alts>
                  <alt>
                     <literal dstring=","/>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>
      </alt>.</rule>
   <rule mark="-" name="term">:<alt>
         <nonterminal name="factor"/>
      </alt>;<alt>
         <nonterminal name="option"/>
      </alt>;<alt>
         <nonterminal name="repeat0"/>
      </alt>;<alt>
         <nonterminal name="repeat1"/>
      </alt>.</rule>
   <rule mark="-" name="factor">:<alt>
         <nonterminal name="terminal"/>
      </alt>;<alt>
         <nonterminal name="nonterminal"/>
      </alt>;<alt>
         <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="repeat0">:<alt>
         <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="repeat1">:<alt>
         <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="option">:<alt>
         <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="sep">:<alt>
         <nonterminal name="factor"/>
      </alt>.</rule>
   <rule name="nonterminal">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="terminal">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="charset"/>
      </alt>.</rule>
   <rule name="literal">:<alt>
         <nonterminal name="quoted"/>
      </alt>;<alt>
         <nonterminal name="encoded"/>
      </alt>.</rule>
   <rule mark="-" name="quoted">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal mark="-" name="string"/>
      </alt>.</rule>
   <rule mark="@" name="name">:<alt>
         <nonterminal name="namestart"/>,<repeat0>
            <nonterminal name="namefollower"/>*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="namestart">:<alt>
         <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
      </alt>.</rule>
   <rule mark="-" name="namefollower">:<alt>
         <nonterminal name="namestart"/>
      </alt>;<alt>
         <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
      </alt>.</rule>
   <rule mark="@" name="tmark">:<alt>
         <inclusion>[<literal dstring="^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="string">:<alt>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
      </alt>;<alt>
         <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule name="schar">:<alt>
         <exclusion>~[<literal dstring="'"/>]</exclusion>
      </alt>;<alt>
         <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule mark="-" name="encoded">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="hex">:<alt>
         <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="charset">:<alt>
         <nonterminal name="inclusion"/>
      </alt>;<alt>
         <nonterminal name="exclusion"/>
      </alt>.</rule>
   <rule name="inclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule name="exclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule mark="-" name="set">:<alt>
         <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
            <nonterminal name="member"/>*<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="member">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="range"/>
      </alt>;<alt>
         <nonterminal name="class"/>
      </alt>.</rule>
   <rule name="range">:<alt>
         <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="class">:<alt>
         <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="code">:<alt>
         <nonterminal name="letter"/>,<nonterminal name="letter"/>
      </alt>.</rule>
   <rule mark="-" name="letter">:<alt>
         <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
      </alt>.</rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="33"
        documentParse="30">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">:<alt>
                     <nonterminal name="S"/>,<repeat1>
                        <nonterminal name="rule"/>+<sep>
                           <nonterminal name="S"/>
                        </sep>
                     </repeat1>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">:<alt>
                     <repeat0>(<alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="whitespace">:<alt>
                     <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
                  </alt>;<alt>
                     <nonterminal name="tab"/>
                  </alt>;<comment>lf;</comment>
                  <alt>
                     <nonterminal name="cr"/>
                  </alt>.</rule>
               <rule mark="-" name="tab">:<alt>
                     <literal tmark="-" hex="9"/>
                  </alt>.</rule>
               <comment>-lf:-#a.</comment>
               <rule mark="-" name="cr">:<alt>
                     <literal tmark="-" hex="d"/>
                  </alt>.</rule>
               <rule name="comment">:<alt>
                     <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
                  </alt>.</rule>
               <rule mark="-" name="cchar">:<alt>
                     <exclusion>~[<literal dstring="{}"/>]</exclusion>
                  </alt>.</rule>
               <rule name="rule">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
                  </alt>.</rule>
               <rule mark="@" name="mark">:<alt>
                     <inclusion>[<literal dstring="@^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="alts">:<alt>
                     <repeat1>
                        <nonterminal name="alt"/>+<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat1>
                  </alt>.</rule>
               <rule name="alt">:<alt>
                     <repeat0>
                        <nonterminal name="term"/>*<sep>(<alts>
                              <alt>
                                 <literal dstring=","/>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>
                  </alt>.</rule>
               <rule mark="-" name="term">:<alt>
                     <nonterminal name="factor"/>
                  </alt>;<alt>
                     <nonterminal name="option"/>
                  </alt>;<alt>
                     <nonterminal name="repeat0"/>
                  </alt>;<alt>
                     <nonterminal name="repeat1"/>
                  </alt>.</rule>
               <rule mark="-" name="factor">:<alt>
                     <nonterminal name="terminal"/>
                  </alt>;<alt>
                     <nonterminal name="nonterminal"/>
                  </alt>;<alt>
                     <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="repeat0">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="repeat1">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="option">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="sep">:<alt>
                     <nonterminal name="factor"/>
                  </alt>.</rule>
               <rule name="nonterminal">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="terminal">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="charset"/>
                  </alt>.</rule>
               <rule name="literal">:<alt>
                     <nonterminal name="quoted"/>
                  </alt>;<alt>
                     <nonterminal name="encoded"/>
                  </alt>.</rule>
               <rule mark="-" name="quoted">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal mark="-" name="string"/>
                  </alt>.</rule>
               <rule mark="@" name="name">:<alt>
                     <nonterminal name="namestart"/>,<repeat0>
                        <nonterminal name="namefollower"/>*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="namestart">:<alt>
                     <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="-" name="namefollower">:<alt>
                     <nonterminal name="namestart"/>
                  </alt>;<alt>
                     <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="@" name="tmark">:<alt>
                     <inclusion>[<literal dstring="^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="string">:<alt>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
                  </alt>;<alt>
                     <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule name="schar">:<alt>
                     <exclusion>~[<literal dstring="'"/>]</exclusion>
                  </alt>;<alt>
                     <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule mark="-" name="encoded">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="hex">:<alt>
                     <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="charset">:<alt>
                     <nonterminal name="inclusion"/>
                  </alt>;<alt>
                     <nonterminal name="exclusion"/>
                  </alt>.</rule>
               <rule name="inclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule name="exclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule mark="-" name="set">:<alt>
                     <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
                        <nonterminal name="member"/>*<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="member">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="range"/>
                  </alt>;<alt>
                     <nonterminal name="class"/>
                  </alt>.</rule>
               <rule name="range">:<alt>
                     <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="class">:<alt>
                     <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="code">:<alt>
                     <nonterminal name="letter"/>,<nonterminal name="letter"/>
                  </alt>.</rule>
               <rule mark="-" name="letter">:<alt>
                     <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
                  </alt>.</rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">:<alt>
                     <nonterminal name="S"/>,<repeat1>
                        <nonterminal name="rule"/>+<sep>
                           <nonterminal name="S"/>
                        </sep>
                     </repeat1>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">:<alt>
                     <repeat0>(<alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="whitespace">:<alt>
                     <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
                  </alt>;<alt>
                     <nonterminal name="tab"/>
                  </alt>;<comment>lf;</comment>
                  <alt>
                     <nonterminal name="cr"/>
                  </alt>.</rule>
               <rule mark="-" name="tab">:<alt>
                     <literal tmark="-" hex="9"/>
                  </alt>.</rule>
               <comment>-lf:-#a.</comment>
               <rule mark="-" name="cr">:<alt>
                     <literal tmark="-" hex="d"/>
                  </alt>.</rule>
               <rule name="comment">:<alt>
                     <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
                  </alt>.</rule>
               <rule mark="-" name="cchar">:<alt>
                     <exclusion>~[<literal dstring="{}"/>]</exclusion>
                  </alt>.</rule>
               <rule name="rule">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
                  </alt>.</rule>
               <rule mark="@" name="mark">:<alt>
                     <inclusion>[<literal dstring="@^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="alts">:<alt>
                     <repeat1>
                        <nonterminal name="alt"/>+<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat1>
                  </alt>.</rule>
               <rule name="alt">:<alt>
                     <repeat0>
                        <nonterminal name="term"/>*<sep>(<alts>
                              <alt>
                                 <literal dstring=","/>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>
                  </alt>.</rule>
               <rule mark="-" name="term">:<alt>
                     <nonterminal name="factor"/>
                  </alt>;<alt>
                     <nonterminal name="option"/>
                  </alt>;<alt>
                     <nonterminal name="repeat0"/>
                  </alt>;<alt>
                     <nonterminal name="repeat1"/>
                  </alt>.</rule>
               <rule mark="-" name="factor">:<alt>
                     <nonterminal name="terminal"/>
                  </alt>;<alt>
                     <nonterminal name="nonterminal"/>
                  </alt>;<alt>
                     <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="repeat0">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="repeat1">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="option">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="sep">:<alt>
                     <nonterminal name="factor"/>
                  </alt>.</rule>
               <rule name="nonterminal">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="terminal">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="charset"/>
                  </alt>.</rule>
               <rule name="literal">:<alt>
                     <nonterminal name="quoted"/>
                  </alt>;<alt>
                     <nonterminal name="encoded"/>
                  </alt>.</rule>
               <rule mark="-" name="quoted">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal mark="-" name="string"/>
                  </alt>.</rule>
               <rule mark="@" name="name">:<alt>
                     <nonterminal name="namestart"/>,<repeat0>
                        <nonterminal name="namefollower"/>*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="namestart">:<alt>
                     <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="-" name="namefollower">:<alt>
                     <nonterminal name="namestart"/>
                  </alt>;<alt>
                     <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="@" name="tmark">:<alt>
                     <inclusion>[<literal dstring="^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="string">:<alt>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
                  </alt>;<alt>
                     <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule name="schar">:<alt>
                     <exclusion>~[<literal dstring="'"/>]</exclusion>
                  </alt>;<alt>
                     <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule mark="-" name="encoded">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="hex">:<alt>
                     <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="charset">:<alt>
                     <nonterminal name="inclusion"/>
                  </alt>;<alt>
                     <nonterminal name="exclusion"/>
                  </alt>.</rule>
               <rule name="inclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule name="exclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule mark="-" name="set">:<alt>
                     <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
                        <nonterminal name="member"/>*<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="member">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="range"/>
                  </alt>;<alt>
                     <nonterminal name="class"/>
                  </alt>.</rule>
               <rule name="range">:<alt>
                     <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="class">:<alt>
                     <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="code">:<alt>
                     <nonterminal name="letter"/>,<nonterminal name="letter"/>
                  </alt>.</rule>
               <rule mark="-" name="letter">:<alt>
                     <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
                  </alt>.</rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 33. Document parse: 30.

Result: PASS

Actual:
<ixml>
   <rule name="ixml">:<alt>
         <nonterminal name="S"/>,<repeat1>
            <nonterminal name="rule"/>+<sep>
               <nonterminal name="S"/>
            </sep>
         </repeat1>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">:<alt>
         <repeat0>(<alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="whitespace">:<alt>
         <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
      </alt>;<alt>
         <nonterminal name="tab"/>
      </alt>;<comment>lf;</comment>
      <alt>
         <nonterminal name="cr"/>
      </alt>.</rule>
   <rule mark="-" name="tab">:<alt>
         <literal tmark="-" hex="9"/>
      </alt>.</rule>
   <comment>-lf:-#a.</comment>
   <rule mark="-" name="cr">:<alt>
         <literal tmark="-" hex="d"/>
      </alt>.</rule>
   <rule name="comment">:<alt>
         <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
      </alt>.</rule>
   <rule mark="-" name="cchar">:<alt>
         <exclusion>~[<literal dstring="{}"/>]</exclusion>
      </alt>.</rule>
   <rule name="rule">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
      </alt>.</rule>
   <rule mark="@" name="mark">:<alt>
         <inclusion>[<literal dstring="@^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="alts">:<alt>
         <repeat1>
            <nonterminal name="alt"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>
      </alt>.</rule>
   <rule name="alt">:<alt>
         <repeat0>
            <nonterminal name="term"/>*<sep>(<alts>
                  <alt>
                     <literal dstring=","/>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>
      </alt>.</rule>
   <rule mark="-" name="term">:<alt>
         <nonterminal name="factor"/>
      </alt>;<alt>
         <nonterminal name="option"/>
      </alt>;<alt>
         <nonterminal name="repeat0"/>
      </alt>;<alt>
         <nonterminal name="repeat1"/>
      </alt>.</rule>
   <rule mark="-" name="factor">:<alt>
         <nonterminal name="terminal"/>
      </alt>;<alt>
         <nonterminal name="nonterminal"/>
      </alt>;<alt>
         <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="repeat0">:<alt>
         <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="repeat1">:<alt>
         <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="option">:<alt>
         <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="sep">:<alt>
         <nonterminal name="factor"/>
      </alt>.</rule>
   <rule name="nonterminal">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="terminal">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="charset"/>
      </alt>.</rule>
   <rule name="literal">:<alt>
         <nonterminal name="quoted"/>
      </alt>;<alt>
         <nonterminal name="encoded"/>
      </alt>.</rule>
   <rule mark="-" name="quoted">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal mark="-" name="string"/>
      </alt>.</rule>
   <rule mark="@" name="name">:<alt>
         <nonterminal name="namestart"/>,<repeat0>
            <nonterminal name="namefollower"/>*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="namestart">:<alt>
         <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
      </alt>.</rule>
   <rule mark="-" name="namefollower">:<alt>
         <nonterminal name="namestart"/>
      </alt>;<alt>
         <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
      </alt>.</rule>
   <rule mark="@" name="tmark">:<alt>
         <inclusion>[<literal dstring="^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="string">:<alt>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
      </alt>;<alt>
         <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule name="schar">:<alt>
         <exclusion>~[<literal dstring="'"/>]</exclusion>
      </alt>;<alt>
         <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule mark="-" name="encoded">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="hex">:<alt>
         <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="charset">:<alt>
         <nonterminal name="inclusion"/>
      </alt>;<alt>
         <nonterminal name="exclusion"/>
      </alt>.</rule>
   <rule name="inclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule name="exclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule mark="-" name="set">:<alt>
         <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
            <nonterminal name="member"/>*<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="member">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="range"/>
      </alt>;<alt>
         <nonterminal name="class"/>
      </alt>.</rule>
   <rule name="range">:<alt>
         <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="class">:<alt>
         <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="code">:<alt>
         <nonterminal name="letter"/>,<nonterminal name="letter"/>
      </alt>.</rule>
   <rule mark="-" name="letter">:<alt>
         <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
      </alt>.</rule>
</ixml>

bnf

Input grammar
ixml: S, rules.
-rules: rule; rule, rules.
rule: mark, name, S, -"::=", S, def;
      name, S, -"::=", S, def.
def: alts.
-alts: alt; alt, -"|", S, alts.
alt: terms; empty.
-terms: term; term, terms.
empty: .
term: mark, name, S; name, S; string, S; range.
@name: -"<", letters, -">".
@mark: "@", S; "^", S; "-", S.
letters: letter, more-letters.
letter: ["a"-"z"]; ["A"-"Z"]; ["0"-"9"].
more-letters: letter, more-letters; "-", more-letters; .
@string: -"""", chars, -"""".
chars: char, chars; char.
char: [" "-"!"]; ["#"-"~"]; -'"', '"'. {all characters, quotes must be doubled}
range: -"[", S,  from, S, -"-", S, to, S, -"]", S.
@from: character.
@to: character.
-character: -"""", char, -""""; -"""", """", -"""", -"""".
-S: -[" "; #a], S; comment, S; .
comment: "{", schars, "}".
-schars: schar, schars; .
-schar: [" "-"|"]; "~". {Everything except: }
Test bnf
Input text
<ixml>::= <S> <rules>
-<rules>::= <rule> | <rule> <rules>
<rule>::= <mark> <name> "::=" <S> <def> |
      <name> "::=" <S> <def>
<def>::= <alts>
-<alts>::= <alt> | <alt> "|" <S> <alts>
<alt>::= <terms> | <empty>
-<terms>::= <term> | <term> <S> <terms>
<empty>::= 
<term>::= <mark> <name> | <name> | <string> | <range>
@<name>::= "<" <letters> ">" <S>
@<mark>::= "@" <S> | "^" <S> | "-" <S>
<letters>::= <letter> <more-letters>
<letter>::= ["a"-"z"] | ["A"-"Z"] | ["0"-"9"]
<more-letters>::= <letter> <more-letters> | "-" <more-letters> | <empty>
@<string>::= """" <chars> """" <S>
<chars>::= <char> <chars> | <char>
<char>::= [" "-"!"] | ["#"-"~"] | """""" {all characters, quotes must be doubled}
<range>::= "[" <S>  <character> <S> "-" <S> <character> <S> "]" <S>
-<character>::= """" <char> """" | """" """" """" """"
-<S>::= " " <S> | <comment> <S> | 
<comment>::= "{" <schars> "}"
-<schars>::= <schar> <schars> | 
-<schar>::= [" "-"|"] | "~" {Everything except: }
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="bnf.output.xml"/>
</result>
<ixml>
   <rule name="ixml">
      <def>
         <alt>
            <term name="S"/>
            <term name="rules"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="rules">
      <def>
         <alt>
            <term name="rule"/>
         </alt>
         <alt>
            <term name="rule"/>
            <term name="rules"/>
         </alt>
      </def>
   </rule>
   <rule name="rule">
      <def>
         <alt>
            <term name="mark"/>
            <term name="name"/>
            <term string="::="/>
            <term name="S"/>
            <term name="def"/>
         </alt>
         <alt>
            <term name="name"/>
            <term string="::="/>
            <term name="S"/>
            <term name="def"/>
         </alt>
      </def>
   </rule>
   <rule name="def">
      <def>
         <alt>
            <term name="alts"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="alts">
      <def>
         <alt>
            <term name="alt"/>
         </alt>
         <alt>
            <term name="alt"/>
            <term string="|"/>
            <term name="S"/>
            <term name="alts"/>
         </alt>
      </def>
   </rule>
   <rule name="alt">
      <def>
         <alt>
            <term name="terms"/>
         </alt>
         <alt>
            <term name="empty"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="terms">
      <def>
         <alt>
            <term name="term"/>
         </alt>
         <alt>
            <term name="term"/>
            <term name="S"/>
            <term name="terms"/>
         </alt>
      </def>
   </rule>
   <rule name="empty">
      <def>
         <alt>
            <empty/>
         </alt>
      </def>
   </rule>
   <rule name="term">
      <def>
         <alt>
            <term name="mark"/>
            <term name="name"/>
         </alt>
         <alt>
            <term name="name"/>
         </alt>
         <alt>
            <term name="string"/>
         </alt>
         <alt>
            <term name="range"/>
         </alt>
      </def>
   </rule>
   <rule mark="@" name="name">
      <def>
         <alt>
            <term string="&lt;"/>
            <term name="letters"/>
            <term string="&gt;"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule mark="@" name="mark">
      <def>
         <alt>
            <term string="@"/>
            <term name="S"/>
         </alt>
         <alt>
            <term string="^"/>
            <term name="S"/>
         </alt>
         <alt>
            <term string="-"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule name="letters">
      <def>
         <alt>
            <term name="letter"/>
            <term name="more-letters"/>
         </alt>
      </def>
   </rule>
   <rule name="letter">
      <def>
         <alt>
            <term>
               <range from="a" to="z"/>
            </term>
         </alt>
         <alt>
            <term>
               <range from="A" to="Z"/>
            </term>
         </alt>
         <alt>
            <term>
               <range from="0" to="9"/>
            </term>
         </alt>
      </def>
   </rule>
   <rule name="more-letters">
      <def>
         <alt>
            <term name="letter"/>
            <term name="more-letters"/>
         </alt>
         <alt>
            <term string="-"/>
            <term name="more-letters"/>
         </alt>
         <alt>
            <term name="empty"/>
         </alt>
      </def>
   </rule>
   <rule mark="@" name="string">
      <def>
         <alt>
            <term string="&#34;"/>
            <term name="chars"/>
            <term string="&#34;"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule name="chars">
      <def>
         <alt>
            <term name="char"/>
            <term name="chars"/>
         </alt>
         <alt>
            <term name="char"/>
         </alt>
      </def>
   </rule>
   <rule name="char">
      <def>
         <alt>
            <term>
               <range from=" " to="!"/>
            </term>
         </alt>
         <alt>
            <term>
               <range from="#" to="~"/>
            </term>
         </alt>
         <alt>
            <term string="&#34;&#34;">
               <comment>{all characters, quotes must be doubled}</comment>
            </term>
         </alt>
      </def>
   </rule>
   <rule name="range">
      <def>
         <alt>
            <term string="["/>
            <term name="S"/>
            <term name="character"/>
            <term name="S"/>
            <term string="-"/>
            <term name="S"/>
            <term name="character"/>
            <term name="S"/>
            <term string="]"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="character">
      <def>
         <alt>
            <term string="&#34;"/>
            <term name="char"/>
            <term string="&#34;"/>
         </alt>
         <alt>
            <term string="&#34;"/>
            <term string="&#34;"/>
            <term string="&#34;"/>
            <term string="&#34;"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="S">
      <def>
         <alt>
            <term string=" "/>
            <term name="S"/>
         </alt>
         <alt>
            <term name="comment"/>
            <term name="S"/>
         </alt>
         <alt>
            <empty/>
         </alt>
      </def>
   </rule>
   <rule name="comment">
      <def>
         <alt>
            <term string="{"/>
            <term name="schars"/>
            <term string="}"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="schars">
      <def>
         <alt>
            <term name="schar"/>
            <term name="schars"/>
         </alt>
         <alt>
            <empty/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="schar">
      <def>
         <alt>
            <term>
               <range from=" " to="|"/>
            </term>
         </alt>
         <alt>
            <term string="~">
               <comment>{Everything except: }</comment>
            </term>
         </alt>
      </def>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="22"
        documentParse="10">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">
                  <def>
                     <alt>
                        <term name="S"/>
                        <term name="rules"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="rules">
                  <def>
                     <alt>
                        <term name="rule"/>
                     </alt>
                     <alt>
                        <term name="rule"/>
                        <term name="rules"/>
                     </alt>
                  </def>
               </rule>
               <rule name="rule">
                  <def>
                     <alt>
                        <term name="mark"/>
                        <term name="name"/>
                        <term string="::="/>
                        <term name="S"/>
                        <term name="def"/>
                     </alt>
                     <alt>
                        <term name="name"/>
                        <term string="::="/>
                        <term name="S"/>
                        <term name="def"/>
                     </alt>
                  </def>
               </rule>
               <rule name="def">
                  <def>
                     <alt>
                        <term name="alts"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="alts">
                  <def>
                     <alt>
                        <term name="alt"/>
                     </alt>
                     <alt>
                        <term name="alt"/>
                        <term string="|"/>
                        <term name="S"/>
                        <term name="alts"/>
                     </alt>
                  </def>
               </rule>
               <rule name="alt">
                  <def>
                     <alt>
                        <term name="terms"/>
                     </alt>
                     <alt>
                        <term name="empty"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="terms">
                  <def>
                     <alt>
                        <term name="term"/>
                     </alt>
                     <alt>
                        <term name="term"/>
                        <term name="S"/>
                        <term name="terms"/>
                     </alt>
                  </def>
               </rule>
               <rule name="empty">
                  <def>
                     <alt>
                        <empty/>
                     </alt>
                  </def>
               </rule>
               <rule name="term">
                  <def>
                     <alt>
                        <term name="mark"/>
                        <term name="name"/>
                     </alt>
                     <alt>
                        <term name="name"/>
                     </alt>
                     <alt>
                        <term name="string"/>
                     </alt>
                     <alt>
                        <term name="range"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="@" name="name">
                  <def>
                     <alt>
                        <term string="&lt;"/>
                        <term name="letters"/>
                        <term string="&gt;"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="@" name="mark">
                  <def>
                     <alt>
                        <term string="@"/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <term string="^"/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <term string="-"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule name="letters">
                  <def>
                     <alt>
                        <term name="letter"/>
                        <term name="more-letters"/>
                     </alt>
                  </def>
               </rule>
               <rule name="letter">
                  <def>
                     <alt>
                        <term>
                           <range from="a" to="z"/>
                        </term>
                     </alt>
                     <alt>
                        <term>
                           <range from="A" to="Z"/>
                        </term>
                     </alt>
                     <alt>
                        <term>
                           <range from="0" to="9"/>
                        </term>
                     </alt>
                  </def>
               </rule>
               <rule name="more-letters">
                  <def>
                     <alt>
                        <term name="letter"/>
                        <term name="more-letters"/>
                     </alt>
                     <alt>
                        <term string="-"/>
                        <term name="more-letters"/>
                     </alt>
                     <alt>
                        <term name="empty"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="@" name="string">
                  <def>
                     <alt>
                        <term string="&#34;"/>
                        <term name="chars"/>
                        <term string="&#34;"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule name="chars">
                  <def>
                     <alt>
                        <term name="char"/>
                        <term name="chars"/>
                     </alt>
                     <alt>
                        <term name="char"/>
                     </alt>
                  </def>
               </rule>
               <rule name="char">
                  <def>
                     <alt>
                        <term>
                           <range from=" " to="!"/>
                        </term>
                     </alt>
                     <alt>
                        <term>
                           <range from="#" to="~"/>
                        </term>
                     </alt>
                     <alt>
                        <term string="&#34;&#34;">
                           <comment>{all characters, quotes must be doubled}</comment>
                        </term>
                     </alt>
                  </def>
               </rule>
               <rule name="range">
                  <def>
                     <alt>
                        <term string="["/>
                        <term name="S"/>
                        <term name="character"/>
                        <term name="S"/>
                        <term string="-"/>
                        <term name="S"/>
                        <term name="character"/>
                        <term name="S"/>
                        <term string="]"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="character">
                  <def>
                     <alt>
                        <term string="&#34;"/>
                        <term name="char"/>
                        <term string="&#34;"/>
                     </alt>
                     <alt>
                        <term string="&#34;"/>
                        <term string="&#34;"/>
                        <term string="&#34;"/>
                        <term string="&#34;"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="S">
                  <def>
                     <alt>
                        <term string=" "/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <term name="comment"/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <empty/>
                     </alt>
                  </def>
               </rule>
               <rule name="comment">
                  <def>
                     <alt>
                        <term string="{"/>
                        <term name="schars"/>
                        <term string="}"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="schars">
                  <def>
                     <alt>
                        <term name="schar"/>
                        <term name="schars"/>
                     </alt>
                     <alt>
                        <empty/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="schar">
                  <def>
                     <alt>
                        <term>
                           <range from=" " to="|"/>
                        </term>
                     </alt>
                     <alt>
                        <term string="~">
                           <comment>{Everything except: }</comment>
                        </term>
                     </alt>
                  </def>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">
                  <def>
                     <alt>
                        <term name="S"/>
                        <term name="rules"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="rules">
                  <def>
                     <alt>
                        <term name="rule"/>
                     </alt>
                     <alt>
                        <term name="rule"/>
                        <term name="rules"/>
                     </alt>
                  </def>
               </rule>
               <rule name="rule">
                  <def>
                     <alt>
                        <term name="mark"/>
                        <term name="name"/>
                        <term string="::="/>
                        <term name="S"/>
                        <term name="def"/>
                     </alt>
                     <alt>
                        <term name="name"/>
                        <term string="::="/>
                        <term name="S"/>
                        <term name="def"/>
                     </alt>
                  </def>
               </rule>
               <rule name="def">
                  <def>
                     <alt>
                        <term name="alts"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="alts">
                  <def>
                     <alt>
                        <term name="alt"/>
                     </alt>
                     <alt>
                        <term name="alt"/>
                        <term string="|"/>
                        <term name="S"/>
                        <term name="alts"/>
                     </alt>
                  </def>
               </rule>
               <rule name="alt">
                  <def>
                     <alt>
                        <term name="terms"/>
                     </alt>
                     <alt>
                        <term name="empty"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="terms">
                  <def>
                     <alt>
                        <term name="term"/>
                     </alt>
                     <alt>
                        <term name="term"/>
                        <term name="S"/>
                        <term name="terms"/>
                     </alt>
                  </def>
               </rule>
               <rule name="empty">
                  <def>
                     <alt>
                        <empty/>
                     </alt>
                  </def>
               </rule>
               <rule name="term">
                  <def>
                     <alt>
                        <term name="mark"/>
                        <term name="name"/>
                     </alt>
                     <alt>
                        <term name="name"/>
                     </alt>
                     <alt>
                        <term name="string"/>
                     </alt>
                     <alt>
                        <term name="range"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="@" name="name">
                  <def>
                     <alt>
                        <term string="&lt;"/>
                        <term name="letters"/>
                        <term string="&gt;"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="@" name="mark">
                  <def>
                     <alt>
                        <term string="@"/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <term string="^"/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <term string="-"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule name="letters">
                  <def>
                     <alt>
                        <term name="letter"/>
                        <term name="more-letters"/>
                     </alt>
                  </def>
               </rule>
               <rule name="letter">
                  <def>
                     <alt>
                        <term>
                           <range from="a" to="z"/>
                        </term>
                     </alt>
                     <alt>
                        <term>
                           <range from="A" to="Z"/>
                        </term>
                     </alt>
                     <alt>
                        <term>
                           <range from="0" to="9"/>
                        </term>
                     </alt>
                  </def>
               </rule>
               <rule name="more-letters">
                  <def>
                     <alt>
                        <term name="letter"/>
                        <term name="more-letters"/>
                     </alt>
                     <alt>
                        <term string="-"/>
                        <term name="more-letters"/>
                     </alt>
                     <alt>
                        <term name="empty"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="@" name="string">
                  <def>
                     <alt>
                        <term string="&#34;"/>
                        <term name="chars"/>
                        <term string="&#34;"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule name="chars">
                  <def>
                     <alt>
                        <term name="char"/>
                        <term name="chars"/>
                     </alt>
                     <alt>
                        <term name="char"/>
                     </alt>
                  </def>
               </rule>
               <rule name="char">
                  <def>
                     <alt>
                        <term>
                           <range from=" " to="!"/>
                        </term>
                     </alt>
                     <alt>
                        <term>
                           <range from="#" to="~"/>
                        </term>
                     </alt>
                     <alt>
                        <term string="&#34;&#34;">
                           <comment>{all characters, quotes must be doubled}</comment>
                        </term>
                     </alt>
                  </def>
               </rule>
               <rule name="range">
                  <def>
                     <alt>
                        <term string="["/>
                        <term name="S"/>
                        <term name="character"/>
                        <term name="S"/>
                        <term string="-"/>
                        <term name="S"/>
                        <term name="character"/>
                        <term name="S"/>
                        <term string="]"/>
                        <term name="S"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="character">
                  <def>
                     <alt>
                        <term string="&#34;"/>
                        <term name="char"/>
                        <term string="&#34;"/>
                     </alt>
                     <alt>
                        <term string="&#34;"/>
                        <term string="&#34;"/>
                        <term string="&#34;"/>
                        <term string="&#34;"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="S">
                  <def>
                     <alt>
                        <term string=" "/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <term name="comment"/>
                        <term name="S"/>
                     </alt>
                     <alt>
                        <empty/>
                     </alt>
                  </def>
               </rule>
               <rule name="comment">
                  <def>
                     <alt>
                        <term string="{"/>
                        <term name="schars"/>
                        <term string="}"/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="schars">
                  <def>
                     <alt>
                        <term name="schar"/>
                        <term name="schars"/>
                     </alt>
                     <alt>
                        <empty/>
                     </alt>
                  </def>
               </rule>
               <rule mark="-" name="schar">
                  <def>
                     <alt>
                        <term>
                           <range from=" " to="|"/>
                        </term>
                     </alt>
                     <alt>
                        <term string="~">
                           <comment>{Everything except: }</comment>
                        </term>
                     </alt>
                  </def>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 22. Document parse: 10.

Result: PASS

Actual:
<ixml>
   <rule name="ixml">
      <def>
         <alt>
            <term name="S"/>
            <term name="rules"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="rules">
      <def>
         <alt>
            <term name="rule"/>
         </alt>
         <alt>
            <term name="rule"/>
            <term name="rules"/>
         </alt>
      </def>
   </rule>
   <rule name="rule">
      <def>
         <alt>
            <term name="mark"/>
            <term name="name"/>
            <term string="::="/>
            <term name="S"/>
            <term name="def"/>
         </alt>
         <alt>
            <term name="name"/>
            <term string="::="/>
            <term name="S"/>
            <term name="def"/>
         </alt>
      </def>
   </rule>
   <rule name="def">
      <def>
         <alt>
            <term name="alts"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="alts">
      <def>
         <alt>
            <term name="alt"/>
         </alt>
         <alt>
            <term name="alt"/>
            <term string="|"/>
            <term name="S"/>
            <term name="alts"/>
         </alt>
      </def>
   </rule>
   <rule name="alt">
      <def>
         <alt>
            <term name="terms"/>
         </alt>
         <alt>
            <term name="empty"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="terms">
      <def>
         <alt>
            <term name="term"/>
         </alt>
         <alt>
            <term name="term"/>
            <term name="S"/>
            <term name="terms"/>
         </alt>
      </def>
   </rule>
   <rule name="empty">
      <def>
         <alt>
            <empty/>
         </alt>
      </def>
   </rule>
   <rule name="term">
      <def>
         <alt>
            <term name="mark"/>
            <term name="name"/>
         </alt>
         <alt>
            <term name="name"/>
         </alt>
         <alt>
            <term name="string"/>
         </alt>
         <alt>
            <term name="range"/>
         </alt>
      </def>
   </rule>
   <rule mark="@" name="name">
      <def>
         <alt>
            <term string="&lt;"/>
            <term name="letters"/>
            <term string="&gt;"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule mark="@" name="mark">
      <def>
         <alt>
            <term string="@"/>
            <term name="S"/>
         </alt>
         <alt>
            <term string="^"/>
            <term name="S"/>
         </alt>
         <alt>
            <term string="-"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule name="letters">
      <def>
         <alt>
            <term name="letter"/>
            <term name="more-letters"/>
         </alt>
      </def>
   </rule>
   <rule name="letter">
      <def>
         <alt>
            <term>
               <range from="a" to="z"/>
            </term>
         </alt>
         <alt>
            <term>
               <range from="A" to="Z"/>
            </term>
         </alt>
         <alt>
            <term>
               <range from="0" to="9"/>
            </term>
         </alt>
      </def>
   </rule>
   <rule name="more-letters">
      <def>
         <alt>
            <term name="letter"/>
            <term name="more-letters"/>
         </alt>
         <alt>
            <term string="-"/>
            <term name="more-letters"/>
         </alt>
         <alt>
            <term name="empty"/>
         </alt>
      </def>
   </rule>
   <rule mark="@" name="string">
      <def>
         <alt>
            <term string="&#34;"/>
            <term name="chars"/>
            <term string="&#34;"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule name="chars">
      <def>
         <alt>
            <term name="char"/>
            <term name="chars"/>
         </alt>
         <alt>
            <term name="char"/>
         </alt>
      </def>
   </rule>
   <rule name="char">
      <def>
         <alt>
            <term>
               <range from=" " to="!"/>
            </term>
         </alt>
         <alt>
            <term>
               <range from="#" to="~"/>
            </term>
         </alt>
         <alt>
            <term string="&#34;&#34;">
               <comment>{all characters, quotes must be doubled}</comment>
            </term>
         </alt>
      </def>
   </rule>
   <rule name="range">
      <def>
         <alt>
            <term string="["/>
            <term name="S"/>
            <term name="character"/>
            <term name="S"/>
            <term string="-"/>
            <term name="S"/>
            <term name="character"/>
            <term name="S"/>
            <term string="]"/>
            <term name="S"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="character">
      <def>
         <alt>
            <term string="&#34;"/>
            <term name="char"/>
            <term string="&#34;"/>
         </alt>
         <alt>
            <term string="&#34;"/>
            <term string="&#34;"/>
            <term string="&#34;"/>
            <term string="&#34;"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="S">
      <def>
         <alt>
            <term string=" "/>
            <term name="S"/>
         </alt>
         <alt>
            <term name="comment"/>
            <term name="S"/>
         </alt>
         <alt>
            <empty/>
         </alt>
      </def>
   </rule>
   <rule name="comment">
      <def>
         <alt>
            <term string="{"/>
            <term name="schars"/>
            <term string="}"/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="schars">
      <def>
         <alt>
            <term name="schar"/>
            <term name="schars"/>
         </alt>
         <alt>
            <empty/>
         </alt>
      </def>
   </rule>
   <rule mark="-" name="schar">
      <def>
         <alt>
            <term>
               <range from=" " to="|"/>
            </term>
         </alt>
         <alt>
            <term string="~">
               <comment>{Everything except: }</comment>
            </term>
         </alt>
      </def>
   </rule>
</ixml>

ixml-one-line

Input grammar
ixml:S,rule++S,S. -S:(whitespace;comment)*. -whitespace:-[Zs];tab;lf;cr. -tab:-#9. -lf:-#a. -cr:-#d. comment:-"{",(cchar;comment)*,-"}". -cchar:~["{}"]. rule:(mark,S)?,name,S,["=:"],S,-alts,".". @mark:["@^-"]. alts:alt++([";|"],S). alt:term**(",",S). -term:factor;option;repeat0;repeat1. -factor:terminal;nonterminal;"(",S,alts,")",S. repeat0:factor,"*",S,sep?. repeat1:factor,"+",S,sep?. option:factor,"?",S. sep:factor. nonterminal:(mark,S)?,name,S. -terminal:literal;charset. literal:quoted;encoded. -quoted:(tmark,S)?,-string. @name:namestart,namefollower*. -namestart:["_";Ll;Lu;Lm;Lt;Lo]. -namefollower:namestart;["-.·‿⁀";Nd;Mn]. @tmark:["^-"]. string:-'"',dstring,-'"',S;-"'",sstring,-"'",S. @dstring:dchar+. @sstring:schar+. dchar:~['"'];'"',-'"'. {allcharacters,quotesmustbedoubled}schar:~["'"];"'",-"'". {allcharacters,quotesmustbedoubled}-encoded:(tmark,S)?,-"#",@hex,S. hex:["0"-"9";"a"-"f";"A"-"F"]+. -charset:inclusion;exclusion. inclusion:(tmark,S)?,set. exclusion:(tmark,S)?,"~",S,set. -set:"[",S,member**([";|"],S),"]",S. -member:literal;range;class. range:from,"-",S,to. @from:character. @to:character. -character:-'"',dchar,-'"',S;-"'",schar,-"'",S;"#",hex,S. class:@code,S. code:letter,letter. -letter:["a"-"z";"A"-"Z"].
Test ixml-one-line

Note that the input and the grammar are the same.

The expected result supplied in tests.zip cannot be right: it excludes the delimiter characters like ":" and ",", although they are not marked hidden in the grammar, and it marks whitespace as "s", not as "S". It appears to be parsing the input with a different grammar more like the current ixml grammar. It has been replaced by output thought correct. However, the old file has been left in place, in case of disputes over correctness.

The comment text "allcharacters,quotesmustbedoubled" looks like a possible error, but the comments in the input are also missing inter-word spaces.

Input text
ixml:S,rule+S,S.-S:(whitespace;comment)*.-whitespace:-[Zs];tab;lf;cr.-tab:-#9.-lf:-#a.-cr:-#d.comment:-"{",(cchar;comment)*,-"}".-cchar:~["{}"].rule:(mark,S)?,name,S,["=:"],S,-alts,".".@mark:["@^-"].alts:alt+([";|"],S).alt:term*(",",S).-term:factor;option;repeat0;repeat1.-factor:terminal;nonterminal;"(",S,alts,")",S.repeat0:factor,"*",S,sep?.repeat1:factor,"+",S,sep?.option:factor,"?",S.sep:factor.nonterminal:(mark,S)?,name,S.-terminal:literal;charset.literal:quoted;encoded.-quoted:(tmark,S)?,-string.@name:namestart,namefollower*.-namestart:["_";Ll;Lu;Lm;Lt;Lo].-namefollower:namestart;["-.·‿⁀";Nd;Mn].@tmark:["^-"].string:-'"',dstring,-'"',S;-"'",sstring,-"'",S.@dstring:dchar+.@sstring:schar+.dchar:~['"'];'"',-'"'.{allcharacters,quotesmustbedoubled}schar:~["'"];"'",-"'".{allcharacters,quotesmustbedoubled}-encoded:(tmark,S)?,-"#",@hex,S.hex:["0"-"9";"a"-"f";"A"-"F"]+.-charset:inclusion;exclusion.inclusion:(tmark,S)?,set.exclusion:(tmark,S)?,"~",S,set.-set:"[",S,member*([";|"],S),"]",S.-member:literal;range;class.range:from,"-",S,to.@from:character.@to:character.-character:-'"',dchar,-'"',S;-"'",schar,-"'",S;"#",hex,S.class:@code,S.code:letter,letter.-letter:["a"-"z";"A"-"Z"].
<result xmlns="https://github.com/cmsmcq/ixml-tests">
	  <!-- <assert-xml-ref href="ixml-one-line.output.xml"/> -->
   <assert-xml-ref href="ixml-one-line.corr.output.xml"/>
</result>
<ixml>
   <rule name="ixml">:<alt>
         <nonterminal name="S"/>,<repeat1>
            <nonterminal name="rule"/>+<sep>
               <nonterminal name="S"/>
            </sep>
         </repeat1>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">:<alt>
         <repeat0>(<alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="whitespace">:<alt>
         <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
      </alt>;<alt>
         <nonterminal name="tab"/>
      </alt>;<alt>
         <nonterminal name="lf"/>
      </alt>;<alt>
         <nonterminal name="cr"/>
      </alt>.</rule>
   <rule mark="-" name="tab">:<alt>
         <literal tmark="-" hex="9"/>
      </alt>.</rule>
   <rule mark="-" name="lf">:<alt>
         <literal tmark="-" hex="a"/>
      </alt>.</rule>
   <rule mark="-" name="cr">:<alt>
         <literal tmark="-" hex="d"/>
      </alt>.</rule>
   <rule name="comment">:<alt>
         <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
      </alt>.</rule>
   <rule mark="-" name="cchar">:<alt>
         <exclusion>~[<literal dstring="{}"/>]</exclusion>
      </alt>.</rule>
   <rule name="rule">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
      </alt>.</rule>
   <rule mark="@" name="mark">:<alt>
         <inclusion>[<literal dstring="@^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="alts">:<alt>
         <repeat1>
            <nonterminal name="alt"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>
      </alt>.</rule>
   <rule name="alt">:<alt>
         <repeat0>
            <nonterminal name="term"/>*<sep>(<alts>
                  <alt>
                     <literal dstring=","/>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>
      </alt>.</rule>
   <rule mark="-" name="term">:<alt>
         <nonterminal name="factor"/>
      </alt>;<alt>
         <nonterminal name="option"/>
      </alt>;<alt>
         <nonterminal name="repeat0"/>
      </alt>;<alt>
         <nonterminal name="repeat1"/>
      </alt>.</rule>
   <rule mark="-" name="factor">:<alt>
         <nonterminal name="terminal"/>
      </alt>;<alt>
         <nonterminal name="nonterminal"/>
      </alt>;<alt>
         <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="repeat0">:<alt>
         <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="repeat1">:<alt>
         <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="option">:<alt>
         <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="sep">:<alt>
         <nonterminal name="factor"/>
      </alt>.</rule>
   <rule name="nonterminal">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="terminal">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="charset"/>
      </alt>.</rule>
   <rule name="literal">:<alt>
         <nonterminal name="quoted"/>
      </alt>;<alt>
         <nonterminal name="encoded"/>
      </alt>.</rule>
   <rule mark="-" name="quoted">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal mark="-" name="string"/>
      </alt>.</rule>
   <rule mark="@" name="name">:<alt>
         <nonterminal name="namestart"/>,<repeat0>
            <nonterminal name="namefollower"/>*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="namestart">:<alt>
         <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
      </alt>.</rule>
   <rule mark="-" name="namefollower">:<alt>
         <nonterminal name="namestart"/>
      </alt>;<alt>
         <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
      </alt>.</rule>
   <rule mark="@" name="tmark">:<alt>
         <inclusion>[<literal dstring="^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="string">:<alt>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
      </alt>;<alt>
         <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule name="schar">:<alt>
         <exclusion>~[<literal dstring="'"/>]</exclusion>
      </alt>;<alt>
         <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule mark="-" name="encoded">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="hex">:<alt>
         <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="charset">:<alt>
         <nonterminal name="inclusion"/>
      </alt>;<alt>
         <nonterminal name="exclusion"/>
      </alt>.</rule>
   <rule name="inclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule name="exclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule mark="-" name="set">:<alt>
         <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
            <nonterminal name="member"/>*<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="member">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="range"/>
      </alt>;<alt>
         <nonterminal name="class"/>
      </alt>.</rule>
   <rule name="range">:<alt>
         <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="class">:<alt>
         <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="code">:<alt>
         <nonterminal name="letter"/>,<nonterminal name="letter"/>
      </alt>.</rule>
   <rule mark="-" name="letter">:<alt>
         <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
      </alt>.</rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="35"
        documentParse="32">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">:<alt>
                     <nonterminal name="S"/>,<repeat1>
                        <nonterminal name="rule"/>+<sep>
                           <nonterminal name="S"/>
                        </sep>
                     </repeat1>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">:<alt>
                     <repeat0>(<alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="whitespace">:<alt>
                     <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
                  </alt>;<alt>
                     <nonterminal name="tab"/>
                  </alt>;<alt>
                     <nonterminal name="lf"/>
                  </alt>;<alt>
                     <nonterminal name="cr"/>
                  </alt>.</rule>
               <rule mark="-" name="tab">:<alt>
                     <literal tmark="-" hex="9"/>
                  </alt>.</rule>
               <rule mark="-" name="lf">:<alt>
                     <literal tmark="-" hex="a"/>
                  </alt>.</rule>
               <rule mark="-" name="cr">:<alt>
                     <literal tmark="-" hex="d"/>
                  </alt>.</rule>
               <rule name="comment">:<alt>
                     <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
                  </alt>.</rule>
               <rule mark="-" name="cchar">:<alt>
                     <exclusion>~[<literal dstring="{}"/>]</exclusion>
                  </alt>.</rule>
               <rule name="rule">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
                  </alt>.</rule>
               <rule mark="@" name="mark">:<alt>
                     <inclusion>[<literal dstring="@^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="alts">:<alt>
                     <repeat1>
                        <nonterminal name="alt"/>+<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat1>
                  </alt>.</rule>
               <rule name="alt">:<alt>
                     <repeat0>
                        <nonterminal name="term"/>*<sep>(<alts>
                              <alt>
                                 <literal dstring=","/>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>
                  </alt>.</rule>
               <rule mark="-" name="term">:<alt>
                     <nonterminal name="factor"/>
                  </alt>;<alt>
                     <nonterminal name="option"/>
                  </alt>;<alt>
                     <nonterminal name="repeat0"/>
                  </alt>;<alt>
                     <nonterminal name="repeat1"/>
                  </alt>.</rule>
               <rule mark="-" name="factor">:<alt>
                     <nonterminal name="terminal"/>
                  </alt>;<alt>
                     <nonterminal name="nonterminal"/>
                  </alt>;<alt>
                     <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="repeat0">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="repeat1">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="option">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="sep">:<alt>
                     <nonterminal name="factor"/>
                  </alt>.</rule>
               <rule name="nonterminal">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="terminal">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="charset"/>
                  </alt>.</rule>
               <rule name="literal">:<alt>
                     <nonterminal name="quoted"/>
                  </alt>;<alt>
                     <nonterminal name="encoded"/>
                  </alt>.</rule>
               <rule mark="-" name="quoted">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal mark="-" name="string"/>
                  </alt>.</rule>
               <rule mark="@" name="name">:<alt>
                     <nonterminal name="namestart"/>,<repeat0>
                        <nonterminal name="namefollower"/>*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="namestart">:<alt>
                     <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="-" name="namefollower">:<alt>
                     <nonterminal name="namestart"/>
                  </alt>;<alt>
                     <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="@" name="tmark">:<alt>
                     <inclusion>[<literal dstring="^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="string">:<alt>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
                  </alt>;<alt>
                     <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule name="schar">:<alt>
                     <exclusion>~[<literal dstring="'"/>]</exclusion>
                  </alt>;<alt>
                     <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule mark="-" name="encoded">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="hex">:<alt>
                     <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="charset">:<alt>
                     <nonterminal name="inclusion"/>
                  </alt>;<alt>
                     <nonterminal name="exclusion"/>
                  </alt>.</rule>
               <rule name="inclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule name="exclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule mark="-" name="set">:<alt>
                     <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
                        <nonterminal name="member"/>*<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="member">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="range"/>
                  </alt>;<alt>
                     <nonterminal name="class"/>
                  </alt>.</rule>
               <rule name="range">:<alt>
                     <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="class">:<alt>
                     <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="code">:<alt>
                     <nonterminal name="letter"/>,<nonterminal name="letter"/>
                  </alt>.</rule>
               <rule mark="-" name="letter">:<alt>
                     <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
                  </alt>.</rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">:<alt>
                     <nonterminal name="S"/>,<repeat1>
                        <nonterminal name="rule"/>+<sep>
                           <nonterminal name="S"/>
                        </sep>
                     </repeat1>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">:<alt>
                     <repeat0>(<alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="whitespace">:<alt>
                     <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
                  </alt>;<alt>
                     <nonterminal name="tab"/>
                  </alt>;<alt>
                     <nonterminal name="lf"/>
                  </alt>;<alt>
                     <nonterminal name="cr"/>
                  </alt>.</rule>
               <rule mark="-" name="tab">:<alt>
                     <literal tmark="-" hex="9"/>
                  </alt>.</rule>
               <rule mark="-" name="lf">:<alt>
                     <literal tmark="-" hex="a"/>
                  </alt>.</rule>
               <rule mark="-" name="cr">:<alt>
                     <literal tmark="-" hex="d"/>
                  </alt>.</rule>
               <rule name="comment">:<alt>
                     <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
                  </alt>.</rule>
               <rule mark="-" name="cchar">:<alt>
                     <exclusion>~[<literal dstring="{}"/>]</exclusion>
                  </alt>.</rule>
               <rule name="rule">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
                  </alt>.</rule>
               <rule mark="@" name="mark">:<alt>
                     <inclusion>[<literal dstring="@^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="alts">:<alt>
                     <repeat1>
                        <nonterminal name="alt"/>+<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat1>
                  </alt>.</rule>
               <rule name="alt">:<alt>
                     <repeat0>
                        <nonterminal name="term"/>*<sep>(<alts>
                              <alt>
                                 <literal dstring=","/>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>
                  </alt>.</rule>
               <rule mark="-" name="term">:<alt>
                     <nonterminal name="factor"/>
                  </alt>;<alt>
                     <nonterminal name="option"/>
                  </alt>;<alt>
                     <nonterminal name="repeat0"/>
                  </alt>;<alt>
                     <nonterminal name="repeat1"/>
                  </alt>.</rule>
               <rule mark="-" name="factor">:<alt>
                     <nonterminal name="terminal"/>
                  </alt>;<alt>
                     <nonterminal name="nonterminal"/>
                  </alt>;<alt>
                     <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="repeat0">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="repeat1">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="option">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="sep">:<alt>
                     <nonterminal name="factor"/>
                  </alt>.</rule>
               <rule name="nonterminal">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="terminal">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="charset"/>
                  </alt>.</rule>
               <rule name="literal">:<alt>
                     <nonterminal name="quoted"/>
                  </alt>;<alt>
                     <nonterminal name="encoded"/>
                  </alt>.</rule>
               <rule mark="-" name="quoted">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal mark="-" name="string"/>
                  </alt>.</rule>
               <rule mark="@" name="name">:<alt>
                     <nonterminal name="namestart"/>,<repeat0>
                        <nonterminal name="namefollower"/>*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="namestart">:<alt>
                     <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="-" name="namefollower">:<alt>
                     <nonterminal name="namestart"/>
                  </alt>;<alt>
                     <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="@" name="tmark">:<alt>
                     <inclusion>[<literal dstring="^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="string">:<alt>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
                  </alt>;<alt>
                     <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule name="schar">:<alt>
                     <exclusion>~[<literal dstring="'"/>]</exclusion>
                  </alt>;<alt>
                     <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
                  </alt>.</rule>
               <comment>allcharacters,quotesmustbedoubled</comment>
               <rule mark="-" name="encoded">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="hex">:<alt>
                     <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="charset">:<alt>
                     <nonterminal name="inclusion"/>
                  </alt>;<alt>
                     <nonterminal name="exclusion"/>
                  </alt>.</rule>
               <rule name="inclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule name="exclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule mark="-" name="set">:<alt>
                     <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
                        <nonterminal name="member"/>*<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="member">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="range"/>
                  </alt>;<alt>
                     <nonterminal name="class"/>
                  </alt>.</rule>
               <rule name="range">:<alt>
                     <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="class">:<alt>
                     <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="code">:<alt>
                     <nonterminal name="letter"/>,<nonterminal name="letter"/>
                  </alt>.</rule>
               <rule mark="-" name="letter">:<alt>
                     <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
                  </alt>.</rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 35. Document parse: 32.

Result: PASS

Actual:
<ixml>
   <rule name="ixml">:<alt>
         <nonterminal name="S"/>,<repeat1>
            <nonterminal name="rule"/>+<sep>
               <nonterminal name="S"/>
            </sep>
         </repeat1>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">:<alt>
         <repeat0>(<alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="whitespace">:<alt>
         <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
      </alt>;<alt>
         <nonterminal name="tab"/>
      </alt>;<alt>
         <nonterminal name="lf"/>
      </alt>;<alt>
         <nonterminal name="cr"/>
      </alt>.</rule>
   <rule mark="-" name="tab">:<alt>
         <literal tmark="-" hex="9"/>
      </alt>.</rule>
   <rule mark="-" name="lf">:<alt>
         <literal tmark="-" hex="a"/>
      </alt>.</rule>
   <rule mark="-" name="cr">:<alt>
         <literal tmark="-" hex="d"/>
      </alt>.</rule>
   <rule name="comment">:<alt>
         <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
      </alt>.</rule>
   <rule mark="-" name="cchar">:<alt>
         <exclusion>~[<literal dstring="{}"/>]</exclusion>
      </alt>.</rule>
   <rule name="rule">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
      </alt>.</rule>
   <rule mark="@" name="mark">:<alt>
         <inclusion>[<literal dstring="@^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="alts">:<alt>
         <repeat1>
            <nonterminal name="alt"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>
      </alt>.</rule>
   <rule name="alt">:<alt>
         <repeat0>
            <nonterminal name="term"/>*<sep>(<alts>
                  <alt>
                     <literal dstring=","/>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>
      </alt>.</rule>
   <rule mark="-" name="term">:<alt>
         <nonterminal name="factor"/>
      </alt>;<alt>
         <nonterminal name="option"/>
      </alt>;<alt>
         <nonterminal name="repeat0"/>
      </alt>;<alt>
         <nonterminal name="repeat1"/>
      </alt>.</rule>
   <rule mark="-" name="factor">:<alt>
         <nonterminal name="terminal"/>
      </alt>;<alt>
         <nonterminal name="nonterminal"/>
      </alt>;<alt>
         <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="repeat0">:<alt>
         <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="repeat1">:<alt>
         <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="option">:<alt>
         <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="sep">:<alt>
         <nonterminal name="factor"/>
      </alt>.</rule>
   <rule name="nonterminal">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="terminal">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="charset"/>
      </alt>.</rule>
   <rule name="literal">:<alt>
         <nonterminal name="quoted"/>
      </alt>;<alt>
         <nonterminal name="encoded"/>
      </alt>.</rule>
   <rule mark="-" name="quoted">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal mark="-" name="string"/>
      </alt>.</rule>
   <rule mark="@" name="name">:<alt>
         <nonterminal name="namestart"/>,<repeat0>
            <nonterminal name="namefollower"/>*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="namestart">:<alt>
         <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
      </alt>.</rule>
   <rule mark="-" name="namefollower">:<alt>
         <nonterminal name="namestart"/>
      </alt>;<alt>
         <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
      </alt>.</rule>
   <rule mark="@" name="tmark">:<alt>
         <inclusion>[<literal dstring="^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="string">:<alt>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
      </alt>;<alt>
         <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule name="schar">:<alt>
         <exclusion>~[<literal dstring="'"/>]</exclusion>
      </alt>;<alt>
         <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
      </alt>.</rule>
   <comment>allcharacters,quotesmustbedoubled</comment>
   <rule mark="-" name="encoded">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="hex">:<alt>
         <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="charset">:<alt>
         <nonterminal name="inclusion"/>
      </alt>;<alt>
         <nonterminal name="exclusion"/>
      </alt>.</rule>
   <rule name="inclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule name="exclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule mark="-" name="set">:<alt>
         <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
            <nonterminal name="member"/>*<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="member">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="range"/>
      </alt>;<alt>
         <nonterminal name="class"/>
      </alt>.</rule>
   <rule name="range">:<alt>
         <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="class">:<alt>
         <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="code">:<alt>
         <nonterminal name="letter"/>,<nonterminal name="letter"/>
      </alt>.</rule>
   <rule mark="-" name="letter">:<alt>
         <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
      </alt>.</rule>
</ixml>

ixml-spaces

Input grammar
 ixml  :  S  ,  rule  ++  S  ,  S  . 
 - S :  ( whitespace ; comment )  *  . 
 - whitespace :  -  [ Zs ]  ; tab ;  lf ;  cr . 
 - tab :  - #9 . 
 - lf :  - #a . 
 - cr :  - #d . 
 comment :  - "{" ,  ( cchar ; comment )  *  ,  - "}" . 
 - cchar : ~ [ "{}" ]  . 
 rule :  ( mark , S ) ? , name , S ,  [ "=:" ]  , S ,  - alts , "." . 
 @ mark :  [ "@^-" ]  . 
 alts : alt ++  (  [ ";|" ]  , S )  . 
 alt : term **  ( "," , S )  . 
 - term : factor ; 
          option ; 
          repeat0 ; 
          repeat1 . 
 - factor : terminal ; 
            nonterminal ; 
            "(" , S , alts , ")" , S . 
 repeat0 : factor , "*" , S , sep ? . 
 repeat1 : factor , "+" , S , sep ? . 
 option : factor , "?" , S . 
 sep : factor . 
 nonterminal :  ( mark , S ) ? , name , S . 
 - terminal : literal ; 
              charset . 
 literal : quoted ; 
           encoded . 
 - quoted :  ( tmark , S ) ? ,  - string . 
 @ name : namestart , namefollower *  . 
 - namestart :  [ "_" ; Ll ; Lu ; Lm ; Lt ; Lo ]  . 
 - namefollower : namestart ;  [ "-.·‿⁀" ; Nd ; Mn ]  . 
 @ tmark :  [ "^-" ]  . 
 string :  - '"' , dstring ,  - '"' , S ; 
 - "'" , sstring ,  - "'" , S . 
 @ dstring : dchar +  . 
 @ sstring : schar +  . 
 dchar : ~ [ '"' ]  ; 
         '"' ,  - '"' . { all characters , quotes must be doubled }
 schar : ~ [ "'" ]  ; 
         "'" ,  - "'" . { all characters , quotes must be doubled }
 - encoded :  ( tmark , S ) ? ,  - "#" ,  @ hex , S . 
 hex :  [ "0" - "9" ; "a" - "f" ; "A" - "F" ]  +  . 
 - charset : inclusion ; 
             exclusion . 
 inclusion :  ( tmark , S ) ? , set . 
 exclusion :  ( tmark , S ) ? , "~" , S , set . 
 - set : "[" , S , member **  (  [ ";|" ]  , S )  , "]" , S . 
 - member : literal ; 
            range ; 
            class . 
 range : from , "-" , S , to . 
 @ from : character . 
 @ to : character . 
 - character :  - '"' , dchar ,  - '"' , S ; 
 - "'" , schar ,  - "'" , S ; 
 "#" , hex , S . 
 class :  @ code , S . 
 code : letter , letter . 
 - letter :  [ "a" - "z" ; "A" - "Z" ]  . 
Test ixml-spaces
Input text
 ixml  :  S  ,  rule  +  S  ,  S  . 
 - S :  ( whitespace ; comment )  *  . 
 - whitespace :  -  [ Zs ]  ; tab ; { lf ; } cr . 
 - tab :  - #9 . 
{ - lf :  - #a . }
 - cr :  - #d . 
 comment :  - "{" ,  ( cchar ; comment )  *  ,  - "}" . 
 - cchar : ~ [ "{}" ]  . 
 rule :  ( mark , S ) ? , name , S ,  [ "=:" ]  , S ,  - alts , "." . 
 @ mark :  [ "@^-" ]  . 
 alts : alt +  (  [ ";|" ]  , S )  . 
 alt : term *  ( "," , S )  . 
 - term : factor ; 
          option ; 
          repeat0 ; 
          repeat1 . 
 - factor : terminal ; 
            nonterminal ; 
            "(" , S , alts , ")" , S . 
 repeat0 : factor , "*" , S , sep ? . 
 repeat1 : factor , "+" , S , sep ? . 
 option : factor , "?" , S . 
 sep : factor . 
 nonterminal :  ( mark , S ) ? , name , S . 
 - terminal : literal ; 
              charset . 
 literal : quoted ; 
           encoded . 
 - quoted :  ( tmark , S ) ? ,  - string . 
 @ name : namestart , namefollower *  . 
 - namestart :  [ "_" ; Ll ; Lu ; Lm ; Lt ; Lo ]  . 
 - namefollower : namestart ;  [ "-.·‿⁀" ; Nd ; Mn ]  . 
 @ tmark :  [ "^-" ]  . 
 string :  - '"' , dstring ,  - '"' , S ; 
 - "'" , sstring ,  - "'" , S . 
 @ dstring : dchar +  . 
 @ sstring : schar +  . 
 dchar : ~ [ '"' ]  ; 
         '"' ,  - '"' . { all characters , quotes must be doubled }
 schar : ~ [ "'" ]  ; 
         "'" ,  - "'" . { all characters , quotes must be doubled }
 - encoded :  ( tmark , S ) ? ,  - "#" ,  @ hex , S . 
 hex :  [ "0" - "9" ; "a" - "f" ; "A" - "F" ]  +  . 
 - charset : inclusion ; 
             exclusion . 
 inclusion :  ( tmark , S ) ? , set . 
 exclusion :  ( tmark , S ) ? , "~" , S , set . 
 - set : "[" , S , member *  (  [ ";|" ]  , S )  , "]" , S . 
 - member : literal ; 
            range ; 
            class . 
 range : from , "-" , S , to . 
 @ from : character . 
 @ to : character . 
 - character :  - '"' , dchar ,  - '"' , S ; 
 - "'" , schar ,  - "'" , S ; 
 "#" , hex , S . 
 class :  @ code , S . 
 code : letter , letter . 
 - letter :  [ "a" - "z" ; "A" - "Z" ]  . 
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ixml-spaces.output.xml"/>
</result>
<ixml>
   <rule name="ixml">:<alt>
         <nonterminal name="S"/>,<repeat1>
            <nonterminal name="rule"/>+<sep>
               <nonterminal name="S"/>
            </sep>
         </repeat1>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">:<alt>
         <repeat0>(<alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="whitespace">:<alt>
         <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
      </alt>;<alt>
         <nonterminal name="tab"/>
      </alt>;<comment> lf ; </comment>
      <alt>
         <nonterminal name="cr"/>
      </alt>.</rule>
   <rule mark="-" name="tab">:<alt>
         <literal tmark="-" hex="9"/>
      </alt>.</rule>
   <comment> - lf :  - #a . </comment>
   <rule mark="-" name="cr">:<alt>
         <literal tmark="-" hex="d"/>
      </alt>.</rule>
   <rule name="comment">:<alt>
         <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
      </alt>.</rule>
   <rule mark="-" name="cchar">:<alt>
         <exclusion>~[<literal dstring="{}"/>]</exclusion>
      </alt>.</rule>
   <rule name="rule">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
      </alt>.</rule>
   <rule mark="@" name="mark">:<alt>
         <inclusion>[<literal dstring="@^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="alts">:<alt>
         <repeat1>
            <nonterminal name="alt"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>
      </alt>.</rule>
   <rule name="alt">:<alt>
         <repeat0>
            <nonterminal name="term"/>*<sep>(<alts>
                  <alt>
                     <literal dstring=","/>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>
      </alt>.</rule>
   <rule mark="-" name="term">:<alt>
         <nonterminal name="factor"/>
      </alt>;<alt>
         <nonterminal name="option"/>
      </alt>;<alt>
         <nonterminal name="repeat0"/>
      </alt>;<alt>
         <nonterminal name="repeat1"/>
      </alt>.</rule>
   <rule mark="-" name="factor">:<alt>
         <nonterminal name="terminal"/>
      </alt>;<alt>
         <nonterminal name="nonterminal"/>
      </alt>;<alt>
         <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="repeat0">:<alt>
         <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="repeat1">:<alt>
         <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="option">:<alt>
         <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="sep">:<alt>
         <nonterminal name="factor"/>
      </alt>.</rule>
   <rule name="nonterminal">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="terminal">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="charset"/>
      </alt>.</rule>
   <rule name="literal">:<alt>
         <nonterminal name="quoted"/>
      </alt>;<alt>
         <nonterminal name="encoded"/>
      </alt>.</rule>
   <rule mark="-" name="quoted">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal mark="-" name="string"/>
      </alt>.</rule>
   <rule mark="@" name="name">:<alt>
         <nonterminal name="namestart"/>,<repeat0>
            <nonterminal name="namefollower"/>*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="namestart">:<alt>
         <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
      </alt>.</rule>
   <rule mark="-" name="namefollower">:<alt>
         <nonterminal name="namestart"/>
      </alt>;<alt>
         <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
      </alt>.</rule>
   <rule mark="@" name="tmark">:<alt>
         <inclusion>[<literal dstring="^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="string">:<alt>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
      </alt>;<alt>
         <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
      </alt>.</rule>
   <comment> all characters , quotes must be doubled </comment>
   <rule name="schar">:<alt>
         <exclusion>~[<literal dstring="'"/>]</exclusion>
      </alt>;<alt>
         <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
      </alt>.</rule>
   <comment> all characters , quotes must be doubled </comment>
   <rule mark="-" name="encoded">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="hex">:<alt>
         <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="charset">:<alt>
         <nonterminal name="inclusion"/>
      </alt>;<alt>
         <nonterminal name="exclusion"/>
      </alt>.</rule>
   <rule name="inclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule name="exclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule mark="-" name="set">:<alt>
         <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
            <nonterminal name="member"/>*<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="member">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="range"/>
      </alt>;<alt>
         <nonterminal name="class"/>
      </alt>.</rule>
   <rule name="range">:<alt>
         <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="class">:<alt>
         <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="code">:<alt>
         <nonterminal name="letter"/>,<nonterminal name="letter"/>
      </alt>.</rule>
   <rule mark="-" name="letter">:<alt>
         <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
      </alt>.</rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="54"
        documentParse="47">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">:<alt>
                     <nonterminal name="S"/>,<repeat1>
                        <nonterminal name="rule"/>+<sep>
                           <nonterminal name="S"/>
                        </sep>
                     </repeat1>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">:<alt>
                     <repeat0>(<alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="whitespace">:<alt>
                     <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
                  </alt>;<alt>
                     <nonterminal name="tab"/>
                  </alt>;<comment> lf ; </comment>
                  <alt>
                     <nonterminal name="cr"/>
                  </alt>.</rule>
               <rule mark="-" name="tab">:<alt>
                     <literal tmark="-" hex="9"/>
                  </alt>.</rule>
               <comment> - lf :  - #a . </comment>
               <rule mark="-" name="cr">:<alt>
                     <literal tmark="-" hex="d"/>
                  </alt>.</rule>
               <rule name="comment">:<alt>
                     <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
                  </alt>.</rule>
               <rule mark="-" name="cchar">:<alt>
                     <exclusion>~[<literal dstring="{}"/>]</exclusion>
                  </alt>.</rule>
               <rule name="rule">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
                  </alt>.</rule>
               <rule mark="@" name="mark">:<alt>
                     <inclusion>[<literal dstring="@^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="alts">:<alt>
                     <repeat1>
                        <nonterminal name="alt"/>+<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat1>
                  </alt>.</rule>
               <rule name="alt">:<alt>
                     <repeat0>
                        <nonterminal name="term"/>*<sep>(<alts>
                              <alt>
                                 <literal dstring=","/>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>
                  </alt>.</rule>
               <rule mark="-" name="term">:<alt>
                     <nonterminal name="factor"/>
                  </alt>;<alt>
                     <nonterminal name="option"/>
                  </alt>;<alt>
                     <nonterminal name="repeat0"/>
                  </alt>;<alt>
                     <nonterminal name="repeat1"/>
                  </alt>.</rule>
               <rule mark="-" name="factor">:<alt>
                     <nonterminal name="terminal"/>
                  </alt>;<alt>
                     <nonterminal name="nonterminal"/>
                  </alt>;<alt>
                     <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="repeat0">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="repeat1">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="option">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="sep">:<alt>
                     <nonterminal name="factor"/>
                  </alt>.</rule>
               <rule name="nonterminal">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="terminal">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="charset"/>
                  </alt>.</rule>
               <rule name="literal">:<alt>
                     <nonterminal name="quoted"/>
                  </alt>;<alt>
                     <nonterminal name="encoded"/>
                  </alt>.</rule>
               <rule mark="-" name="quoted">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal mark="-" name="string"/>
                  </alt>.</rule>
               <rule mark="@" name="name">:<alt>
                     <nonterminal name="namestart"/>,<repeat0>
                        <nonterminal name="namefollower"/>*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="namestart">:<alt>
                     <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="-" name="namefollower">:<alt>
                     <nonterminal name="namestart"/>
                  </alt>;<alt>
                     <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="@" name="tmark">:<alt>
                     <inclusion>[<literal dstring="^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="string">:<alt>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
                  </alt>;<alt>
                     <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
                  </alt>.</rule>
               <comment> all characters , quotes must be doubled </comment>
               <rule name="schar">:<alt>
                     <exclusion>~[<literal dstring="'"/>]</exclusion>
                  </alt>;<alt>
                     <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
                  </alt>.</rule>
               <comment> all characters , quotes must be doubled </comment>
               <rule mark="-" name="encoded">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="hex">:<alt>
                     <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="charset">:<alt>
                     <nonterminal name="inclusion"/>
                  </alt>;<alt>
                     <nonterminal name="exclusion"/>
                  </alt>.</rule>
               <rule name="inclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule name="exclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule mark="-" name="set">:<alt>
                     <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
                        <nonterminal name="member"/>*<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="member">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="range"/>
                  </alt>;<alt>
                     <nonterminal name="class"/>
                  </alt>.</rule>
               <rule name="range">:<alt>
                     <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="class">:<alt>
                     <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="code">:<alt>
                     <nonterminal name="letter"/>,<nonterminal name="letter"/>
                  </alt>.</rule>
               <rule mark="-" name="letter">:<alt>
                     <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
                  </alt>.</rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">:<alt>
                     <nonterminal name="S"/>,<repeat1>
                        <nonterminal name="rule"/>+<sep>
                           <nonterminal name="S"/>
                        </sep>
                     </repeat1>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">:<alt>
                     <repeat0>(<alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="whitespace">:<alt>
                     <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
                  </alt>;<alt>
                     <nonterminal name="tab"/>
                  </alt>;<comment> lf ; </comment>
                  <alt>
                     <nonterminal name="cr"/>
                  </alt>.</rule>
               <rule mark="-" name="tab">:<alt>
                     <literal tmark="-" hex="9"/>
                  </alt>.</rule>
               <comment> - lf :  - #a . </comment>
               <rule mark="-" name="cr">:<alt>
                     <literal tmark="-" hex="d"/>
                  </alt>.</rule>
               <rule name="comment">:<alt>
                     <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>;<alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
                  </alt>.</rule>
               <rule mark="-" name="cchar">:<alt>
                     <exclusion>~[<literal dstring="{}"/>]</exclusion>
                  </alt>.</rule>
               <rule name="rule">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
                  </alt>.</rule>
               <rule mark="@" name="mark">:<alt>
                     <inclusion>[<literal dstring="@^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="alts">:<alt>
                     <repeat1>
                        <nonterminal name="alt"/>+<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat1>
                  </alt>.</rule>
               <rule name="alt">:<alt>
                     <repeat0>
                        <nonterminal name="term"/>*<sep>(<alts>
                              <alt>
                                 <literal dstring=","/>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>
                  </alt>.</rule>
               <rule mark="-" name="term">:<alt>
                     <nonterminal name="factor"/>
                  </alt>;<alt>
                     <nonterminal name="option"/>
                  </alt>;<alt>
                     <nonterminal name="repeat0"/>
                  </alt>;<alt>
                     <nonterminal name="repeat1"/>
                  </alt>.</rule>
               <rule mark="-" name="factor">:<alt>
                     <nonterminal name="terminal"/>
                  </alt>;<alt>
                     <nonterminal name="nonterminal"/>
                  </alt>;<alt>
                     <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="repeat0">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="repeat1">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
                        <nonterminal name="sep"/>?</option>
                  </alt>.</rule>
               <rule name="option">:<alt>
                     <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="sep">:<alt>
                     <nonterminal name="factor"/>
                  </alt>.</rule>
               <rule name="nonterminal">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="mark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="terminal">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="charset"/>
                  </alt>.</rule>
               <rule name="literal">:<alt>
                     <nonterminal name="quoted"/>
                  </alt>;<alt>
                     <nonterminal name="encoded"/>
                  </alt>.</rule>
               <rule mark="-" name="quoted">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal mark="-" name="string"/>
                  </alt>.</rule>
               <rule mark="@" name="name">:<alt>
                     <nonterminal name="namestart"/>,<repeat0>
                        <nonterminal name="namefollower"/>*</repeat0>
                  </alt>.</rule>
               <rule mark="-" name="namestart">:<alt>
                     <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="-" name="namefollower">:<alt>
                     <nonterminal name="namestart"/>
                  </alt>;<alt>
                     <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
                  </alt>.</rule>
               <rule mark="@" name="tmark">:<alt>
                     <inclusion>[<literal dstring="^-"/>]</inclusion>
                  </alt>.</rule>
               <rule name="string">:<alt>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
                  </alt>;<alt>
                     <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
                  </alt>.</rule>
               <comment> all characters , quotes must be doubled </comment>
               <rule name="schar">:<alt>
                     <exclusion>~[<literal dstring="'"/>]</exclusion>
                  </alt>;<alt>
                     <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
                  </alt>.</rule>
               <comment> all characters , quotes must be doubled </comment>
               <rule mark="-" name="encoded">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="hex">:<alt>
                     <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="charset">:<alt>
                     <nonterminal name="inclusion"/>
                  </alt>;<alt>
                     <nonterminal name="exclusion"/>
                  </alt>.</rule>
               <rule name="inclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule name="exclusion">:<alt>
                     <option>(<alts>
                           <alt>
                              <nonterminal name="tmark"/>,<nonterminal name="S"/>
                           </alt>
                        </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
                  </alt>.</rule>
               <rule mark="-" name="set">:<alt>
                     <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
                        <nonterminal name="member"/>*<sep>(<alts>
                              <alt>
                                 <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                              </alt>
                           </alts>)</sep>
                     </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="member">:<alt>
                     <nonterminal name="literal"/>
                  </alt>;<alt>
                     <nonterminal name="range"/>
                  </alt>;<alt>
                     <nonterminal name="class"/>
                  </alt>.</rule>
               <rule name="range">:<alt>
                     <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
                  </alt>;<alt>
                     <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="class">:<alt>
                     <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
                  </alt>.</rule>
               <rule name="code">:<alt>
                     <nonterminal name="letter"/>,<nonterminal name="letter"/>
                  </alt>.</rule>
               <rule mark="-" name="letter">:<alt>
                     <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
                  </alt>.</rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 54. Document parse: 47.

Result: PASS

Actual:
<ixml>
   <rule name="ixml">:<alt>
         <nonterminal name="S"/>,<repeat1>
            <nonterminal name="rule"/>+<sep>
               <nonterminal name="S"/>
            </sep>
         </repeat1>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">:<alt>
         <repeat0>(<alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="whitespace">:<alt>
         <inclusion tmark="-">[<class code="Zs"/>]</inclusion>
      </alt>;<alt>
         <nonterminal name="tab"/>
      </alt>;<comment> lf ; </comment>
      <alt>
         <nonterminal name="cr"/>
      </alt>.</rule>
   <rule mark="-" name="tab">:<alt>
         <literal tmark="-" hex="9"/>
      </alt>.</rule>
   <comment> - lf :  - #a . </comment>
   <rule mark="-" name="cr">:<alt>
         <literal tmark="-" hex="d"/>
      </alt>.</rule>
   <rule name="comment">:<alt>
         <literal tmark="-" dstring="{"/>,<repeat0>(<alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>;<alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>,<literal tmark="-" dstring="}"/>
      </alt>.</rule>
   <rule mark="-" name="cchar">:<alt>
         <exclusion>~[<literal dstring="{}"/>]</exclusion>
      </alt>.</rule>
   <rule name="rule">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>,<inclusion>[<literal dstring="=:"/>]</inclusion>,<nonterminal name="S"/>,<nonterminal mark="-" name="alts"/>,<literal dstring="."/>
      </alt>.</rule>
   <rule mark="@" name="mark">:<alt>
         <inclusion>[<literal dstring="@^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="alts">:<alt>
         <repeat1>
            <nonterminal name="alt"/>+<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat1>
      </alt>.</rule>
   <rule name="alt">:<alt>
         <repeat0>
            <nonterminal name="term"/>*<sep>(<alts>
                  <alt>
                     <literal dstring=","/>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>
      </alt>.</rule>
   <rule mark="-" name="term">:<alt>
         <nonterminal name="factor"/>
      </alt>;<alt>
         <nonterminal name="option"/>
      </alt>;<alt>
         <nonterminal name="repeat0"/>
      </alt>;<alt>
         <nonterminal name="repeat1"/>
      </alt>.</rule>
   <rule mark="-" name="factor">:<alt>
         <nonterminal name="terminal"/>
      </alt>;<alt>
         <nonterminal name="nonterminal"/>
      </alt>;<alt>
         <literal dstring="("/>,<nonterminal name="S"/>,<nonterminal name="alts"/>,<literal dstring=")"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="repeat0">:<alt>
         <nonterminal name="factor"/>,<literal dstring="*"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="repeat1">:<alt>
         <nonterminal name="factor"/>,<literal dstring="+"/>,<nonterminal name="S"/>,<option>
            <nonterminal name="sep"/>?</option>
      </alt>.</rule>
   <rule name="option">:<alt>
         <nonterminal name="factor"/>,<literal dstring="?"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="sep">:<alt>
         <nonterminal name="factor"/>
      </alt>.</rule>
   <rule name="nonterminal">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="mark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="name"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="terminal">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="charset"/>
      </alt>.</rule>
   <rule name="literal">:<alt>
         <nonterminal name="quoted"/>
      </alt>;<alt>
         <nonterminal name="encoded"/>
      </alt>.</rule>
   <rule mark="-" name="quoted">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal mark="-" name="string"/>
      </alt>.</rule>
   <rule mark="@" name="name">:<alt>
         <nonterminal name="namestart"/>,<repeat0>
            <nonterminal name="namefollower"/>*</repeat0>
      </alt>.</rule>
   <rule mark="-" name="namestart">:<alt>
         <inclusion>[<literal dstring="_"/>;<class code="Ll"/>;<class code="Lu"/>;<class code="Lm"/>;<class code="Lt"/>;<class code="Lo"/>]</inclusion>
      </alt>.</rule>
   <rule mark="-" name="namefollower">:<alt>
         <nonterminal name="namestart"/>
      </alt>;<alt>
         <inclusion>[<literal dstring="-.·‿⁀"/>;<class code="Nd"/>;<class code="Mn"/>]</inclusion>
      </alt>.</rule>
   <rule mark="@" name="tmark">:<alt>
         <inclusion>[<literal dstring="^-"/>]</inclusion>
      </alt>.</rule>
   <rule name="string">:<alt>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dstring"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="sstring"/>,<literal 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>~[<literal sstring="&#34;"/>]</exclusion>
      </alt>;<alt>
         <literal sstring="&#34;"/>,<literal tmark="-" sstring="&#34;"/>
      </alt>.</rule>
   <comment> all characters , quotes must be doubled </comment>
   <rule name="schar">:<alt>
         <exclusion>~[<literal dstring="'"/>]</exclusion>
      </alt>;<alt>
         <literal dstring="'"/>,<literal tmark="-" dstring="'"/>
      </alt>.</rule>
   <comment> all characters , quotes must be doubled </comment>
   <rule mark="-" name="encoded">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal tmark="-" dstring="#"/>,<nonterminal mark="@" name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="hex">:<alt>
         <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="charset">:<alt>
         <nonterminal name="inclusion"/>
      </alt>;<alt>
         <nonterminal name="exclusion"/>
      </alt>.</rule>
   <rule name="inclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule name="exclusion">:<alt>
         <option>(<alts>
               <alt>
                  <nonterminal name="tmark"/>,<nonterminal name="S"/>
               </alt>
            </alts>)?</option>,<literal dstring="~"/>,<nonterminal name="S"/>,<nonterminal name="set"/>
      </alt>.</rule>
   <rule mark="-" name="set">:<alt>
         <literal dstring="["/>,<nonterminal name="S"/>,<repeat0>
            <nonterminal name="member"/>*<sep>(<alts>
                  <alt>
                     <inclusion>[<literal dstring=";|"/>]</inclusion>,<nonterminal name="S"/>
                  </alt>
               </alts>)</sep>
         </repeat0>,<literal dstring="]"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="member">:<alt>
         <nonterminal name="literal"/>
      </alt>;<alt>
         <nonterminal name="range"/>
      </alt>;<alt>
         <nonterminal name="class"/>
      </alt>.</rule>
   <rule name="range">:<alt>
         <nonterminal name="from"/>,<literal dstring="-"/>,<nonterminal name="S"/>,<nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>,<nonterminal name="dchar"/>,<literal tmark="-" sstring="&#34;"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal tmark="-" dstring="'"/>,<nonterminal name="schar"/>,<literal tmark="-" dstring="'"/>,<nonterminal name="S"/>
      </alt>;<alt>
         <literal dstring="#"/>,<nonterminal name="hex"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="class">:<alt>
         <nonterminal mark="@" name="code"/>,<nonterminal name="S"/>
      </alt>.</rule>
   <rule name="code">:<alt>
         <nonterminal name="letter"/>,<nonterminal name="letter"/>
      </alt>.</rule>
   <rule mark="-" name="letter">:<alt>
         <inclusion>[<range from="a" to="z">-</range>;<range from="A" to="Z">-</range>]</inclusion>
      </alt>.</rule>
</ixml>

ixml

Input grammar
         ixml: s, rule++s, s.

           -s: (whitespace; comment)*.
  -whitespace: -[Zs]; tab; lf; cr.
         -tab: -#9.
          -lf: -#a.
          -cr: -#d.
      comment: -"{", (cchar; comment)*, -"}".
       -cchar: ~["{}"].

         rule: (mark, s)?, name, s, -["=:"], s, -alts, -".".
        @mark: ["@^-"].
         alts: alt++(-[";|"], s).
          alt: term**(-",", s).
        -term: factor;
               option;
               repeat0;
               repeat1.
      -factor: terminal;
               nonterminal;
               -"(", s, alts, -")", s.
      repeat0: factor, -"*", s, sep?.
      repeat1: factor, -"+", s, sep?.
       option: factor, -"?", s.
          sep: factor.
  nonterminal: (mark, s)?, name, s.

    -terminal: literal; 
               charset.
      literal: quoted;
               encoded.
      -quoted: (tmark, s)?, -string.

        @name: namestart, namefollower*.
   -namestart: ["_"; L].
-namefollower: namestart; ["-.·‿⁀"; Nd; Mn].

       @tmark: ["^-"].
       string: -'"', dstring, -'"', s;
               -"'", sstring, -"'", s.
     @dstring: dchar+.
     @sstring: schar+.
        dchar: ~['"'; #a; #d];
               '"', -'"'. {all characters except line breaks; quotes must be doubled}
        schar: ~["'"; #a; #d];
               "'", -"'". {all characters except line breaks; quotes must be doubled}
     -encoded: (tmark, s)?, -"#", @hex, s.
          hex: ["0"-"9"; "a"-"f"; "A"-"F"]+.

     -charset: inclusion; 
               exclusion.
    inclusion: (tmark, s)?,          set.
    exclusion: (tmark, s)?, -"~", s, set.
         -set: -"[", s,  member**(-[";|"], s), -"]", s.
      -member: literal;
               range;
               class.
        range: from, -"-", s, to.
        @from: character.
          @to: character.
   -character: -'"', dchar, -'"', s;
               -"'", schar, -"'", s;
               "#", hex, s.
        class: code, s.
        @code: capital, letter?.
     -capital: ["A"-"Z"].
      -letter: ["a"-"z"].
Test ixml
Input text
         ixml: s, rule+s, s.

           -s: (whitespace; comment)*.
  -whitespace: -[Zs]; tab; lf; cr.
         -tab: -#9.
          -lf: -#a.
          -cr: -#d.
      comment: -"{", (cchar; comment)*, -"}".
       -cchar: ~["{}"].

         rule: (mark, s)?, name, s, -["=:"], s, -alts, -".".
        @mark: ["@^-"].
         alts: alt+(-[";|"], s).
          alt: term*(-",", s).
        -term: factor;
               option;
               repeat0;
               repeat1.
      -factor: terminal;
               nonterminal;
               -"(", s, alts, -")", s.
      repeat0: factor, -"*", s, sep?.
      repeat1: factor, -"+", s, sep?.
       option: factor, -"?", s.
          sep: factor.
  nonterminal: (mark, s)?, name, s.

    -terminal: literal; 
               charset.
      literal: quoted;
               encoded.
      -quoted: (tmark, s)?, -string.

        @name: namestart, namefollower*.
   -namestart: ["_"; L].
-namefollower: namestart; ["-.·‿⁀"; Nd; Mn].

       @tmark: ["^-"].
       string: -'"', dstring, -'"', s;
               -"'", sstring, -"'", s.
     @dstring: dchar+.
     @sstring: schar+.
        dchar: ~['"'; #a; #d];
               '"', -'"'. {all characters except line breaks; quotes must be doubled}
        schar: ~["'"; #a; #d];
               "'", -"'". {all characters except line breaks; quotes must be doubled}
     -encoded: (tmark, s)?, -"#", @hex, s.
          hex: ["0"-"9"; "a"-"f"; "A"-"F"]+.

     -charset: inclusion; 
               exclusion.
    inclusion: (tmark, s)?,          set.
    exclusion: (tmark, s)?, -"~", s, set.
         -set: -"[", s,  member*(-[";|"], s), -"]", s.
      -member: literal;
               range;
               class.
        range: from, -"-", s, to.
        @from: character.
          @to: character.
   -character: -'"', dchar, -'"', s;
               -"'", schar, -"'", s;
               "#", hex, s.
        class: code, s.
        @code: capital, letter?.
     -capital: ["A"-"Z"].
      -letter: ["a"-"z"].
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ixml.output.xml"/>
</result>
<ixml>
   <rule name="ixml">
      <alt>
         <nonterminal name="s"/>
         <repeat1>
            <nonterminal name="rule"/>
            <sep>
               <nonterminal name="s"/>
            </sep>
         </repeat1>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="-" name="s">
      <alt>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>
               <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>
         </repeat0>
      </alt>
   </rule>
   <rule mark="-" name="whitespace">
      <alt>
         <inclusion tmark="-">
            <class code="Zs"/>
         </inclusion>
      </alt>
      <alt>
         <nonterminal name="tab"/>
      </alt>
      <alt>
         <nonterminal name="lf"/>
      </alt>
      <alt>
         <nonterminal name="cr"/>
      </alt>
   </rule>
   <rule mark="-" name="tab">
      <alt>
         <literal tmark="-" hex="9"/>
      </alt>
   </rule>
   <rule mark="-" name="lf">
      <alt>
         <literal tmark="-" hex="a"/>
      </alt>
   </rule>
   <rule mark="-" name="cr">
      <alt>
         <literal tmark="-" hex="d"/>
      </alt>
   </rule>
   <rule name="comment">
      <alt>
         <literal tmark="-" dstring="{"/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>
               <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>
         </repeat0>
         <literal tmark="-" dstring="}"/>
      </alt>
   </rule>
   <rule mark="-" name="cchar">
      <alt>
         <exclusion>
            <literal dstring="{}"/>
         </exclusion>
      </alt>
   </rule>
   <rule name="rule">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="mark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="name"/>
         <nonterminal name="s"/>
         <inclusion tmark="-">
            <literal dstring="=:"/>
         </inclusion>
         <nonterminal name="s"/>
         <nonterminal mark="-" name="alts"/>
         <literal tmark="-" dstring="."/>
      </alt>
   </rule>
   <rule mark="@" name="mark">
      <alt>
         <inclusion>
            <literal dstring="@^-"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="alts">
      <alt>
         <repeat1>
            <nonterminal name="alt"/>
            <sep>
               <alts>
                  <alt>
                     <inclusion tmark="-">
                        <literal dstring=";|"/>
                     </inclusion>
                     <nonterminal name="s"/>
                  </alt>
               </alts>
            </sep>
         </repeat1>
      </alt>
   </rule>
   <rule name="alt">
      <alt>
         <repeat0>
            <nonterminal name="term"/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark="-" dstring=","/>
                     <nonterminal name="s"/>
                  </alt>
               </alts>
            </sep>
         </repeat0>
      </alt>
   </rule>
   <rule mark="-" name="term">
      <alt>
         <nonterminal name="factor"/>
      </alt>
      <alt>
         <nonterminal name="option"/>
      </alt>
      <alt>
         <nonterminal name="repeat0"/>
      </alt>
      <alt>
         <nonterminal name="repeat1"/>
      </alt>
   </rule>
   <rule mark="-" name="factor">
      <alt>
         <nonterminal name="terminal"/>
      </alt>
      <alt>
         <nonterminal name="nonterminal"/>
      </alt>
      <alt>
         <literal tmark="-" dstring="("/>
         <nonterminal name="s"/>
         <nonterminal name="alts"/>
         <literal tmark="-" dstring=")"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="repeat0">
      <alt>
         <nonterminal name="factor"/>
         <literal tmark="-" dstring="*"/>
         <nonterminal name="s"/>
         <option>
            <nonterminal name="sep"/>
         </option>
      </alt>
   </rule>
   <rule name="repeat1">
      <alt>
         <nonterminal name="factor"/>
         <literal tmark="-" dstring="+"/>
         <nonterminal name="s"/>
         <option>
            <nonterminal name="sep"/>
         </option>
      </alt>
   </rule>
   <rule name="option">
      <alt>
         <nonterminal name="factor"/>
         <literal tmark="-" dstring="?"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="sep">
      <alt>
         <nonterminal name="factor"/>
      </alt>
   </rule>
   <rule name="nonterminal">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="mark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="name"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="-" name="terminal">
      <alt>
         <nonterminal name="literal"/>
      </alt>
      <alt>
         <nonterminal name="charset"/>
      </alt>
   </rule>
   <rule name="literal">
      <alt>
         <nonterminal name="quoted"/>
      </alt>
      <alt>
         <nonterminal name="encoded"/>
      </alt>
   </rule>
   <rule mark="-" name="quoted">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal mark="-" name="string"/>
      </alt>
   </rule>
   <rule mark="@" name="name">
      <alt>
         <nonterminal name="namestart"/>
         <repeat0>
            <nonterminal name="namefollower"/>
         </repeat0>
      </alt>
   </rule>
   <rule mark="-" name="namestart">
      <alt>
         <inclusion>
            <literal dstring="_"/>
            <class code="L"/>
         </inclusion>
      </alt>
   </rule>
   <rule mark="-" name="namefollower">
      <alt>
         <nonterminal name="namestart"/>
      </alt>
      <alt>
         <inclusion>
            <literal dstring="-.·‿⁀"/>
            <class code="Nd"/>
            <class code="Mn"/>
         </inclusion>
      </alt>
   </rule>
   <rule mark="@" name="tmark">
      <alt>
         <inclusion>
            <literal dstring="^-"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="string">
      <alt>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="dstring"/>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="s"/>
      </alt>
      <alt>
         <literal tmark="-" dstring="'"/>
         <nonterminal name="sstring"/>
         <literal 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>
            <literal sstring="&#34;"/>
            <literal hex="a"/>
            <literal hex="d"/>
         </exclusion>
      </alt>
      <alt>
         <literal sstring="&#34;"/>
         <literal tmark="-" sstring="&#34;"/>
      </alt>
   </rule>
   <comment>all characters except line breaks; quotes must be doubled</comment>
   <rule name="schar">
      <alt>
         <exclusion>
            <literal dstring="'"/>
            <literal hex="a"/>
            <literal hex="d"/>
         </exclusion>
      </alt>
      <alt>
         <literal dstring="'"/>
         <literal tmark="-" dstring="'"/>
      </alt>
   </rule>
   <comment>all characters except line breaks; quotes must be doubled</comment>
   <rule mark="-" name="encoded">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <literal tmark="-" dstring="#"/>
         <nonterminal mark="@" name="hex"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="hex">
      <alt>
         <repeat1>
            <inclusion>
               <range from="0" to="9"/>
               <range from="a" to="f"/>
               <range from="A" to="F"/>
            </inclusion>
         </repeat1>
      </alt>
   </rule>
   <rule mark="-" name="charset">
      <alt>
         <nonterminal name="inclusion"/>
      </alt>
      <alt>
         <nonterminal name="exclusion"/>
      </alt>
   </rule>
   <rule name="inclusion">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="set"/>
      </alt>
   </rule>
   <rule name="exclusion">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <literal tmark="-" dstring="~"/>
         <nonterminal name="s"/>
         <nonterminal name="set"/>
      </alt>
   </rule>
   <rule mark="-" name="set">
      <alt>
         <literal tmark="-" dstring="["/>
         <nonterminal name="s"/>
         <repeat0>
            <nonterminal name="member"/>
            <sep>
               <alts>
                  <alt>
                     <inclusion tmark="-">
                        <literal dstring=";|"/>
                     </inclusion>
                     <nonterminal name="s"/>
                  </alt>
               </alts>
            </sep>
         </repeat0>
         <literal tmark="-" dstring="]"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="-" name="member">
      <alt>
         <nonterminal name="literal"/>
      </alt>
      <alt>
         <nonterminal name="range"/>
      </alt>
      <alt>
         <nonterminal name="class"/>
      </alt>
   </rule>
   <rule name="range">
      <alt>
         <nonterminal name="from"/>
         <literal tmark="-" dstring="-"/>
         <nonterminal name="s"/>
         <nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="dchar"/>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="s"/>
      </alt>
      <alt>
         <literal tmark="-" dstring="'"/>
         <nonterminal name="schar"/>
         <literal tmark="-" dstring="'"/>
         <nonterminal name="s"/>
      </alt>
      <alt>
         <literal dstring="#"/>
         <nonterminal name="hex"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="class">
      <alt>
         <nonterminal name="code"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="@" name="code">
      <alt>
         <nonterminal name="capital"/>
         <option>
            <nonterminal name="letter"/>
         </option>
      </alt>
   </rule>
   <rule mark="-" name="capital">
      <alt>
         <inclusion>
            <range from="A" to="Z"/>
         </inclusion>
      </alt>
   </rule>
   <rule mark="-" name="letter">
      <alt>
         <inclusion>
            <range from="a" to="z"/>
         </inclusion>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="72"
        documentParse="54">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">
                  <alt>
                     <nonterminal name="s"/>
                     <repeat1>
                        <nonterminal name="rule"/>
                        <sep>
                           <nonterminal name="s"/>
                        </sep>
                     </repeat1>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="-" name="s">
                  <alt>
                     <repeat0>
                        <alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>
                           <alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>
                     </repeat0>
                  </alt>
               </rule>
               <rule mark="-" name="whitespace">
                  <alt>
                     <inclusion tmark="-">
                        <class code="Zs"/>
                     </inclusion>
                  </alt>
                  <alt>
                     <nonterminal name="tab"/>
                  </alt>
                  <alt>
                     <nonterminal name="lf"/>
                  </alt>
                  <alt>
                     <nonterminal name="cr"/>
                  </alt>
               </rule>
               <rule mark="-" name="tab">
                  <alt>
                     <literal tmark="-" hex="9"/>
                  </alt>
               </rule>
               <rule mark="-" name="lf">
                  <alt>
                     <literal tmark="-" hex="a"/>
                  </alt>
               </rule>
               <rule mark="-" name="cr">
                  <alt>
                     <literal tmark="-" hex="d"/>
                  </alt>
               </rule>
               <rule name="comment">
                  <alt>
                     <literal tmark="-" dstring="{"/>
                     <repeat0>
                        <alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>
                           <alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>
                     </repeat0>
                     <literal tmark="-" dstring="}"/>
                  </alt>
               </rule>
               <rule mark="-" name="cchar">
                  <alt>
                     <exclusion>
                        <literal dstring="{}"/>
                     </exclusion>
                  </alt>
               </rule>
               <rule name="rule">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="mark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal name="name"/>
                     <nonterminal name="s"/>
                     <inclusion tmark="-">
                        <literal dstring="=:"/>
                     </inclusion>
                     <nonterminal name="s"/>
                     <nonterminal mark="-" name="alts"/>
                     <literal tmark="-" dstring="."/>
                  </alt>
               </rule>
               <rule mark="@" name="mark">
                  <alt>
                     <inclusion>
                        <literal dstring="@^-"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="alts">
                  <alt>
                     <repeat1>
                        <nonterminal name="alt"/>
                        <sep>
                           <alts>
                              <alt>
                                 <inclusion tmark="-">
                                    <literal dstring=";|"/>
                                 </inclusion>
                                 <nonterminal name="s"/>
                              </alt>
                           </alts>
                        </sep>
                     </repeat1>
                  </alt>
               </rule>
               <rule name="alt">
                  <alt>
                     <repeat0>
                        <nonterminal name="term"/>
                        <sep>
                           <alts>
                              <alt>
                                 <literal tmark="-" dstring=","/>
                                 <nonterminal name="s"/>
                              </alt>
                           </alts>
                        </sep>
                     </repeat0>
                  </alt>
               </rule>
               <rule mark="-" name="term">
                  <alt>
                     <nonterminal name="factor"/>
                  </alt>
                  <alt>
                     <nonterminal name="option"/>
                  </alt>
                  <alt>
                     <nonterminal name="repeat0"/>
                  </alt>
                  <alt>
                     <nonterminal name="repeat1"/>
                  </alt>
               </rule>
               <rule mark="-" name="factor">
                  <alt>
                     <nonterminal name="terminal"/>
                  </alt>
                  <alt>
                     <nonterminal name="nonterminal"/>
                  </alt>
                  <alt>
                     <literal tmark="-" dstring="("/>
                     <nonterminal name="s"/>
                     <nonterminal name="alts"/>
                     <literal tmark="-" dstring=")"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="repeat0">
                  <alt>
                     <nonterminal name="factor"/>
                     <literal tmark="-" dstring="*"/>
                     <nonterminal name="s"/>
                     <option>
                        <nonterminal name="sep"/>
                     </option>
                  </alt>
               </rule>
               <rule name="repeat1">
                  <alt>
                     <nonterminal name="factor"/>
                     <literal tmark="-" dstring="+"/>
                     <nonterminal name="s"/>
                     <option>
                        <nonterminal name="sep"/>
                     </option>
                  </alt>
               </rule>
               <rule name="option">
                  <alt>
                     <nonterminal name="factor"/>
                     <literal tmark="-" dstring="?"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="sep">
                  <alt>
                     <nonterminal name="factor"/>
                  </alt>
               </rule>
               <rule name="nonterminal">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="mark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal name="name"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="-" name="terminal">
                  <alt>
                     <nonterminal name="literal"/>
                  </alt>
                  <alt>
                     <nonterminal name="charset"/>
                  </alt>
               </rule>
               <rule name="literal">
                  <alt>
                     <nonterminal name="quoted"/>
                  </alt>
                  <alt>
                     <nonterminal name="encoded"/>
                  </alt>
               </rule>
               <rule mark="-" name="quoted">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal mark="-" name="string"/>
                  </alt>
               </rule>
               <rule mark="@" name="name">
                  <alt>
                     <nonterminal name="namestart"/>
                     <repeat0>
                        <nonterminal name="namefollower"/>
                     </repeat0>
                  </alt>
               </rule>
               <rule mark="-" name="namestart">
                  <alt>
                     <inclusion>
                        <literal dstring="_"/>
                        <class code="L"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule mark="-" name="namefollower">
                  <alt>
                     <nonterminal name="namestart"/>
                  </alt>
                  <alt>
                     <inclusion>
                        <literal dstring="-.·‿⁀"/>
                        <class code="Nd"/>
                        <class code="Mn"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule mark="@" name="tmark">
                  <alt>
                     <inclusion>
                        <literal dstring="^-"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="string">
                  <alt>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="dstring"/>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="s"/>
                  </alt>
                  <alt>
                     <literal tmark="-" dstring="'"/>
                     <nonterminal name="sstring"/>
                     <literal 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>
                        <literal sstring="&#34;"/>
                        <literal hex="a"/>
                        <literal hex="d"/>
                     </exclusion>
                  </alt>
                  <alt>
                     <literal sstring="&#34;"/>
                     <literal tmark="-" sstring="&#34;"/>
                  </alt>
               </rule>
               <comment>all characters except line breaks; quotes must be doubled</comment>
               <rule name="schar">
                  <alt>
                     <exclusion>
                        <literal dstring="'"/>
                        <literal hex="a"/>
                        <literal hex="d"/>
                     </exclusion>
                  </alt>
                  <alt>
                     <literal dstring="'"/>
                     <literal tmark="-" dstring="'"/>
                  </alt>
               </rule>
               <comment>all characters except line breaks; quotes must be doubled</comment>
               <rule mark="-" name="encoded">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <literal tmark="-" dstring="#"/>
                     <nonterminal mark="@" name="hex"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="hex">
                  <alt>
                     <repeat1>
                        <inclusion>
                           <range from="0" to="9"/>
                           <range from="a" to="f"/>
                           <range from="A" to="F"/>
                        </inclusion>
                     </repeat1>
                  </alt>
               </rule>
               <rule mark="-" name="charset">
                  <alt>
                     <nonterminal name="inclusion"/>
                  </alt>
                  <alt>
                     <nonterminal name="exclusion"/>
                  </alt>
               </rule>
               <rule name="inclusion">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal name="set"/>
                  </alt>
               </rule>
               <rule name="exclusion">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <literal tmark="-" dstring="~"/>
                     <nonterminal name="s"/>
                     <nonterminal name="set"/>
                  </alt>
               </rule>
               <rule mark="-" name="set">
                  <alt>
                     <literal tmark="-" dstring="["/>
                     <nonterminal name="s"/>
                     <repeat0>
                        <nonterminal name="member"/>
                        <sep>
                           <alts>
                              <alt>
                                 <inclusion tmark="-">
                                    <literal dstring=";|"/>
                                 </inclusion>
                                 <nonterminal name="s"/>
                              </alt>
                           </alts>
                        </sep>
                     </repeat0>
                     <literal tmark="-" dstring="]"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="-" name="member">
                  <alt>
                     <nonterminal name="literal"/>
                  </alt>
                  <alt>
                     <nonterminal name="range"/>
                  </alt>
                  <alt>
                     <nonterminal name="class"/>
                  </alt>
               </rule>
               <rule name="range">
                  <alt>
                     <nonterminal name="from"/>
                     <literal tmark="-" dstring="-"/>
                     <nonterminal name="s"/>
                     <nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="dchar"/>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="s"/>
                  </alt>
                  <alt>
                     <literal tmark="-" dstring="'"/>
                     <nonterminal name="schar"/>
                     <literal tmark="-" dstring="'"/>
                     <nonterminal name="s"/>
                  </alt>
                  <alt>
                     <literal dstring="#"/>
                     <nonterminal name="hex"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="class">
                  <alt>
                     <nonterminal name="code"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="@" name="code">
                  <alt>
                     <nonterminal name="capital"/>
                     <option>
                        <nonterminal name="letter"/>
                     </option>
                  </alt>
               </rule>
               <rule mark="-" name="capital">
                  <alt>
                     <inclusion>
                        <range from="A" to="Z"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule mark="-" name="letter">
                  <alt>
                     <inclusion>
                        <range from="a" to="z"/>
                     </inclusion>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="ixml">
                  <alt>
                     <nonterminal name="s"/>
                     <repeat1>
                        <nonterminal name="rule"/>
                        <sep>
                           <nonterminal name="s"/>
                        </sep>
                     </repeat1>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="-" name="s">
                  <alt>
                     <repeat0>
                        <alts>
                           <alt>
                              <nonterminal name="whitespace"/>
                           </alt>
                           <alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>
                     </repeat0>
                  </alt>
               </rule>
               <rule mark="-" name="whitespace">
                  <alt>
                     <inclusion tmark="-">
                        <class code="Zs"/>
                     </inclusion>
                  </alt>
                  <alt>
                     <nonterminal name="tab"/>
                  </alt>
                  <alt>
                     <nonterminal name="lf"/>
                  </alt>
                  <alt>
                     <nonterminal name="cr"/>
                  </alt>
               </rule>
               <rule mark="-" name="tab">
                  <alt>
                     <literal tmark="-" hex="9"/>
                  </alt>
               </rule>
               <rule mark="-" name="lf">
                  <alt>
                     <literal tmark="-" hex="a"/>
                  </alt>
               </rule>
               <rule mark="-" name="cr">
                  <alt>
                     <literal tmark="-" hex="d"/>
                  </alt>
               </rule>
               <rule name="comment">
                  <alt>
                     <literal tmark="-" dstring="{"/>
                     <repeat0>
                        <alts>
                           <alt>
                              <nonterminal name="cchar"/>
                           </alt>
                           <alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>
                     </repeat0>
                     <literal tmark="-" dstring="}"/>
                  </alt>
               </rule>
               <rule mark="-" name="cchar">
                  <alt>
                     <exclusion>
                        <literal dstring="{}"/>
                     </exclusion>
                  </alt>
               </rule>
               <rule name="rule">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="mark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal name="name"/>
                     <nonterminal name="s"/>
                     <inclusion tmark="-">
                        <literal dstring="=:"/>
                     </inclusion>
                     <nonterminal name="s"/>
                     <nonterminal mark="-" name="alts"/>
                     <literal tmark="-" dstring="."/>
                  </alt>
               </rule>
               <rule mark="@" name="mark">
                  <alt>
                     <inclusion>
                        <literal dstring="@^-"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="alts">
                  <alt>
                     <repeat1>
                        <nonterminal name="alt"/>
                        <sep>
                           <alts>
                              <alt>
                                 <inclusion tmark="-">
                                    <literal dstring=";|"/>
                                 </inclusion>
                                 <nonterminal name="s"/>
                              </alt>
                           </alts>
                        </sep>
                     </repeat1>
                  </alt>
               </rule>
               <rule name="alt">
                  <alt>
                     <repeat0>
                        <nonterminal name="term"/>
                        <sep>
                           <alts>
                              <alt>
                                 <literal tmark="-" dstring=","/>
                                 <nonterminal name="s"/>
                              </alt>
                           </alts>
                        </sep>
                     </repeat0>
                  </alt>
               </rule>
               <rule mark="-" name="term">
                  <alt>
                     <nonterminal name="factor"/>
                  </alt>
                  <alt>
                     <nonterminal name="option"/>
                  </alt>
                  <alt>
                     <nonterminal name="repeat0"/>
                  </alt>
                  <alt>
                     <nonterminal name="repeat1"/>
                  </alt>
               </rule>
               <rule mark="-" name="factor">
                  <alt>
                     <nonterminal name="terminal"/>
                  </alt>
                  <alt>
                     <nonterminal name="nonterminal"/>
                  </alt>
                  <alt>
                     <literal tmark="-" dstring="("/>
                     <nonterminal name="s"/>
                     <nonterminal name="alts"/>
                     <literal tmark="-" dstring=")"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="repeat0">
                  <alt>
                     <nonterminal name="factor"/>
                     <literal tmark="-" dstring="*"/>
                     <nonterminal name="s"/>
                     <option>
                        <nonterminal name="sep"/>
                     </option>
                  </alt>
               </rule>
               <rule name="repeat1">
                  <alt>
                     <nonterminal name="factor"/>
                     <literal tmark="-" dstring="+"/>
                     <nonterminal name="s"/>
                     <option>
                        <nonterminal name="sep"/>
                     </option>
                  </alt>
               </rule>
               <rule name="option">
                  <alt>
                     <nonterminal name="factor"/>
                     <literal tmark="-" dstring="?"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="sep">
                  <alt>
                     <nonterminal name="factor"/>
                  </alt>
               </rule>
               <rule name="nonterminal">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="mark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal name="name"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="-" name="terminal">
                  <alt>
                     <nonterminal name="literal"/>
                  </alt>
                  <alt>
                     <nonterminal name="charset"/>
                  </alt>
               </rule>
               <rule name="literal">
                  <alt>
                     <nonterminal name="quoted"/>
                  </alt>
                  <alt>
                     <nonterminal name="encoded"/>
                  </alt>
               </rule>
               <rule mark="-" name="quoted">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal mark="-" name="string"/>
                  </alt>
               </rule>
               <rule mark="@" name="name">
                  <alt>
                     <nonterminal name="namestart"/>
                     <repeat0>
                        <nonterminal name="namefollower"/>
                     </repeat0>
                  </alt>
               </rule>
               <rule mark="-" name="namestart">
                  <alt>
                     <inclusion>
                        <literal dstring="_"/>
                        <class code="L"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule mark="-" name="namefollower">
                  <alt>
                     <nonterminal name="namestart"/>
                  </alt>
                  <alt>
                     <inclusion>
                        <literal dstring="-.·‿⁀"/>
                        <class code="Nd"/>
                        <class code="Mn"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule mark="@" name="tmark">
                  <alt>
                     <inclusion>
                        <literal dstring="^-"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule name="string">
                  <alt>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="dstring"/>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="s"/>
                  </alt>
                  <alt>
                     <literal tmark="-" dstring="'"/>
                     <nonterminal name="sstring"/>
                     <literal 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>
                        <literal sstring="&#34;"/>
                        <literal hex="a"/>
                        <literal hex="d"/>
                     </exclusion>
                  </alt>
                  <alt>
                     <literal sstring="&#34;"/>
                     <literal tmark="-" sstring="&#34;"/>
                  </alt>
               </rule>
               <comment>all characters except line breaks; quotes must be doubled</comment>
               <rule name="schar">
                  <alt>
                     <exclusion>
                        <literal dstring="'"/>
                        <literal hex="a"/>
                        <literal hex="d"/>
                     </exclusion>
                  </alt>
                  <alt>
                     <literal dstring="'"/>
                     <literal tmark="-" dstring="'"/>
                  </alt>
               </rule>
               <comment>all characters except line breaks; quotes must be doubled</comment>
               <rule mark="-" name="encoded">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <literal tmark="-" dstring="#"/>
                     <nonterminal mark="@" name="hex"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="hex">
                  <alt>
                     <repeat1>
                        <inclusion>
                           <range from="0" to="9"/>
                           <range from="a" to="f"/>
                           <range from="A" to="F"/>
                        </inclusion>
                     </repeat1>
                  </alt>
               </rule>
               <rule mark="-" name="charset">
                  <alt>
                     <nonterminal name="inclusion"/>
                  </alt>
                  <alt>
                     <nonterminal name="exclusion"/>
                  </alt>
               </rule>
               <rule name="inclusion">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <nonterminal name="set"/>
                  </alt>
               </rule>
               <rule name="exclusion">
                  <alt>
                     <option>
                        <alts>
                           <alt>
                              <nonterminal name="tmark"/>
                              <nonterminal name="s"/>
                           </alt>
                        </alts>
                     </option>
                     <literal tmark="-" dstring="~"/>
                     <nonterminal name="s"/>
                     <nonterminal name="set"/>
                  </alt>
               </rule>
               <rule mark="-" name="set">
                  <alt>
                     <literal tmark="-" dstring="["/>
                     <nonterminal name="s"/>
                     <repeat0>
                        <nonterminal name="member"/>
                        <sep>
                           <alts>
                              <alt>
                                 <inclusion tmark="-">
                                    <literal dstring=";|"/>
                                 </inclusion>
                                 <nonterminal name="s"/>
                              </alt>
                           </alts>
                        </sep>
                     </repeat0>
                     <literal tmark="-" dstring="]"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="-" name="member">
                  <alt>
                     <nonterminal name="literal"/>
                  </alt>
                  <alt>
                     <nonterminal name="range"/>
                  </alt>
                  <alt>
                     <nonterminal name="class"/>
                  </alt>
               </rule>
               <rule name="range">
                  <alt>
                     <nonterminal name="from"/>
                     <literal tmark="-" dstring="-"/>
                     <nonterminal name="s"/>
                     <nonterminal name="to"/>
                  </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>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="dchar"/>
                     <literal tmark="-" sstring="&#34;"/>
                     <nonterminal name="s"/>
                  </alt>
                  <alt>
                     <literal tmark="-" dstring="'"/>
                     <nonterminal name="schar"/>
                     <literal tmark="-" dstring="'"/>
                     <nonterminal name="s"/>
                  </alt>
                  <alt>
                     <literal dstring="#"/>
                     <nonterminal name="hex"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule name="class">
                  <alt>
                     <nonterminal name="code"/>
                     <nonterminal name="s"/>
                  </alt>
               </rule>
               <rule mark="@" name="code">
                  <alt>
                     <nonterminal name="capital"/>
                     <option>
                        <nonterminal name="letter"/>
                     </option>
                  </alt>
               </rule>
               <rule mark="-" name="capital">
                  <alt>
                     <inclusion>
                        <range from="A" to="Z"/>
                     </inclusion>
                  </alt>
               </rule>
               <rule mark="-" name="letter">
                  <alt>
                     <inclusion>
                        <range from="a" to="z"/>
                     </inclusion>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 72. Document parse: 54.

Result: PASS

Actual:
<ixml>
   <rule name="ixml">
      <alt>
         <nonterminal name="s"/>
         <repeat1>
            <nonterminal name="rule"/>
            <sep>
               <nonterminal name="s"/>
            </sep>
         </repeat1>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="-" name="s">
      <alt>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="whitespace"/>
               </alt>
               <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>
         </repeat0>
      </alt>
   </rule>
   <rule mark="-" name="whitespace">
      <alt>
         <inclusion tmark="-">
            <class code="Zs"/>
         </inclusion>
      </alt>
      <alt>
         <nonterminal name="tab"/>
      </alt>
      <alt>
         <nonterminal name="lf"/>
      </alt>
      <alt>
         <nonterminal name="cr"/>
      </alt>
   </rule>
   <rule mark="-" name="tab">
      <alt>
         <literal tmark="-" hex="9"/>
      </alt>
   </rule>
   <rule mark="-" name="lf">
      <alt>
         <literal tmark="-" hex="a"/>
      </alt>
   </rule>
   <rule mark="-" name="cr">
      <alt>
         <literal tmark="-" hex="d"/>
      </alt>
   </rule>
   <rule name="comment">
      <alt>
         <literal tmark="-" dstring="{"/>
         <repeat0>
            <alts>
               <alt>
                  <nonterminal name="cchar"/>
               </alt>
               <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>
         </repeat0>
         <literal tmark="-" dstring="}"/>
      </alt>
   </rule>
   <rule mark="-" name="cchar">
      <alt>
         <exclusion>
            <literal dstring="{}"/>
         </exclusion>
      </alt>
   </rule>
   <rule name="rule">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="mark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="name"/>
         <nonterminal name="s"/>
         <inclusion tmark="-">
            <literal dstring="=:"/>
         </inclusion>
         <nonterminal name="s"/>
         <nonterminal mark="-" name="alts"/>
         <literal tmark="-" dstring="."/>
      </alt>
   </rule>
   <rule mark="@" name="mark">
      <alt>
         <inclusion>
            <literal dstring="@^-"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="alts">
      <alt>
         <repeat1>
            <nonterminal name="alt"/>
            <sep>
               <alts>
                  <alt>
                     <inclusion tmark="-">
                        <literal dstring=";|"/>
                     </inclusion>
                     <nonterminal name="s"/>
                  </alt>
               </alts>
            </sep>
         </repeat1>
      </alt>
   </rule>
   <rule name="alt">
      <alt>
         <repeat0>
            <nonterminal name="term"/>
            <sep>
               <alts>
                  <alt>
                     <literal tmark="-" dstring=","/>
                     <nonterminal name="s"/>
                  </alt>
               </alts>
            </sep>
         </repeat0>
      </alt>
   </rule>
   <rule mark="-" name="term">
      <alt>
         <nonterminal name="factor"/>
      </alt>
      <alt>
         <nonterminal name="option"/>
      </alt>
      <alt>
         <nonterminal name="repeat0"/>
      </alt>
      <alt>
         <nonterminal name="repeat1"/>
      </alt>
   </rule>
   <rule mark="-" name="factor">
      <alt>
         <nonterminal name="terminal"/>
      </alt>
      <alt>
         <nonterminal name="nonterminal"/>
      </alt>
      <alt>
         <literal tmark="-" dstring="("/>
         <nonterminal name="s"/>
         <nonterminal name="alts"/>
         <literal tmark="-" dstring=")"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="repeat0">
      <alt>
         <nonterminal name="factor"/>
         <literal tmark="-" dstring="*"/>
         <nonterminal name="s"/>
         <option>
            <nonterminal name="sep"/>
         </option>
      </alt>
   </rule>
   <rule name="repeat1">
      <alt>
         <nonterminal name="factor"/>
         <literal tmark="-" dstring="+"/>
         <nonterminal name="s"/>
         <option>
            <nonterminal name="sep"/>
         </option>
      </alt>
   </rule>
   <rule name="option">
      <alt>
         <nonterminal name="factor"/>
         <literal tmark="-" dstring="?"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="sep">
      <alt>
         <nonterminal name="factor"/>
      </alt>
   </rule>
   <rule name="nonterminal">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="mark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="name"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="-" name="terminal">
      <alt>
         <nonterminal name="literal"/>
      </alt>
      <alt>
         <nonterminal name="charset"/>
      </alt>
   </rule>
   <rule name="literal">
      <alt>
         <nonterminal name="quoted"/>
      </alt>
      <alt>
         <nonterminal name="encoded"/>
      </alt>
   </rule>
   <rule mark="-" name="quoted">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal mark="-" name="string"/>
      </alt>
   </rule>
   <rule mark="@" name="name">
      <alt>
         <nonterminal name="namestart"/>
         <repeat0>
            <nonterminal name="namefollower"/>
         </repeat0>
      </alt>
   </rule>
   <rule mark="-" name="namestart">
      <alt>
         <inclusion>
            <literal dstring="_"/>
            <class code="L"/>
         </inclusion>
      </alt>
   </rule>
   <rule mark="-" name="namefollower">
      <alt>
         <nonterminal name="namestart"/>
      </alt>
      <alt>
         <inclusion>
            <literal dstring="-.·‿⁀"/>
            <class code="Nd"/>
            <class code="Mn"/>
         </inclusion>
      </alt>
   </rule>
   <rule mark="@" name="tmark">
      <alt>
         <inclusion>
            <literal dstring="^-"/>
         </inclusion>
      </alt>
   </rule>
   <rule name="string">
      <alt>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="dstring"/>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="s"/>
      </alt>
      <alt>
         <literal tmark="-" dstring="'"/>
         <nonterminal name="sstring"/>
         <literal 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>
            <literal sstring="&#34;"/>
            <literal hex="a"/>
            <literal hex="d"/>
         </exclusion>
      </alt>
      <alt>
         <literal sstring="&#34;"/>
         <literal tmark="-" sstring="&#34;"/>
      </alt>
   </rule>
   <comment>all characters except line breaks; quotes must be doubled</comment>
   <rule name="schar">
      <alt>
         <exclusion>
            <literal dstring="'"/>
            <literal hex="a"/>
            <literal hex="d"/>
         </exclusion>
      </alt>
      <alt>
         <literal dstring="'"/>
         <literal tmark="-" dstring="'"/>
      </alt>
   </rule>
   <comment>all characters except line breaks; quotes must be doubled</comment>
   <rule mark="-" name="encoded">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <literal tmark="-" dstring="#"/>
         <nonterminal mark="@" name="hex"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="hex">
      <alt>
         <repeat1>
            <inclusion>
               <range from="0" to="9"/>
               <range from="a" to="f"/>
               <range from="A" to="F"/>
            </inclusion>
         </repeat1>
      </alt>
   </rule>
   <rule mark="-" name="charset">
      <alt>
         <nonterminal name="inclusion"/>
      </alt>
      <alt>
         <nonterminal name="exclusion"/>
      </alt>
   </rule>
   <rule name="inclusion">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <nonterminal name="set"/>
      </alt>
   </rule>
   <rule name="exclusion">
      <alt>
         <option>
            <alts>
               <alt>
                  <nonterminal name="tmark"/>
                  <nonterminal name="s"/>
               </alt>
            </alts>
         </option>
         <literal tmark="-" dstring="~"/>
         <nonterminal name="s"/>
         <nonterminal name="set"/>
      </alt>
   </rule>
   <rule mark="-" name="set">
      <alt>
         <literal tmark="-" dstring="["/>
         <nonterminal name="s"/>
         <repeat0>
            <nonterminal name="member"/>
            <sep>
               <alts>
                  <alt>
                     <inclusion tmark="-">
                        <literal dstring=";|"/>
                     </inclusion>
                     <nonterminal name="s"/>
                  </alt>
               </alts>
            </sep>
         </repeat0>
         <literal tmark="-" dstring="]"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="-" name="member">
      <alt>
         <nonterminal name="literal"/>
      </alt>
      <alt>
         <nonterminal name="range"/>
      </alt>
      <alt>
         <nonterminal name="class"/>
      </alt>
   </rule>
   <rule name="range">
      <alt>
         <nonterminal name="from"/>
         <literal tmark="-" dstring="-"/>
         <nonterminal name="s"/>
         <nonterminal name="to"/>
      </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>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="dchar"/>
         <literal tmark="-" sstring="&#34;"/>
         <nonterminal name="s"/>
      </alt>
      <alt>
         <literal tmark="-" dstring="'"/>
         <nonterminal name="schar"/>
         <literal tmark="-" dstring="'"/>
         <nonterminal name="s"/>
      </alt>
      <alt>
         <literal dstring="#"/>
         <nonterminal name="hex"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule name="class">
      <alt>
         <nonterminal name="code"/>
         <nonterminal name="s"/>
      </alt>
   </rule>
   <rule mark="@" name="code">
      <alt>
         <nonterminal name="capital"/>
         <option>
            <nonterminal name="letter"/>
         </option>
      </alt>
   </rule>
   <rule mark="-" name="capital">
      <alt>
         <inclusion>
            <range from="A" to="Z"/>
         </inclusion>
      </alt>
   </rule>
   <rule mark="-" name="letter">
      <alt>
         <inclusion>
            <range from="a" to="z"/>
         </inclusion>
      </alt>
   </rule>
</ixml>

ixml1

Input 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; comment)*.
comment: "{", cchar*, "}".
-cchar: ~["}"].
{the end}
Test ixml1

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 text
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}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ixml1.output.xml"/>
</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>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="29"
        documentParse="23">
   <comparison>
      <expected>
         <ns xmlns="">
            <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>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <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>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 29. Document parse: 23.

Result: PASS

Actual:
<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>

ixml2

Input grammar
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, to.
@from: character.
@to: character.
-character: -'"', dchar, -'"', S;
            -"'", schar, -"'", S;
            hex.
class: letter, letter, S. {One of the Unicode character classes}
-letter: ["a"-"z"; "A"-"Z"].
@name: letgit, xletter*, S.
-letgit: ["a"{first}-"z"; "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.

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

{the end}
Test ixml2
Input text
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, to.
@from: character.
@to: character.
-character: -'"', dchar, -'"', S;
            -"'", schar, -"'", S;
            hex.
class: letter, letter, S. {One of the Unicode character classes}
-letter: ["a"-"z"; "A"-"Z"].
@name: letgit, xletter*, S.
-letgit: ["a"-"z"; "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.

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

{the end}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ixml2.output.xml"/>
</result>
<ixml>
   <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"/>, <quoted dstring="-"/>, <nonterminal name="S"/>, <nonterminal name="to"/>
      </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;"/>, <nonterminal name="S"/>
      </alt>;            <alt>
         <quoted tmark="-" dstring="'"/>, <nonterminal name="schar"/>, <quoted tmark="-" dstring="'"/>, <nonterminal name="S"/>
      </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">-</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>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">: <alt>
         <repeat0>(<alts>
               <alt>
                  <quoted dstring=" "/>
               </alt>; <alt>
                  <encoded hex="#9"/>
               </alt>; <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule 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>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="41"
        documentParse="30">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml>
               <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"/>, <quoted dstring="-"/>, <nonterminal name="S"/>, <nonterminal name="to"/>
                  </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;"/>, <nonterminal name="S"/>
                  </alt>;            <alt>
                     <quoted tmark="-" dstring="'"/>, <nonterminal name="schar"/>, <quoted tmark="-" dstring="'"/>, <nonterminal name="S"/>
                  </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">-</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>, <nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">: <alt>
                     <repeat0>(<alts>
                           <alt>
                              <quoted dstring=" "/>
                           </alt>; <alt>
                              <encoded hex="#9"/>
                           </alt>; <alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule 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>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <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"/>, <quoted dstring="-"/>, <nonterminal name="S"/>, <nonterminal name="to"/>
                  </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;"/>, <nonterminal name="S"/>
                  </alt>;            <alt>
                     <quoted tmark="-" dstring="'"/>, <nonterminal name="schar"/>, <quoted tmark="-" dstring="'"/>, <nonterminal name="S"/>
                  </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">-</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>, <nonterminal name="S"/>
                  </alt>.</rule>
               <rule mark="-" name="S">: <alt>
                     <repeat0>(<alts>
                           <alt>
                              <quoted dstring=" "/>
                           </alt>; <alt>
                              <encoded hex="#9"/>
                           </alt>; <alt>
                              <nonterminal name="comment"/>
                           </alt>
                        </alts>)*</repeat0>
                  </alt>.</rule>
               <rule 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>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 41. Document parse: 30.

Result: PASS

Actual:
<ixml>
   <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"/>, <quoted dstring="-"/>, <nonterminal name="S"/>, <nonterminal name="to"/>
      </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;"/>, <nonterminal name="S"/>
      </alt>;            <alt>
         <quoted tmark="-" dstring="'"/>, <nonterminal name="schar"/>, <quoted tmark="-" dstring="'"/>, <nonterminal name="S"/>
      </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">-</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>, <nonterminal name="S"/>
      </alt>.</rule>
   <rule mark="-" name="S">: <alt>
         <repeat0>(<alts>
               <alt>
                  <quoted dstring=" "/>
               </alt>; <alt>
                  <encoded hex="#9"/>
               </alt>; <alt>
                  <nonterminal name="comment"/>
               </alt>
            </alts>)*</repeat0>
      </alt>.</rule>
   <rule 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>

ixml3

Input 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; comment)*.
^comment: "{", cchar*, "}".
-cchar: ~["}"].

{the end}
Test ixml3
Input text
{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}
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-xml-ref href="ixml3.output.xml"/>
</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>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="43"
        documentParse="31">
   <comparison>
      <expected>
         <ns xmlns="">
            <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>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <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>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 43. Document parse: 31.

Result: PASS

Actual:
<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>
file:/home/circleci/project/ixml/tests/parse/test-catalog.xml

Amsterdam Test Suite 1, parse tests, 2021-12-21

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

parse-error

Input grammar
a: "a", punctuation, "b".
punctuation: [",.;:'?!</&>"].
Test parse-error
Input text
a b<&>.
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
</result>
Grammar parse: 1.

Result: PASS

url

Input grammar
url: scheme, ":", authority, path.
scheme: name.
@name: letter+.
authority: "//", host.
host: sub++".".
sub: name.
path: ("/", seg)+.
seg: sname.
@sname: fletter*.
-letter: ["a"-"z"]; ["A"-"Z"]; ["0"-"9"].
-fletter: letter; ".".

Test url
Input text
http://http://@http://http://
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="8"
        documentParse="0">
</result>
Grammar parse: 8.

Result: PASS

url1

Input grammar
url: scheme, ":", authority, path.
@scheme: name.
-name: letter+.
-authority: "//", host.
host: sub++".".
-sub: name.
path: ("/", seg)+.
-seg: sname.
-sname: fletter*.
-letter: ["a"-"z"]; ["A"-"Z"]; ["0"-"9"].
-fletter: letter; ".".

Test url1
Input text
http://www.w3.org/TR/1999/xhtml.html#date?name=fred

<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-sentence/>
   <!--
  	      <assert-xml-ref href="url1.output.xml"/>
  	  -->
</result>

Expected: input does not match.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="8"
        documentParse="0">
</result>
Grammar parse: 8.

Result: PASS

The grammar as written allows no hash mark and fragment identifier. The intent may have been to formulate a grammar that allowed them, but the simplest change to bring it into a consistent state is to change the result.

For the record, the originally asserted result is now in file 'url1.disputed-output.xml'.

file:/home/circleci/project/ixml/tests/error/test-catalog.xml

Error tests, 2022-02-19

Tests intended to demonstrate errors that processors are required to raise.

hex-much-too-big

The number is so large it’s like to exceed the processor’s ability to represent it.

Input grammar
s: #decafbadbadbadbad .
Test hex-much-too-big
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1">
</result>
Grammar parse: 1.

Result: PASS

hex-too-big

Exceeds the range of Unicode.

Input grammar
s: #ffffffff0 .
Test hex-too-big
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0">
</result>

Result: PASS

hex-not-a-character

Not a Unicode character.

Input grammar
s: #fffe .
Test hex-not-a-character
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0">
</result>

Result: PASS

hex-also-not-a-character

Also not a Unicode character.

Input grammar
s: #1fffe .
Test hex-also-not-a-character
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0">
</result>

Result: PASS

hex-surrogate

A Unicode surrogate.

Input grammar
s: #d801 .
Test hex-surrogate
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1">
</result>
Grammar parse: 1.

Result: PASS

bad-class

An invalid Unicode character class.

Input grammar
s: [Xq] .
Test bad-class
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0">
</result>

Result: PASS

invalid-range

An invalid range.

Input grammar
s: ['Z'-'A'] .
Test invalid-range
<result xmlns="https://github.com/cmsmcq/ixml-tests">
   <assert-not-a-grammar/>
</result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="0">
</result>

Result: PASS

file:/home/circleci/project/ixml/tests/hygiene/test-catalog.xml

Improper grammars, 2022-03-14

This test set collects some grammars which have various forms of useless rules. Some but not all of these are non-conforming under the current (2022-02-22) rules of ixml.

Note: This test catalog includes alternate results for processors operating in non-standard modes. These are included after the result element, wrapped in an app-info element. The app-info element also contains tc:options elements describing the conditions under which the result holds. Conditions are assumed to be describable by sets of name/value (usually option/setting) pairs, expressed on the options element as attribute-value specifications. If all the option/setting pairs on any options element in the app-info element apply, then any of the results specified in the app-info element is acceptable. (So: for both the options elements and the results in the app-info there is an implicit disjunction: if any of the options elements applies, then any of the results is OK. For the various name/value pairs on an options element, there is an implicit conjunction: the options element applies if ALL of the name/value pairs apply.)

In the current state of this catalog, the only options specified are in the ap:* namespace; these have the local names 'multiple-definitions', 'undefined-symbols', 'unreachable-symbols', and 'unproductive-symbols', with meanings which I hope are obvious. In all cases, the possible values are "error", "warning", and "silence". In non-error cases, the grammar may be rewritten internally to eliminate the problem, but unless the user requests that the compiled grammar be returned, there is really no way to know whether this happens or not.

For strict ixml conformance, the prescribed values are ap:multiple-definitions = "error", ap:undefined-symbols = "error", ap:unreachable-symbols = "warning" or "silence", and ap:unproductive-symbols = "warning" or "silence".

Note that the handling of options is experimental and subject to change without warning. Anyone using this test set who has opinions or suggestions on the right way to handle such options is invited to contact the author.

Note also that a test-case result of assert-not-a-grammar is used here in test cases for what the spec will, I believe, eventually describe as dynamic errors in the grammar, or just as dynamic errors. (Greetings from the past, o future user! If in your world another result is prescribed, like for instance assert-dynamic-error, then you are going to need to update this catalog. The same applies if you want to specify particular error codes to be raised for particular test cases.)

multi-1

A grammar with multiple rules for the same nonterminal.

Input grammar

      S = 'a'.
      S = 'b'.
    
Grammar test

The ixml spec defines this as a non-conforming grammar.

<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:multiple-definitions="warning"/>
   <tc:options ap:multiple-definitions="silence"/>
   <tc:assert-xml>
      <ixml>
         <rule name="S">
            <alt>
               <literal string="a"/>
            </alt>
         </rule>
         <rule name="S">
            <alt>
               <literal string="b"/>
            </alt>
         </rule>
      </ixml>
   </tc:assert-xml>
   <tc:assert-xml>
      <ixml>
         <rule name="S">
            <alt>
               <literal string="a"/>
            </alt>
            <alt>
               <literal string="b"/>
            </alt>
         </rule>
      </ixml>
   </tc:assert-xml>
</tc:app-info>
  • ap:multiple-definitions = warning

or

  • ap:multiple-definitions = silence
Expect one of:
<ixml xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
      xmlns:ixml="http://invisiblexml.org/NS"
      xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <rule name="S">
      <alt>
         <literal string="a"/>
      </alt>
   </rule>
   <rule name="S">
      <alt>
         <literal string="b"/>
      </alt>
   </rule>
</ixml>

or

<ixml xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
      xmlns:ixml="http://invisiblexml.org/NS"
      xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <rule name="S">
      <alt>
         <literal string="a"/>
      </alt>
      <alt>
         <literal string="b"/>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="1">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
                  xmlns:ixml="http://invisiblexml.org/NS"
                  xmlns:tc="https://github.com/cmsmcq/ixml-tests">
               <rule name="S">
                  <alt>
                     <literal string="a"/>
                  </alt>
               </rule>
               <rule name="S">
                  <alt>
                     <literal string="b"/>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <literal string="a"/>
                  </alt>
               </rule>
               <rule name="S">
                  <alt>
                     <literal string="b"/>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 2. Document parse: 1.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <literal string="a"/>
      </alt>
   </rule>
   <rule name="S">
      <alt>
         <literal string="b"/>
      </alt>
   </rule>
</ixml>
Test md-1

Input text

<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1">
</result>
Grammar parse: 1.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:multiple-definitions="warning"/>
   <tc:options ap:multiple-definitions="silence"/>
   <tc:assert-not-a-sentence/>
</tc:app-info>
  • ap:multiple-definitions = warning

or

  • ap:multiple-definitions = silence
Expect:
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <S xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
               xmlns:ixml="http://invisiblexml.org/NS"
               xmlns:tc="https://github.com/cmsmcq/ixml-tests">a</S>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <S>a</S>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<S>a</S>
Test md-2

Input text

a
<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2">
</result>
Grammar parse: 2.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:multiple-definitions="warning"/>
   <tc:options ap:multiple-definitions="silence"/>
   <tc:assert-xml>
      <S>a</S>
   </tc:assert-xml>
</tc:app-info>
  • ap:multiple-definitions = warning

or

  • ap:multiple-definitions = silence
Expect:
<S xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
   xmlns:ixml="http://invisiblexml.org/NS"
   xmlns:tc="https://github.com/cmsmcq/ixml-tests">a</S>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <S xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
               xmlns:ixml="http://invisiblexml.org/NS"
               xmlns:tc="https://github.com/cmsmcq/ixml-tests">b</S>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <S>b</S>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1.

Result: PASS

Actual:
<S>b</S>
Test md-3

Input text

b
<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1">
</result>
Grammar parse: 1.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:multiple-definitions="warning"/>
   <tc:options ap:multiple-definitions="silence"/>
   <tc:assert-xml>
      <S>b</S>
   </tc:assert-xml>
</tc:app-info>
  • ap:multiple-definitions = warning

or

  • ap:multiple-definitions = silence
Expect:
<S xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
   xmlns:ixml="http://invisiblexml.org/NS"
   xmlns:tc="https://github.com/cmsmcq/ixml-tests">b</S>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="0">
</result>
Grammar parse: 1.

Result: PASS

undefined-1

A grammar with an undefined nonterminal.

Any right-hand side with a required reference to X is useless because X is undefined. Once in the sentential form, X will stay there because it cannot be rewritten. So the right-hand with the reference can never occur in the successful derivation of a sentence.

A simpler grammar that accepts the same language and produces the same parse trees is: S = A; B; '(', S, ')'. A = 'a'. B = 'b'; B.

Input grammar

      S = A; B; '(', S, ')'.
      A = 'a'; X, A.
      B = 'b'; B, X*.
    
Grammar test

The ixml spec defines this as a non-conforming grammar.

<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="3">
</result>
Grammar parse: 2. Document parse: 3.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:undefined-symbols="warning"/>
   <tc:options ap:undefined-symbols="silence"/>
   <tc:assert-xml>
      <ixml>
         <rule name="S">
            <alt>
               <nonterminal name="A"/>
            </alt>
            <alt>
               <nonterminal name="B"/>
            </alt>
            <alt>
               <literal string="("/>
               <nonterminal name="S"/>
               <literal string=")"/>
            </alt>
         </rule>
         <rule name="A">
            <alt>
               <literal string="a"/>
            </alt>
            <alt>
               <nonterminal name="X"/>
               <nonterminal name="A"/>
            </alt>
         </rule>
         <rule name="B">
            <alt>
               <literal string="b"/>
            </alt>
            <alt>
               <nonterminal name="B"/>
               <repeat0>
                  <nonterminal name="X"/>
               </repeat0>
            </alt>
         </rule>
      </ixml>
   </tc:assert-xml>
   <tc:assert-xml>
      <ixml>
         <rule name="S">
            <alt>
               <nonterminal name="A"/>
            </alt>
            <alt>
               <nonterminal name="B"/>
            </alt>
            <alt>
               <literal string="("/>
               <nonterminal name="S"/>
               <literal string=")"/>
            </alt>
         </rule>
         <rule name="A">
            <alt>
               <literal string="a"/>
            </alt>
         </rule>
         <rule name="B">
            <alt>
               <literal string="b"/>
            </alt>
            <alt>
               <nonterminal name="B"/>
            </alt>
         </rule>
      </ixml>
   </tc:assert-xml>
</tc:app-info>
  • ap:undefined-symbols = warning

or

  • ap:undefined-symbols = silence
Expect one of:
<ixml xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
      xmlns:ixml="http://invisiblexml.org/NS"
      xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <rule name="S">
      <alt>
         <nonterminal name="A"/>
      </alt>
      <alt>
         <nonterminal name="B"/>
      </alt>
      <alt>
         <literal string="("/>
         <nonterminal name="S"/>
         <literal string=")"/>
      </alt>
   </rule>
   <rule name="A">
      <alt>
         <literal string="a"/>
      </alt>
      <alt>
         <nonterminal name="X"/>
         <nonterminal name="A"/>
      </alt>
   </rule>
   <rule name="B">
      <alt>
         <literal string="b"/>
      </alt>
      <alt>
         <nonterminal name="B"/>
         <repeat0>
            <nonterminal name="X"/>
         </repeat0>
      </alt>
   </rule>
</ixml>

or

<ixml xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
      xmlns:ixml="http://invisiblexml.org/NS"
      xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <rule name="S">
      <alt>
         <nonterminal name="A"/>
      </alt>
      <alt>
         <nonterminal name="B"/>
      </alt>
      <alt>
         <literal string="("/>
         <nonterminal name="S"/>
         <literal string=")"/>
      </alt>
   </rule>
   <rule name="A">
      <alt>
         <literal string="a"/>
      </alt>
   </rule>
   <rule name="B">
      <alt>
         <literal string="b"/>
      </alt>
      <alt>
         <nonterminal name="B"/>
      </alt>
   </rule>
</ixml>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="1"
        documentParse="3">
   <comparison>
      <expected>
         <ns xmlns="">
            <ixml xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
                  xmlns:ixml="http://invisiblexml.org/NS"
                  xmlns:tc="https://github.com/cmsmcq/ixml-tests">
               <rule name="S">
                  <alt>
                     <nonterminal name="A"/>
                  </alt>
                  <alt>
                     <nonterminal name="B"/>
                  </alt>
                  <alt>
                     <literal string="("/>
                     <nonterminal name="S"/>
                     <literal string=")"/>
                  </alt>
               </rule>
               <rule name="A">
                  <alt>
                     <literal string="a"/>
                  </alt>
                  <alt>
                     <nonterminal name="X"/>
                     <nonterminal name="A"/>
                  </alt>
               </rule>
               <rule name="B">
                  <alt>
                     <literal string="b"/>
                  </alt>
                  <alt>
                     <nonterminal name="B"/>
                     <repeat0>
                        <nonterminal name="X"/>
                     </repeat0>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <ixml>
               <rule name="S">
                  <alt>
                     <nonterminal name="A"/>
                  </alt>
                  <alt>
                     <nonterminal name="B"/>
                  </alt>
                  <alt>
                     <literal string="("/>
                     <nonterminal name="S"/>
                     <literal string=")"/>
                  </alt>
               </rule>
               <rule name="A">
                  <alt>
                     <literal string="a"/>
                  </alt>
                  <alt>
                     <nonterminal name="X"/>
                     <nonterminal name="A"/>
                  </alt>
               </rule>
               <rule name="B">
                  <alt>
                     <literal string="b"/>
                  </alt>
                  <alt>
                     <nonterminal name="B"/>
                     <repeat0>
                        <nonterminal name="X"/>
                     </repeat0>
                  </alt>
               </rule>
            </ixml>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 1. Document parse: 3.

Result: PASS

Actual:
<ixml>
   <rule name="S">
      <alt>
         <nonterminal name="A"/>
      </alt>
      <alt>
         <nonterminal name="B"/>
      </alt>
      <alt>
         <literal string="("/>
         <nonterminal name="S"/>
         <literal string=")"/>
      </alt>
   </rule>
   <rule name="A">
      <alt>
         <literal string="a"/>
      </alt>
      <alt>
         <nonterminal name="X"/>
         <nonterminal name="A"/>
      </alt>
   </rule>
   <rule name="B">
      <alt>
         <literal string="b"/>
      </alt>
      <alt>
         <nonterminal name="B"/>
         <repeat0>
            <nonterminal name="X"/>
         </repeat0>
      </alt>
   </rule>
</ixml>
Test undef-1

Input text

<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3">
</result>
Grammar parse: 3.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:undefined-symbols="warning"/>
   <tc:options ap:undefined-symbols="silence"/>
   <tc:assert-not-a-sentence/>
</tc:app-info>
  • ap:undefined-symbols = warning

or

  • ap:undefined-symbols = silence
Expect:
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="2"
        documentParse="0">
</result>
Grammar parse: 2.

Result: PASS

Test undef-2

Input text

a
<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3">
</result>
Grammar parse: 3.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:undefined-symbols="warning"/>
   <tc:options ap:undefined-symbols="silence"/>
   <tc:assert-xml>
      <S>
         <A>a</A>
      </S>
   </tc:assert-xml>
</tc:app-info>
  • ap:undefined-symbols = warning

or

  • ap:undefined-symbols = silence
Expect:
<S xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
   xmlns:ixml="http://invisiblexml.org/NS"
   xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <A>a</A>
</S>
<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3"
        documentParse="0">
   <comparison>
      <expected>
         <ns xmlns="">
            <S xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
               xmlns:ixml="http://invisiblexml.org/NS"
               xmlns:tc="https://github.com/cmsmcq/ixml-tests">
               <A>a</A>
            </S>
         </ns>
      </expected>
      <actual>
         <ns xmlns="">
            <S>
               <A>a</A>
            </S>
         </ns>
      </actual>
      <message/>
   </comparison>
</result>
Grammar parse: 3.

Result: PASS

Actual:
<S>
   <A>a</A>
</S>
Test undef-3

Input text

b
<tc:result xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
           xmlns:ixml="http://invisiblexml.org/NS"
           xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:assert-not-a-grammar/>
</tc:result>

Expected: not an Invisible XML grammar.

<result xmlns="https://nineml.org/ns/test-results"
        state="PASS"
        grammarParse="3">
</result>
Grammar parse: 3.

Result: PASS

With optional features
<tc:app-info xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
             xmlns:ixml="http://invisiblexml.org/NS"
             xmlns:tc="https://github.com/cmsmcq/ixml-tests">
   <tc:options ap:undefined-symbols="warning"/>
   <tc:options ap:undefined-symbols="silence"/>
   <tc:assert-xml>
      <S ixml:state="ambiguous">
         <B>b</B>
      </S>
   </tc:assert-xml>
   <tc:assert-xml>
      <S ixml:state="ambiguous">
         <B>
            <B>b</B>
         </B>
      </S>
   </tc:assert-xml>
   <tc:assert-