[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] stevedlawrence commented on a change in pull request #61: Base64, gzip, and line-folding layering

stevedlawrence commented on a change in pull request #61: Base64, gzip, and line-folding layering

 File path: daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/LayeredSequence.scala
 @@ -0,0 +1,60 @@
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.daffodil.grammar.primitives
+import org.apache.daffodil.grammar.Terminal
+import org.apache.daffodil.dsom._
+import org.apache.daffodil.processors.parsers.{ Parser => DaffodilParser }
+import org.apache.daffodil.processors.unparsers.{ Unparser => DaffodilUnparser }
+import org.apache.daffodil.grammar.Gram
+import org.apache.daffodil.grammar.EmptyGram
+import org.apache.daffodil.util.Misc
+import org.apache.daffodil.processors.parsers.LayeredSequenceParser
+import org.apache.daffodil.processors.unparsers.LayeredSequenceUnparser
+case class LayeredSequence(sq: SequenceTermBase, rawTerms: Seq[Gram])
+  extends Terminal(sq, true) {
 Review comment:
   This looks basically the same as the sequence combinator (which will change in the near future), which makes me ask how it is different. So first, the rawTerms should always have a length of one, since there should only ever be a single term in a layered sequence. Is that enforced?
   Also, say the single term is an array? Will the fact that it's an array essentially be ignored, since that will be handled by the sequence combinator, but is no longer in the grammar?
   I'm almost wondering if maybe the grammar should just become something like
   LayeredSequence(this, SequenceCombinator(this, terms))
   So the LayeredSequenceParser just creates a new layer and then calls seqCombParser.parse1(), which handles all the same logic it normally would. This removes some of the duplication.
   Also, would this allow one to have non-layering properties on a layered sequence? And is that a restriction worth lifting? It seems like it greatly simplifies things, but the grammar was like above, maybe it would be a pretty straightforward change. The SequenceCombinator doesn't care that it's layered, and at parse time it doesn't even know it's layered. It's all hidden from how the sequence works.

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services