stevedlawrence commented on code in PR #1189:
URL: https://github.com/apache/daffodil/pull/1189#discussion_r1533719193
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/EvEscapeSchemes.scala:
##########
@@ -114,7 +123,12 @@ class EscapeSchemeCharUnparseEv(
def compute(state: ParseOrUnparseState) = {
val escChar = escapeChar.evaluate(state).charAt(0)
val optEscEscChar = evalAndConvertEEC(state)
- new EscapeSchemeCharUnparserHelper(escChar, optEscEscChar,
extraEscapedCharsCooked, ci)
+ new EscapeSchemeCharUnparserHelper(
+ escChar,
+ optEscEscChar,
+ extraEscapedCharsCooked(state),
Review Comment:
Just to make our code more consistent with escEscChar, can you move this up
and change the name, something like:
```scala
val extraEscChars = evalAndConvertExtraEscapedChars(state)
new EscpeSchemeCharUnparserHalper(..., extraEscChars, ...)
```
Same with below use.
##########
daffodil-test/src/test/resources/org/apache/daffodil/section07/escapeScheme/escapeScheme.tdml:
##########
@@ -314,6 +314,24 @@
escapeKind="escapeCharacter" escapeEscapeCharacter="{
xs:string(xs:int(fn:ceiling(xs:float(../tns:escapeEscapeChar)))) }"
extraEscapedCharacters="" generateEscapeBlock="whenNeeded" />
</dfdl:defineEscapeScheme>
+ <dfdl:defineEscapeScheme name="fromData4">
+ <dfdl:escapeScheme
+ escapeCharacter="{ xs:string(xs:int(../tns:escapeChar) - 3) }"
+ escapeKind="escapeCharacter"
+ escapeEscapeCharacter="{
xs:string(xs:int(fn:ceiling(xs:float(../tns:escapeEscapeChar)))) }"
+ extraEscapedCharacters="{ xs:string(../tns:extraEscapedChars) }"
+ generateEscapeBlock="whenNeeded" />
+ </dfdl:defineEscapeScheme>
+
+ <dfdl:defineEscapeScheme name="fromData5">
+ <dfdl:escapeScheme
+ escapeCharacter="{ xs:string(xs:int(../tns:escapeChar) - 3) }"
+ escapeKind="escapeCharacter"
+ escapeEscapeCharacter="{
xs:string(xs:int(fn:ceiling(xs:float(../tns:escapeEscapeChar)))) }"
+ extraEscapedCharacters="1 3"
+ generateEscapeBlock="whenNeeded" />
+ </dfdl:defineEscapeScheme>
+
Review Comment:
It might be useful to also have a test that makes sure extraEC works with
escapeKind="block". By code inspection it's clear it does, but that would
prevent us accidentally breaking it in the future.
--
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]