mbeckerle commented on a change in pull request #369:
URL: https://github.com/apache/incubator-daffodil/pull/369#discussion_r417368770
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/grammar/HasStatementsGrammarMixin.scala
##########
@@ -18,10 +18,11 @@
package org.apache.daffodil.grammar
import org.apache.daffodil.dsom.Term
+import org.apache.daffodil.dsom.DFDLNewVariableInstance
trait HasStatementsGrammarMixin extends GrammarMixin { self: Term =>
- private lazy val statementGrams = statements.map { _.gram(self) }
+ private lazy val statementGrams = statements.filter{ st =>
!st.isInstanceOf[DFDLNewVariableInstance] }.map { _.gram(self) }
Review comment:
Yeah, at one time I thought the grammar would implicitly orchestrate the
order of all these things, and that was the original intent as you've
recognized.
But over time we've moved toward a style of just passing a bunch of Gram
objects to a combinator which orchestrates them internally, differentiates
parse from unparse behavior accordingly, etc. This has the downside of every
combinator having to deal with optimizing away in case of empty Gram objects
for the various args, but the advantage of the resulting stack of combinators
being better motivated than a bunch of sequencing operations only.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]