mbeckerle commented on code in PR #1369:
URL: https://github.com/apache/daffodil/pull/1369#discussion_r1838654450
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ModelGroupGrammarMixin.scala:
##########
@@ -50,8 +50,8 @@ trait ModelGroupGrammarMixin
// See 9.5 Evaluation Order for Statement Annotations
dfdlPatternStatementEvaluations ~ // Assert and Discriminator statements
with testKind="pattern"
dfdlScopeBegin ~ // newVariableInstance
- dfdlLowPriorityStatementEvaluations ~ // setVariable and the rest of the
Assert and Discriminator statements
- groupLeftFraming ~ groupContentWithInitiatorTerminator ~
groupRightFraming ~ dfdlScopeEnd
+ setVariableEvaluations ~
+ groupLeftFraming ~ groupContentWithInitiatorTerminator ~
nonPatternEvaluations ~ groupRightFraming ~ dfdlScopeEnd
Review Comment:
I think more is needed than this repositioning of the evaluation order.
The enclosing term combinator (for an element or a model group) may need to
get the nonPatternEvaluations separately from the rest of the sequence of
things to do. In fact, it might be necessary to isolate the
nonPatternDiscriminatorEvaluations from the regular non-pattern asserts, as
they get slightly different treatment.
So rather than this big long ~ separated sequence, you'll need the
combinator to be passed this sequence up to, but not including the
nonPatternDiscriminatorEvaluations, then pass the
nonPatternDiscriminatorEvaluations, and then everything after those. The
combinator then orchestrates evaluating the "body", then the
nonPatternDiscriminatorEvaluations, that may set the discriminator true on the
stack, and if so that changes the way the "body" failure will be handled.
This whole thing is kind of a trick to make it possible for
discriminator/assert statements to look downward into the complexType/group on
which they are expressed, instead of having to refer only backward to prior
already parsed fields.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]