2

I am defining a grammar using SRGS format. I know I could use one of the following:

<rule id="somerule" scope="private">
 ...
    <one-of>
      <item>item 1<tag> out.chosen="item 1"</tag></item>
      <item>item 2<tag> out.chosen="item 2"</tag></item>
      ...
    </one-of>
    ...
 </rule>

or

<rule id="somerule" scope="private">
    ...
    <ruleref uri="#somerule2" />
    <tag> out.chose = rules.latest();  </tag>
    ...
</rule>

<rule id="somerule2" scope="private">    
    <one-of>
      <item>item 1</item>
      <item>item 2</item>
      ...
    </one-of>    
  </rule>

I was wondering if there is an alternative simpler way without defining a second rule and without duplicating each value (like in first example). Something like

<rule id="somerule" scope="private">
  ...
    <one-of>
      <item>item 1</item>
      <item>item 2</item>
      ...
    </one-of>
    <tag> out.chosen = ??? </tag>
  ...
</rule>
Paolo Vigori
  • 1,612
  • 1
  • 18
  • 32
  • It would be worth trying to nest a rule within a rule, and then referencing that locally.. not fully sure if it would be correct , or even if it would save you any effort, but it would be interesting to test if it is possible! – Priyank Apr 09 '17 at 17:21

0 Answers0