stevedlawrence commented on code in PR #981:
URL: https://github.com/apache/daffodil/pull/981#discussion_r1129833778


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/LocalElementMixin.scala:
##########
@@ -124,4 +129,21 @@ trait LocalElementMixin extends ParticleMixin with 
LocalElementGrammarMixin {
     res
   }.value
 
+  final def isDelimiterRequiredWhenEmpty(t: DelimiterTextType.Type): Boolean = 
{

Review Comment:
   Instead of making this a function that only makes sense for 
initiator/terminator, it might make sense to make new LVs, e.g.
   
   ```scala
   private lazy val isInitiatorRequiredWhenEmpty = LV(`...`) {
     emptyValueDelimiterPolicy match {
       case EmptyValueDelimiterPolicy.Both => true
       case EmptyValueDelimiterPolicy.Initiator => true
       case => false
     }
   }
   
   private lazy val isTerminatorRequiredWhenEmpty = LV(`...`) {
     ...
   }
   ```
   
   Then the Initiator/Terminator classes can pass in `is<Foo>RequiredWhenEmpty` 
when extending DelimiterText. This avoids the hasInitiator/Terminator calls 
since these LV's will only be called if there are initiator/terminators, and 
avoids unreachable code.



-- 
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]

Reply via email to