Hello DFDL community,

My DFDL schema computes the initiator and terminator.

The input first has a number, followed by a comma-separated pair of values, 
possibly enclosed within round parentheses or square parentheses.

I ran my schema on this input:

1
(Apple,Banana)

And it generates this output:

<input>
  <num>1</num>
  <A>Apple</A>
  <B>Banana</B>
</input>

This input:

2
[Apple,Banana]

generates this output:

<input>
  <num>2</num>
  <A>Apple</A>
  <B>Banana</B>
</input>

But this input:

3
Apple,Banana

Throws the error shown below.

Here is my DFDL schema:

<xs:element name="input">
    <xs:complexType>
        <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="infix">
            <xs:element name="num" type="xs:integer" />
            <xs:sequence dfdl:initiator="{if (num eq 1) then '(' else if (num 
eq 2) then '[' else ''}"
                dfdl:terminator="{if (num eq 1) then ')' else if (num eq 2) 
then ']' else ''}"
                dfdl:separator="," dfdl:separatorPosition="infix">
                <xs:element name="A" type="xs:string" />
                <xs:element name="B" type="xs:string" />
            </xs:sequence>
        </xs:sequence>
    </xs:complexType>
</xs:element>

Am I doing something wrong in calculating the initiator and terminator?  /Roger

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!   An unexpected exception occurred. This is a bug!   !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Please report this bug and help us fix it:

  https://daffodil.apache.org/community/#issue-tracker

Please include the following exception, the command you
ran, and any input, schema, or tdml files used that led
to this bug.


org.apache.daffodil.exceptions.Abort: Invariant broken: 
MPState.this.delimitersLocalIndexStack.length.==(1)
org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
org.apache.daffodil.processors.parsers.MPState.verifyFinalState(PState.scala:141)
org.apache.daffodil.processors.parsers.PState.verifyFinalState(PState.scala:345)
org.apache.daffodil.processors.DataProcessor.doParse(Runtime.scala:238)
        at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129)
        at 
org.apache.daffodil.processors.parsers.MPState.verifyFinalState(PState.scala:141)
        at 
org.apache.daffodil.processors.parsers.PState.verifyFinalState(PState.scala:345)
        at 
org.apache.daffodil.processors.DataProcessor.doParse(Runtime.scala:238)
        at 
org.apache.daffodil.processors.DataProcessor.$anonfun$parse$1(Runtime.scala:196)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at 
org.apache.daffodil.ExecutionMode$.$anonfun$usingRuntimeMode$1(ExecutionMode.scala:65)
        at org.apache.daffodil.processors.DataProcessor.parse(Runtime.scala:188)
        at org.apache.daffodil.processors.DataProcessor.parse(Runtime.scala:184)
        at org.apache.daffodil.Main$.$anonfun$run$1(Main.scala:860)
        at org.apache.daffodil.util.Timer$.getTimeResult(Timer.scala:76)
        at org.apache.daffodil.util.Timer$.getResult(Timer.scala:35)
        at org.apache.daffodil.Main$.run(Main.scala:860)
        at org.apache.daffodil.Main$.main(Main.scala:1345)
        at org.apache.daffodil.Main.main(Main.scala)

Reply via email to