mbeckerle commented on a change in pull request #214: Sequences and Separators Refactoring and Rewrite URL: https://github.com/apache/incubator-daffodil/pull/214#discussion_r285236839
########## File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/SeparatedSequenceChildParseResultHelper.scala ########## @@ -0,0 +1,272 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.processors.parsers + +import org.apache.daffodil.processors.Success +import org.apache.daffodil.util.Maybe +import org.apache.daffodil.exceptions.Assert +import org.apache.daffodil.dpath.NodeInfo +import org.apache.daffodil.schema.annotation.props.EmptyElementPolicy +import org.apache.daffodil.processors.ElementRuntimeData +import org.apache.daffodil.processors.ModelGroupRuntimeData +import org.apache.daffodil.processors.Failure +import org.apache.daffodil.infoset.DIElement +import org.apache.daffodil.infoset.DISimple +import org.apache.daffodil.infoset.DIComplex + +sealed abstract class SeparatedSequenceChildBehavior Review comment: Add scladoc: Positional and Non-Positional are concepts that apply only to the children of separated sequences. They are not characteristics of the entire sequence, but of each child term of the sequence. Positional Behavior - means that separators are required in order to determine which child of the sequence group is being parsed/unparsed. Positional-Trailing Behavior - Like positional, but with special treatment for things at the end of a sequence, where extra separators for absentRep occurrences may be tolerated when parsing, but are not created when unparsing. A strict behavior applies only for parsing. In this case, there can be extra separators for absentRep, but only if they are subsequently followed by a non-absentRep (meaning nilRep, emptyRep that is distinct from absentRep, or normalRep). For Positional-Trailing behavior to apply, the sequence child must be potentially trailing. Non-Positional Behavior - means that separators are not required to determine which child of the sequence group is being parsed/unparsed. The data must make this ambiguous with initiators, or with simply the accepted syntax of the data type. A sequence child which is an array element with dfdl:occursCountKind fixed or expression this has positional behavior regardless of the separatorSuppressionPolicy of the sequence. For the occurrences of that element, the behavior is as if the sequence had separatorSuppressionPolicy 'never'. A sequence child which is an array element with dfdl:occursCountKind parsed has non-positional behavior regardless of the separatorSuppressionPolicy of the sequence. For the occurrences of that element the behavior is as if the sequence had separatorSuppressionPolicy 'anyEmpty' A sequence child which is an array element with dfdl:occursCountKind implicit has positional, positional-trailing, or non-positional behavior based on several other factors. ---------------------------------------------------------------- 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] With regards, Apache Git Services
