[ 
https://issues.apache.org/jira/browse/DAFFODIL-1971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17948966#comment-17948966
 ] 

Steve Lawrence commented on DAFFODIL-1971:
------------------------------------------

We may already have that here:

https://github.com/apache/daffodil/blob/main/daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/SequenceGroup.scala#L166-L176

Or maybe something different is used for choice branches and we need to mimic 
that function somewhere else?

We should also add tests to make sure the subsequence suggestion behaves the 
same as current daffodil.

> Statement order of evaluation not per DFDL Spec
> -----------------------------------------------
>
>                 Key: DAFFODIL-1971
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1971
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Middle "End"
>    Affects Versions: 2.1.0
>            Reporter: Mike Beckerle
>            Assignee: Josh Adams
>            Priority: Major
>             Fix For: 4.0.0
>
>
> Per the DFDL spec section 9.5, the order of evaluation of statements for 
> model groups is not correct.
> This appears in the grammar
> {code}
>   final override lazy val termContentBody = prod("termContentBody") {
>     dfdlStatementEvaluations ~ groupLeftFraming ~ _content ~ groupRightFraming
>   }
> {code}
> This puts all the statement evaluations first. 
> However, asserts or discriminators with test expressions (not patterns) are 
> executed AFTER the content of the group. So this needs to be split up so that 
> the statements that are supposed to execute before appear before, and the 
> ones that execute after are after.
> Note that per DFDL spec section 7.4.1, discriminators and asserts are 
> mutually exclusive, and while there can be multiple asserts, there can be 
> only one discriminator at a single annotation point.
> Note also DFDL spec section 9.5.2, which specifies that discriminators are 
> evaluated even if the parsing of the content fails. This will also require 
> special treatment in the model group combinators to be sure discriminators 
> execute. The same problem does not occur for elements because the element 
> combinators explicitly execute discriminators regardless of failure of the 
> element, and after they are parsed. 
> test test_discrimExpression_04 behaves incorrectly because of this bug.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to