iXML Community Group Test Suite

23 Oct 2023 (22 Nov 2023)

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

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

Improper grammars

01 Jun 2022

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-06-01) 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.)

non-productive-2

Created 12 Mar 2022 by cmsmcq

A grammar with two unproductive nonterminals. Neither A nor C can produce a sequence of terminal symbols, so once they appear in a sentential form the derivation process will never terminate. The grammar can be rewritten in an equivalent form without their rules, as "S = B. B = 'b'."

Invisible XML Grammar


      S = A; B.
      A = 'a', C.
      B = 'b'; C.
      C = '(', A, ')'.      
    

Test case: Grammar test

Repository URI: …/tests/grammar-misc/test-catalog.xml

Expected result

<ixml xmlns:ap="http://blackmesatech.com/2019/iXML/Aparecium"
       xmlns:ixml="http://invisiblexml.org/NS"
       xmlns:tc="https://github.com/invisibleXML/ixml/test-catalog">
   <rule name="S">
      <alt>
         <nonterminal name="A"/>
      </alt>
      <alt>
         <nonterminal name="B"/>
      </alt>
   </rule>
   <rule name="A">
      <alt>
         <literal string="a"/>
         <nonterminal name="C"/>
      </alt>
   </rule>
   <rule name="B">
      <alt>
         <literal string="b"/>
      </alt>
      <alt>
         <nonterminal name="C"/>
      </alt>
   </rule>
   <rule name="C">
      <alt>
         <literal string="("/>
         <nonterminal name="A"/>
         <literal string=")"/>
      </alt>
   </rule>
</ixml>

Application specific extension

  • Q{http://blackmesatech.com/2019/iXML/Aparecium}unproductive-symbols = error

Expected result

The grammar is invalid. Raises a static error.