mbeckerle commented on a change in pull request #83: Adding value of 'bcd' to
binaryCalendarRep
URL: https://github.com/apache/incubator-daffodil/pull/83#discussion_r203408094
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesDateTime.scala
##########
@@ -134,17 +121,44 @@ abstract class ConvertTextCalendarPrimBase(e:
ElementBase, guard: Boolean)
res
}
- private lazy val localeEv = {
+ protected lazy val localeEv = {
val ev = new CalendarLanguageEv(e.calendarLanguage, e.erd)
ev.compile()
ev
}
- private lazy val calendarEv = {
+ protected lazy val calendarEv = {
val cev = new CalendarEv(localeEv, calendarTz, firstDay,
calendarDaysInFirstWeek, calendarCheckPolicy, e.erd)
cev.compile()
cev
}
+}
+
+abstract class ConvertTextCalendarPrimBase(e: ElementBase, guard: Boolean)
+ extends ConvertCalendarPrimBase(e, guard)
+ with CalendarPrimBase {
+
+ protected def implicitPattern: String
+
+ lazy val pattern: String = {
+ val p = e.calendarPatternKind match {
+ case CalendarPatternKind.Explicit => e.calendarPattern
+ case CalendarPatternKind.Implicit => implicitPattern
+ }
+
+ val escapedText = "(''|'[^']+'|[^a-zA-Z])".r
+ val patternNoEscapes = escapedText.replaceAllIn(p, "")
+ patternNoEscapes.toSeq.foreach(char =>
+ if (!validFormatCharacters.contains(char)) {
Review comment:
Perhaps a regex can be used to allow things like "e", but not "ee".
e(?!e) is e, not followed by another e.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services