This is an automated email from the ASF dual-hosted git repository.
olabusayo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
The following commit(s) were added to refs/heads/master by this push:
new 5e63af1 Removes comment out code
5e63af1 is described below
commit 5e63af1f5e0cd268b84e9de9735baac19310aeff
Author: olabusayoT <[email protected]>
AuthorDate: Thu Apr 16 17:15:52 2020 -0400
Removes comment out code
-- also does some reindenting if necessary
DAFFODIL-2275
---
.../src/main/scala/org/apache/daffodil/Main.scala | 1 -
.../org/apache/daffodil/dpath/Expression.scala | 13 +-
.../org/apache/daffodil/dsom/DFDLAssertion.scala | 2 -
.../daffodil/dsom/DFDLFormatAnnotation.scala | 1 -
.../org/apache/daffodil/dsom/DFDLSchemaFile.scala | 1 -
.../org/apache/daffodil/dsom/ElementBase.scala | 5 -
.../scala/org/apache/daffodil/dsom/Facets.scala | 5 +-
.../scala/org/apache/daffodil/dsom/Import.scala | 2 +-
.../apache/daffodil/dsom/RestrictionUnion.scala | 6 -
.../org/apache/daffodil/dsom/SchemaComponent.scala | 1 -
.../scala/org/apache/daffodil/dsom/SchemaSet.scala | 1 -
.../daffodil/grammar/ElementBaseGrammarMixin.scala | 9 -
.../grammar/primitives/PrimitivesExpressions.scala | 54 ------
.../grammar/primitives/PrimitivesLengthKind.scala | 11 --
.../runtime1/ChoiceTermRuntime1Mixin.scala | 185 +++++++++++----------
.../daffodil/runtime1/SchemaSetRuntime1Mixin.scala | 1 -
.../main/scala/org/apache/daffodil/io/Dump.scala | 6 -
.../scala/org/apache/daffodil/ExecutionMode.scala | 3 -
.../apache/daffodil/cookers/EntityReplacer.scala | 2 +-
.../scala/org/apache/daffodil/util/Logger.scala | 5 -
.../scala/org/apache/daffodil/util/Maybe.scala | 5 -
.../main/scala/org/apache/daffodil/util/Misc.scala | 9 +-
.../scala/org/apache/daffodil/util/Numbers.scala | 16 +-
.../apache/daffodil/xml/DaffodilXMLLoader.scala | 4 -
.../scala/org/apache/daffodil/xml/JDOMUtils.scala | 6 -
.../main/scala/passera/unsigned/SmallUInt.scala | 2 -
.../src/main/scala/passera/unsigned/ULong.scala | 11 --
.../src/main/scala/passera/unsigned/package.scala | 5 -
.../scala/org/apache/daffodil/io/IOMacros.scala | 41 -----
.../src/main/scala/UpdateEclipseClasspaths.scala | 1 -
.../daffodil/propGen/PropertyGenerator.scala | 24 ---
.../unparsers/SequenceChildUnparsers.scala | 1 -
.../org/apache/daffodil/infoset/DataValue.scala | 13 +-
.../org/apache/daffodil/infoset/DataValue.scala | 15 +-
.../daffodil/debugger/InteractiveDebugger.scala | 7 +-
.../org/apache/daffodil/dpath/ArrayRelated.scala | 33 ++--
.../dpath/DFDLCheckConstraintsFunction.scala | 8 -
.../scala/org/apache/daffodil/dpath/FNBases.scala | 4 +-
.../org/apache/daffodil/infoset/InfosetImpl.scala | 2 -
.../daffodil/infoset/XMLInfosetOutputter.scala | 2 -
.../apache/daffodil/layers/LayerTransformer.scala | 16 +-
.../processors/DFDLRegularExpressions.scala | 1 -
.../org/apache/daffodil/processors/DataLoc.scala | 16 --
.../apache/daffodil/processors/Evaluatable.scala | 32 ----
.../daffodil/processors/ProcessorBases.scala | 3 -
.../apache/daffodil/processors/Suspension.scala | 12 --
.../daffodil/processors/TypeCalculator.scala | 1 -
.../apache/daffodil/processors/VariableMap1.scala | 2 -
.../apache/daffodil/processors/dfa/Registers.scala | 13 --
.../parsers/ExpressionEvaluatingParsers.scala | 84 +++++-----
.../SeparatedSequenceChildParseResultHelper.scala | 1 -
.../org/apache/daffodil/tdml/RunnerFactory.scala | 4 -
.../org/apache/daffodil/tdml/TDMLRunner.scala | 24 +--
.../tdml/processor/DaffodilTDMLDFDLProcessor.scala | 2 +-
54 files changed, 183 insertions(+), 551 deletions(-)
diff --git a/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
b/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
index 13e715d..e6583b7 100644
--- a/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
+++ b/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
@@ -690,7 +690,6 @@ object Main extends Logging {
}
}
val id = new InteractiveDebugger(runner, ExpressionCompilers)
- // runner.init(id)
proc.setDebugging(true)
proc.setDebugger(id)
}
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
index 67a8f19..c039300 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
@@ -880,16 +880,10 @@ sealed abstract class StepExpression(val step: String,
val pred: Option[Predicat
ci.noMatchError(stepQName)
}
}
-
- // override def toString = text
-
// Combination of lazy val and a protected def is an idiom
// that enables a lazy calculation to call super.
- //
final lazy val stepElements = {
val res = stepElementDefs
- // log(LogLevel.Info, "DPath Compiler: path step elements for %s are
%s.",
- // step, res.map { _.sscd }.mkString(", "))
res
}
@@ -993,7 +987,7 @@ sealed abstract class DownStepExpression(s: String,
predArg: Option[PredicateExp
extends StepExpression(s, predArg) {
/**
- * Since an expresion can be in a reused group, type, or element, the
downward path
+ * Since an expression can be in a reused group, type, or element, the
downward path
* step may actually represent a step downward to distinct elements that
happen to
* just have the same name/namespace, but they could be different types.
*
@@ -1008,10 +1002,6 @@ sealed abstract class DownStepExpression(s: String,
predArg: Option[PredicateExp
* For now, we just insist all the types are equal, and issue a SDE if they
are not.
*/
override lazy val inherentType: NodeInfo.Kind = {
- // stepElements.map { _.typeNode }.reduce {
- // (left, right) =>
- // NodeInfoUtils.typeLeastUpperBound(left, right)
- // }
val allTypes = stepElements.map { _.typeNode }.distinct
Assert.invariant(allTypes.length > 0)
if (allTypes.length > 1) {
@@ -2035,7 +2025,6 @@ case class FNExactlyOneExpr(nameAsParsed: String,
fnQName: RefQName, args: List[
override lazy val compiledDPath = {
checkArgCount(1)
subsetError("fn:exactly-one is not supported.")
- //new CompiledDPath((arrPath.compiledDPath.ops.toList :+ FNExactlyOne) ++
conversions)
}
}
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
index 5c8ca5f..04787c8 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
@@ -66,9 +66,7 @@ abstract class DFDLAssertionBase(node: Node, decl:
AnnotatedSchemaComponent)
val optPattern = getAttributeOption("testPattern")
optPattern.foreach { thePattern =>
try {
- // val icu =
UnicodeRegex.compile(thePattern) // Check against ICU
- // val java =
Pattern.compile(thePattern) // Check against Java
} catch { case e: PatternSyntaxException => SDE("The pattern contained
invalid syntax: %s", e.getMessage()) }
}
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLFormatAnnotation.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLFormatAnnotation.scala
index 8943c1e..6003d9d 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLFormatAnnotation.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLFormatAnnotation.scala
@@ -289,7 +289,6 @@ abstract class DFDLFormatAnnotation(nodeArg: Node,
annotatedSCArg: AnnotatedSche
"Short, long, and element form properties overlap: %s at %s",
locallyConflictingProperties.mkString(", "),
this.locationDescription)
- // jto = "just this one"
val jtoSet =
shortFormProperties.union(longFormProperties).union(elementFormProperties)
val jto = jtoSet.toMap
jto
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLSchemaFile.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLSchemaFile.scala
index cc3bbb2..c93d077 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLSchemaFile.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLSchemaFile.scala
@@ -99,7 +99,6 @@ final class DFDLSchemaFile(
}
def error(exception: SAXParseException) = {
- // val ex = exception
val sde = new SchemaDefinitionError(this.schemaFileLocation, "Error
loading schema due to %s", exception)
error(sde)
validationDiagnostics_ :+= sde
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
index b0bf1c7..0073e99 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
@@ -353,8 +353,6 @@ trait ElementBase
lazy val unparserInfosetElementDefaultingBehavior:
UnparserInfo.InfosetEventBehavior = {
import UnparserInfo._
- //if (isScalar && isDefaultable) ScalarDefaultable
- //else if (isArray && isDefaultable) ArrayDefaultable
if (!isRepresented) MustExist
else if (isOutputValueCalc) Computed
else if (isOptional) Optional
@@ -816,9 +814,6 @@ trait ElementBase
private lazy val enumerationValues: Option[String] = {
Assert.invariant(hasEnumeration)
typeDef.optRestriction.flatMap { _.enumerationValues }
- // .getOrElse {
- // Assert.invariantFailed("must have an enumeration value")
- // }
}
/**
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Facets.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Facets.scala
index 60bc359..de4aefe 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Facets.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Facets.scala
@@ -139,7 +139,7 @@ trait Facets { self: Restriction =>
if (values.size > 0) {
val (_, value) = values(0)
Some(value)
- } else None // SDE("Enumeration was not found in this context.")
+ } else None
}
// TODO: Tidy up. Can likely replace getFacetValue with a similar call to
combinedBaseFacets
// as combinedBaseFacets should contain the 'narrowed' values.
@@ -309,7 +309,6 @@ trait Facets { self: Restriction =>
// Necessary for min/max Inclusive/Exclusive Facets
// Perform conversions once
- //val theLocalFacet = new java.math.BigDecimal(localFacet)
val theLocalFacet = convertFacetToBigDecimal(localFacet)
facetType match {
@@ -432,7 +431,7 @@ trait Facets { self: Restriction =>
// been done in the base. --TRW
// Perform conversions once
- val theRemoteFacet = checkValueSpaceFacetRange(remoteFacet, facetType)
//new java.math.BigDecimal(remoteFacet)
+ val theRemoteFacet = checkValueSpaceFacetRange(remoteFacet, facetType)
val theLocalFacet = checkValueSpaceFacetRange(localFacet, facetType)
(theLocalFacet, theRemoteFacet)
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Import.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Import.scala
index d6b2745..037bc28 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Import.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/Import.scala
@@ -103,7 +103,7 @@ final class Import(importNode: Node, xsd:
XMLSchemaDocument, seenArg: IIMap)
}
}.value
- private lazy val resolver = xsd.schemaSet.resolver // iiSchemaFileMaybe.map
{ _.resolver }
+ private lazy val resolver = xsd.schemaSet.resolver
private lazy val catFiles = resolver.catalogFiles.mkString(", ")
/**
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala
index 14bfbfe..27617c9 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala
@@ -119,9 +119,6 @@ final class Restriction(xmlArg: Node, val simpleTypeDef:
SimpleTypeDefBase)
}
final lazy val combinedBaseFacets: Seq[FacetValue] = {
- // val localF = localBaseFacets
- // val remoteF = remoteBaseFacets
-
val combined: Queue[FacetValue] = Queue.empty
if (hasEnumeration) {
@@ -473,7 +470,6 @@ sealed trait TypeChecks { self: Restriction =>
protected def isInNegativeIntegerRange(value: JBigDecimal, context:
ThrowsSDE): Boolean = {
// TODO: NegativeInteger not supported in DFDL v1.0
val min = new JBigDecimal(Int.MinValue.toString())
- // val max = new JBigDecimal(Int.MaxValue.toString())
val isNegative = value.signum == -1
if (!isNegative) context.SDE("Expected a negative integer for this value.")
val checkMin = value.compareTo(min)
@@ -482,14 +478,12 @@ sealed trait TypeChecks { self: Restriction =>
}
protected def isInNonNegativeIntegerRange(value: JBigDecimal): Boolean = {
// Should be treated as unsigned Integer (unbounded)
- // val min = JBigDecimal.ZERO
val isNegative = value.signum == -1
if (isNegative) return false
true
}
protected def isInUnsignedXXXRange(value: JBigDecimal, numBits: Int,
typeName: String): Boolean = {
Assert.usage(numBits <= 64, "isInUnsignedXXXRange: numBits must be <= 64.")
- // val min = JBigDecimal.ZERO
val max = new JBigDecimal(JBigInt.ONE.shiftLeft(numBits)).subtract(new
JBigDecimal(1))
val isNegative = value.signum == -1
if (isNegative) return false
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponent.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponent.scala
index 211bac8..49d1cf6 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponent.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponent.scala
@@ -321,7 +321,6 @@ final class Schema(val namespace: NS, schemaDocs:
Seq[SchemaDocument], schemaSet
* This just scans each schema document in the schema, checking each one.
*/
def getGlobalElementDecl(name: String) = {
- // noneOrOne(schemaDocuments.flatMap { _.getGlobalElementDecl(name) },
name)
val sds = schemaDocuments
val res = sds.flatMap {
sd =>
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala
index 2bebab7..9b6593a 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala
@@ -284,7 +284,6 @@ final class SchemaSet(
* unambiguous, it is used as the root.
*/
private def findRootElement(name: String) = {
- // log(Info("%s searching for root element with name %s",
Misc.getNameFromClass(this), name))
val candidates = schemas.flatMap { _.getGlobalElementDecl(name) }
schemaDefinitionUnless(candidates.length != 0, "No root element found for
%s in any available namespace", name)
schemaDefinitionUnless(candidates.length <= 1, "Root element %s is
ambiguous. Candidates are %s.",
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala
index 34bd97f..f24246c 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala
@@ -243,10 +243,6 @@ trait ElementBaseGrammarMixin
isSpecifiedLengthForUnparsing &&
couldBeVariableLengthInfoset &&
(lengthUnits ne LengthUnits.Characters))
- // if (res)
- // println("%s should add fill.".format(this.diagnosticDebugName))
- // else
- // println("%s NOT adding fill.".format(this.diagnosticDebugName))
res
}
@@ -416,10 +412,6 @@ trait ElementBaseGrammarMixin
couldBeVariableLengthInfoset &&
!isTruncatable &&
isSpecifiedLengthForUnparsing
- // if (res)
- // println("%s should check excess
length.".format(this.diagnosticDebugName))
- // else
- // println("%s NOT checking excess
length.".format(this.diagnosticDebugName))
res
}
@@ -993,7 +985,6 @@ trait ElementBaseGrammarMixin
nilKind match {
case NilKind.LiteralValue => {
- // if (impliedRepresentation != Representation.Text)
this.SDE("LiteralValue Nils require representation='text'.")
lengthKind match {
case LengthKind.Delimited => LiteralNilDelimitedEndOfData(this)
case LengthKind.Pattern => LiteralValueNilOfSpecifiedLength(this)
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesExpressions.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesExpressions.scala
index 5b57158..42e1413 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesExpressions.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesExpressions.scala
@@ -278,60 +278,6 @@ case class TypeValueCalc(e: ElementBase)
}
-//case class OutputValueCalcStaticLength(e: ElementBase,
-// property: PropertyLookupResult,
-// ovcRepUnparserGram: Gram,
-// knownLengthInBits: Long)
-// extends ValueCalcBase(e, property) {
-//
-// override def baseName = "outputValueCalc"
-//
-// override lazy val parser = Assert.usageError("Not to be called on
OutputValueCalc class.")
-//
-// override lazy val unparser = {
-// val ovcRepUnparser = ovcRepUnparserGram.unparser
-// val unp = new
ElementOutputValueCalcStaticLengthUnparser(e.elementRuntimeData,
ovcRepUnparser, MaybeULong(knownLengthInBits))
-// unp
-// }
-//}
-//
-//case class OutputValueCalcRuntimeLength(e: ElementBase,
-// property: PropertyLookupResult,
-// ovcRepUnparserGram: Gram,
-// lengthEv: LengthEv,
-// lengthUnits: LengthUnits)
-// extends ValueCalcBase(e, property) {
-//
-// override def baseName = "outputValueCalc"
-//
-// override lazy val parser = Assert.usageError("Not to be called on
OutputValueCalc class.")
-//
-// override lazy val unparser = {
-// val ovcRepUnparser = ovcRepUnparserGram.unparser
-// val unp = new
ElementOutputValueCalcRuntimeLengthUnparser(e.elementRuntimeData,
ovcRepUnparser, lengthEv, lengthUnits)
-// unp
-// }
-//}
-//
-//case class OutputValueCalcVariableLength(e: ElementBase,
-// property: PropertyLookupResult,
-// ovcRepUnparserGram: Gram)
-// extends ValueCalcBase(e, property) {
-//
-// override def baseName = "outputValueCalc"
-//
-// override lazy val parser = Assert.usageError("Not to be called on
OutputValueCalc class.")
-//
-// override lazy val unparser = {
-// val ovcRepUnparser = ovcRepUnparserGram.unparser
-// //
-// // same "static length" unparser, but the length is optional, so in this
case we don't provide it.
-// //
-// val unp = new
ElementOutputValueCalcStaticLengthUnparser(e.elementRuntimeData,
ovcRepUnparser, MaybeULong.Nope)
-// unp
-// }
-//}
-
abstract class AssertPatternPrimBase(decl: Term, stmt: DFDLAssertionBase,
discrim: Boolean)
extends ExpressionEvaluatorBase(decl) {
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesLengthKind.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesLengthKind.scala
index 852b6f4..b3dac70 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesLengthKind.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesLengthKind.scala
@@ -144,17 +144,6 @@ abstract class StringDelimited(e: ElementBase)
}
}
- // /**
- // * Called at compile time in static case, at runtime for dynamic case.
- // */
- // def errorIfDelimsHaveWSPStar(delims: List[String]): Unit = {
- // if (delims.filter(x => x == "%WSP*;").length > 0) {
- // // We cannot detect this error until expressions have been evaluated!
- // log(LogLevel.Debug, "%s - Failed due to WSP* detected as a delimiter
for lengthKind=delimited.", eName)
- // context.schemaDefinitionError("WSP* cannot be used as a delimiter
when lengthKind=delimited.")
- // }
- // }
-
override lazy val parser: DaffodilParser = new StringDelimitedParser(
e.elementRuntimeData,
justificationTrim,
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/ChoiceTermRuntime1Mixin.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/ChoiceTermRuntime1Mixin.scala
index 4c59342..1e9adea 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/ChoiceTermRuntime1Mixin.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/ChoiceTermRuntime1Mixin.scala
@@ -63,110 +63,115 @@ trait ChoiceTermRuntime1Mixin { self: ChoiceTermBase =>
private lazy val allBranchesClosed =
identifyingEventsForAllChoiceBranches.forall { _.isClosed }
- final lazy val choiceBranchMap: (Map[ChoiceBranchEvent, Term], Option[Term])
=
- // LV('choiceBranchMap)
- {
-
- import PossibleNextElements._
-
- val eventTuples = alternatives.flatMap { alt =>
- alt.context match {
- case t: Term => {
- val poss = t.identifyingEventsForChoiceBranch
- poss.pnes.flatMap {
- case PNE(e, ovr) =>
- Seq((
-
ChoiceBranchStartEvent(e.namedQName).asInstanceOf[ChoiceBranchEvent],
- t))
- }
+ final lazy val choiceBranchMap: (Map[ChoiceBranchEvent, Term], Option[Term])
= {
+
+ import PossibleNextElements._
+
+ val eventTuples = alternatives.flatMap { alt =>
+ alt.context match {
+ case t: Term => {
+ val poss = t.identifyingEventsForChoiceBranch
+ poss.pnes.flatMap {
+ case PNE(e, ovr) =>
+ Seq((
+
ChoiceBranchStartEvent(e.namedQName).asInstanceOf[ChoiceBranchEvent],
+ t))
}
- case _ => Assert.invariantFailed("must be a term")
}
+ case _ => Assert.invariantFailed("must be a term")
}
- //
- // The default branch is the one to be taken if the incoming unparser
event isn't one
- // identified with any branch. This can happen even if every branch has
required elements
- // if those required elements have dfdl:outputValueCalc because we allow
an OVC
- // element event to be in the infoset (for round-tripping from parse).
It's value will
- // get recomputed, but it can appear with a stale value (left-over from
parse)
- // in the arriving infoset for unparse.
- //
- val optDefaultBranch = {
- val optEmpty: Option[Term] =
+ }
+ //
+ // The default branch is the one to be taken if the incoming unparser
event isn't one
+ // identified with any branch. This can happen even if every branch has
required elements
+ // if those required elements have dfdl:outputValueCalc because we allow
an OVC
+ // element event to be in the infoset (for round-tripping from parse).
It's value will
+ // get recomputed, but it can appear with a stale value (left-over from
parse)
+ // in the arriving infoset for unparse.
+ //
+ val optDefaultBranch = {
+ val optEmpty: Option[Term] =
+ groupMembers.find { gm =>
+ val ies = gm.identifyingEventsForChoiceBranch
+ ies.pnes.isEmpty // empty event list makes it the default, not
simply isOpen
+ }
+ val optOpen: Option[Term] =
+ optEmpty.orElse {
groupMembers.find { gm =>
val ies = gm.identifyingEventsForChoiceBranch
- ies.pnes.isEmpty // empty event list makes it the default, not
simply isOpen
- }
- val optOpen: Option[Term] =
- optEmpty.orElse {
- groupMembers.find { gm =>
- val ies = gm.identifyingEventsForChoiceBranch
- ies.isOpen // first open one is used if there is no branch that
has empty event list. (test ptg_1u)
- }
- }
- val optDefault: Option[Term] =
- optOpen.orElse {
- groupMembers.find { _.canUnparseIfHidden } //optional, defaultable
or OVC
+ ies.isOpen // first open one is used if there is no branch that
has empty event list. (test ptg_1u)
}
- optDefault
- }
+ }
+ val optDefault: Option[Term] =
+ optOpen.orElse {
+ groupMembers.find {
+ _.canUnparseIfHidden
+ } //optional, defaultable or OVC
+ }
+ optDefault
+ }
+
+ // converts a sequence of tuples into a multi-map
+ val eventMap = eventTuples.groupBy {
+ _._1
+ }.mapValues {
+ _.map(_._2)
+ }
- // converts a sequence of tuples into a multi-map
- val eventMap = eventTuples.groupBy { _._1 }.mapValues { _.map(_._2) }
-
- // Now we examine the event map looking for cases where a given input
event corresponds to
- // more than one branch.
-
- val noDupes = eventMap.map {
- case (event, terms) => {
- Assert.invariant(terms.length > 0)
- if (terms.length > 1) {
- if (terms.exists { term =>
- term match {
- // any element children in any of the trds?
- // because if so, we have a true ambiguity here.
- case sg: SequenceTermBase => {
- val nonOVCEltChildren = sg.groupMembers.filter {
- case erd: ElementRuntimeData =>
erd.outputValueCalcExpr.isEmpty
- case _ => false
- }
- nonOVCEltChildren.length > 0
+ // Now we examine the event map looking for cases where a given input
event corresponds to
+ // more than one branch.
+
+ val noDupes = eventMap.map {
+ case (event, terms) => {
+ Assert.invariant(terms.length > 0)
+ if (terms.length > 1) {
+ if (terms.exists { term =>
+ term match {
+ // any element children in any of the trds?
+ // because if so, we have a true ambiguity here.
+ case sg: SequenceTermBase => {
+ val nonOVCEltChildren = sg.groupMembers.filter {
+ case erd: ElementRuntimeData =>
erd.outputValueCalcExpr.isEmpty
+ case _ => false
}
- case _ => false
+ nonOVCEltChildren.length > 0
}
- }) {
- // Possibly due to presence of a element with
dfdl:outputValueCalc, XML Schema's
- // UPA check may not catch this ambiguity. However, we need a
real element
- // with unique name, to unambiguously identify a branch.
- // So if there is ambiguity at this point, we have to fail.
- SDE(
- "UPA violation. Multiple choice branches begin with %s.\n" +
- "Note that elements with dfdl:outputValueCalc cannot be used
to distinguish choice branches.\n" +
- "Note that choice branches with entirely optional content
are not allowed.\n" +
- "The offending choice branches are:\n%s",
- event.qname, terms.map { trd => "%s at
%s".format(trd.diagnosticDebugName, trd.locationDescription) }.mkString("\n"))
- } else {
- val eventType = event match {
- case _: ChoiceBranchEndEvent => "end"
- case _: ChoiceBranchStartEvent => "start"
- }
- // there are no element children in any of the branches.
- SDW(
- WarnID.MultipleChoiceBranches,
- "Multiple choice branches are associated with the %s of
element %s.\n" +
- "Note that elements with dfdl:outputValueCalc cannot be used
to distinguish choice branches.\n" +
- "Note that choice branches with entirely optional content
are not allowed.\n" +
- "The offending choice branches are:\n%s\n" +
- "The first branch will be used during unparsing when an
infoset ambiguity exists.",
- eventType, event.qname, terms.map { trd => "%s at
%s".format(trd.diagnosticDebugName, trd.locationDescription) }.mkString("\n"))
+ case _ => false
+ }
+ }) {
+ // Possibly due to presence of a element with
dfdl:outputValueCalc, XML Schema's
+ // UPA check may not catch this ambiguity. However, we need a real
element
+ // with unique name, to unambiguously identify a branch.
+ // So if there is ambiguity at this point, we have to fail.
+ SDE(
+ "UPA violation. Multiple choice branches begin with %s.\n" +
+ "Note that elements with dfdl:outputValueCalc cannot be used
to distinguish choice branches.\n" +
+ "Note that choice branches with entirely optional content are
not allowed.\n" +
+ "The offending choice branches are:\n%s",
+ event.qname,
+ terms.map { trd => "%s at %s".format(trd.diagnosticDebugName,
trd.locationDescription) }.mkString("\n"))
+ } else {
+ val eventType = event match {
+ case _: ChoiceBranchEndEvent => "end"
+ case _: ChoiceBranchStartEvent => "start"
}
+ // there are no element children in any of the branches.
+ SDW(
+ WarnID.MultipleChoiceBranches,
+ "Multiple choice branches are associated with the %s of element
%s.\n" +
+ "Note that elements with dfdl:outputValueCalc cannot be used
to distinguish choice branches.\n" +
+ "Note that choice branches with entirely optional content are
not allowed.\n" +
+ "The offending choice branches are:\n%s\n" +
+ "The first branch will be used during unparsing when an
infoset ambiguity exists.",
+ eventType, event.qname,
+ terms.map { trd => "%s at %s".format(trd.diagnosticDebugName,
trd.locationDescription) }.mkString("\n"))
}
- (event, terms(0))
}
+ (event, terms(0))
}
- (noDupes, optDefaultBranch)
}
- //.value
+ (noDupes, optDefaultBranch)
+ }
final lazy val modelGroupRuntimeData = choiceRuntimeData
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/SchemaSetRuntime1Mixin.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/SchemaSetRuntime1Mixin.scala
index 43f8a1a..b3d260a 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/SchemaSetRuntime1Mixin.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/runtime1/SchemaSetRuntime1Mixin.scala
@@ -103,7 +103,6 @@ trait SchemaSetRuntime1Mixin { self : SchemaSet =>
// diags.foreach { diag => log(LogLevel.Error, diag.toString())
}
} else {
log(LogLevel.Compile, "Parser = %s.", ssrd.parser.toString)
- //log(LogLevel.Error, "Unparser = %s.", ssrd.unparser.toString)
log(LogLevel.Compile, "Compilation (DataProcesor) completed with no
errors.")
}
dataProc
diff --git a/daffodil-io/src/main/scala/org/apache/daffodil/io/Dump.scala
b/daffodil-io/src/main/scala/org/apache/daffodil/io/Dump.scala
index 1e2eff0..1402354 100644
--- a/daffodil-io/src/main/scala/org/apache/daffodil/io/Dump.scala
+++ b/daffodil-io/src/main/scala/org/apache/daffodil/io/Dump.scala
@@ -58,17 +58,12 @@ class DataDumper {
protected sealed class TextKind(val optCharset: Option[String]) extends Kind
protected sealed trait BinaryKind extends Kind
protected sealed trait HexKind extends BinaryKind // hexadecimal
- // sealed trait BitsKind extends BinaryKind // individual ones and zeros
protected sealed trait Direction
protected sealed trait RTL extends Direction // used with least-signif-bit
first data like mil-std-2045
protected sealed trait LTR extends Direction
- // case object HexLTR extends HexKind with LTR
- // case object BitsLTR extends BitsKind with LTR
- // case object HexRTL extends HexKind with RTL
case class TextOnly(override val optCharset: Option[String] = None) extends
TextKind(optCharset)
case class MixedHexLTR(override val optCharset: Option[String] = None)
extends TextKind(optCharset) with HexKind with LTR
case class MixedHexRTL(override val optCharset: Option[String] = None)
extends TextKind(optCharset) with HexKind with RTL
- // case class MixedBits(optCharset: Option[String] = None) extends
TextKind(optCharset) with BitsKind
def convertBitsToBytesUnits(startBitAddress0b: Long, lengthInBits: Long):
(Long, Int, Long) = {
Assert.usage(startBitAddress0b >= 0)
@@ -642,7 +637,6 @@ class DataDumper {
}
val endByteAddress0b = math.max(startByteAddress0b + lengthInBytes - 1, 0)
- // val cs = optEncodingName.map { Charset.forName(_) }
val decoder = getReportingDecoder(optEncodingName)
var i = startByteAddress0b
val sb = new StringBuilder
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/ExecutionMode.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/ExecutionMode.scala
index 30b2977..25f1e14 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/ExecutionMode.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/ExecutionMode.scala
@@ -71,9 +71,6 @@ object ExecutionMode {
private final def isUnrestrictedMode = executionMode.value ==
UnrestrictedMode
private def notUnknown = {
- // val msg = "Warning code is not wrapped with either usingCompilerMode or
usingRuntimeMode"
- // Assert.usageErrorUnless(!isUnknownMode, msg)
- // if (isUnknownMode) System.err.println(msg)
!isUnknownMode
}
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
index 41714fc..d6a460a 100644
---
a/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
+++
b/daffodil-lib/src/main/scala/org/apache/daffodil/cookers/EntityReplacer.scala
@@ -187,7 +187,7 @@ final class EntityReplacer {
val trimmedStr = rawStr.replace(prefix, "").replace(";", "")
val upperNibble: Int = Byte.parseByte(trimmedStr.substring(0, 1), 16)
<< 4
val lowerNibble: Byte = Byte.parseByte(trimmedStr.substring(1, 2), 16)
- val byteStr: Int = upperNibble | lowerNibble
//Byte.parseByte(trimmedStr, 16)
+ val byteStr: Int = upperNibble | lowerNibble
res = res.replaceAll(rawStr, byteStr.toChar.toString)
}
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Logger.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Logger.scala
index 26d9720..1f100b8 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Logger.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Logger.scala
@@ -214,11 +214,6 @@ trait Logging extends Identity {
getLogWriter.log(lvl, logID, msg, args)
final def log(lvl: LogLevel.Type, msg: String, args: Any*): Unit = macro
LoggerMacros.logMacro
- // {
- // val l = level.lvl
- // if (getLoggingLevel().lvl >= l)
- // doLogging(level, msg, args.toSeq)
- // }
/**
* Use to make debug printing over small code regions convenient. Turns on
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Maybe.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Maybe.scala
index 21bdfd5..608c75c 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Maybe.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Maybe.scala
@@ -96,11 +96,6 @@ object Maybe {
import scala.language.implicitConversions
/**
- * implicitly treat as iterator/sequence/list (Scala's Option type has this)
- */
- // implicit def toIterator[T <: AnyRef](m: Maybe[T]) = m.toList
-
- /**
* implicitly convert Option type to Maybe type.
*
* The conversion the other way must be explicit by calling toScalaOption
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Misc.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Misc.scala
index 2cc49d9..2fc8fd6 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Misc.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Misc.scala
@@ -48,12 +48,11 @@ object Misc {
def getNameFromClass(obj: Any): String = {
if (obj == null) return "null"
- // val hexHash = obj.hashCode.formatted("%x")
val nonPackageClassName =
obj.getClass.getName.split("""\.""").toList.reverse.head
val nonDollarsParts = nonPackageClassName.split("""\$""").toList.reverse
val nonNumericParts = nonDollarsParts.filterNot { _.matches("""\d*""") }
val nameToken = nonNumericParts.head
- nameToken // + "@" + hexHash
+ nameToken
}
/**
@@ -181,10 +180,6 @@ object Misc {
}
lazy val classPath = {
- // val props = System.getProperties()
- // val cp = props.getProperty("java.class.path", null)
- // val lines = cp.split(":").toSeq
- // lines
val cl = this.getClass().getClassLoader()
val urls = cl match {
case url: URLClassLoader => url.getURLs().toSeq
@@ -199,7 +194,6 @@ object Misc {
val msg = "Required resource " + resPath + " was not found.\nClasspath
is " +
(if (classPath.length == 0) "unknown."
else ": " + classPath.mkString("\n"))
- // System.err.println(msg)
throw new java.io.FileNotFoundException(msg)
}
case (Some(res), _) => res
@@ -213,7 +207,6 @@ object Misc {
* Convert FooBar to fooBar, but leave FOOBAR as FOOBAR.
*/
def toInitialLowerCaseUnlessAllUpperCase(s: String): String = {
- // Assert.usage(s.length > 0)
if (s(0).isLower) return s
//
// At this point we know the first letter is uppercase
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Numbers.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Numbers.scala
index 14493d2..fa2422a 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/util/Numbers.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/util/Numbers.scala
@@ -160,7 +160,7 @@ object Numbers {
* */
def asBigInt(n: AnyRef): JBigInt = {
val value: JBigInt = n match {
- case b: JBigInt => b //BigInt(b)
+ case b: JBigInt => b
case bd: JBigDecimal => bd.toBigInteger()
case d: JDouble => new JBigDecimal(d).toBigInteger()
case f: JFloat => new JBigDecimal(f.toDouble).toBigInteger()
@@ -307,20 +307,8 @@ object Numbers {
}
}
- @inline
+ @inline
def asAnyRef(n: Any): AnyRef = {
n.asInstanceOf[AnyRef]
- /*
- * Attempting to match on the type is pointless.
- * Simply doing the match will box the value, so
- * it will always match against AnyRef
- */
-// n match {
-// // case bi: BigInt => bi.bigInteger
-// // case bd: BigDecimal => bd.bigDecimal
-// case ar: AnyRef => ar
-// case b: Boolean => JBoolean.valueOf(b)
-// case _ => asNumber(n)
-// }
}
}
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/xml/DaffodilXMLLoader.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/xml/DaffodilXMLLoader.scala
index ac0dd0f..efdb5e1 100644
---
a/daffodil-lib/src/main/scala/org/apache/daffodil/xml/DaffodilXMLLoader.scala
+++
b/daffodil-lib/src/main/scala/org/apache/daffodil/xml/DaffodilXMLLoader.scala
@@ -285,7 +285,6 @@ class DFDLCatalogResolver private ()
case None => null
case Some(uri) => {
val xis = new InputSource(uri.toURL().openStream())
- // xis.setPublicId(uri.toString())
xis.setSystemId(uri.toString())
xis
}
@@ -592,18 +591,15 @@ class BasicErrorHandler extends org.xml.sax.ErrorHandler {
def warning(exception: SAXParseException) = {
diagnostics :+= exception
- // System.err.println("Warning " + exception.getMessage())
}
def error(exception: SAXParseException) = {
diagnostics :+= exception
hasError = true
- // System.err.println("Error: " + exception.getMessage())
}
def fatalError(exception: SAXParseException) = {
diagnostics :+= exception
hasError = true
- // System.err.println("Fatal: " + exception.getMessage())
}
}
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/xml/JDOMUtils.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/xml/JDOMUtils.scala
index c639ac7..6d20752 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/xml/JDOMUtils.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/xml/JDOMUtils.scala
@@ -74,14 +74,8 @@ object JDOMUtils {
}
if (attribute.isPrefixed && attrNS != "") {
- // println("THE ATTRIBUTE IS: " + name)
- // println("THE NAMESPACE SHOULD BE: " + attrNS)
- // println("IT ACTUALLY IS:" + Namespace.getNamespace(name,
attrNS))
-
- // jdomNode setAttribute (name, value, ns)
new org.jdom2.Attribute(name, value, ns)
} else
- // jdomNode setAttribute (name, value)
new org.jdom2.Attribute(name, value)
}
}
diff --git a/daffodil-lib/src/main/scala/passera/unsigned/SmallUInt.scala
b/daffodil-lib/src/main/scala/passera/unsigned/SmallUInt.scala
index e883fe8..dc8e0d1 100644
--- a/daffodil-lib/src/main/scala/passera/unsigned/SmallUInt.scala
+++ b/daffodil-lib/src/main/scala/passera/unsigned/SmallUInt.scala
@@ -136,14 +136,12 @@ trait SmallUInt[U <: Unsigned[U, UInt, Int]] extends Any
with Unsigned[U, UInt,
def ==(x: Int)(implicit d: DummyImplicit) = intValue == x
def ==(x: Long)(implicit d: DummyImplicit) = longValue == x
- // def ==(x: UInt) = longValue == x.longValue
def ==(x: ULong) = longValue == x.longValue
def ==(x: Float) = floatValue == x
def ==(x: Double) = doubleValue == x
def !=(x: Int)(implicit d: DummyImplicit) = intValue != x
def !=(x: Long)(implicit d: DummyImplicit) = longValue != x
- // def !=(x: UInt) = longValue != x.longValue
def !=(x: ULong) = longValue != x.longValue
def !=(x: Float) = floatValue != x
def !=(x: Double) = doubleValue != x
diff --git a/daffodil-lib/src/main/scala/passera/unsigned/ULong.scala
b/daffodil-lib/src/main/scala/passera/unsigned/ULong.scala
index 5f0a22b..cdcd636 100644
--- a/daffodil-lib/src/main/scala/passera/unsigned/ULong.scala
+++ b/daffodil-lib/src/main/scala/passera/unsigned/ULong.scala
@@ -132,15 +132,6 @@ case class ULong(override val longValue: Long) extends
AnyVal with Unsigned[ULon
else
ULong(q)
}
-
- // val t = d >> 63
- // val n1 = n & ~t
- // val a = n1 >>> 1
- // val b = a / d
- // val q0 = b << 1
- // val r = n - q0 * d
- // val q = q0 + (if (ULong(r) >= x) 1l else 0l)
- // ULong(q.toLong)
}
def %(x: ULong): ULong = {
@@ -179,14 +170,12 @@ case class ULong(override val longValue: Long) extends
AnyVal with Unsigned[ULon
def ==(x: Int)(implicit d: DummyImplicit) = intValue == x
def ==(x: Long)(implicit d: DummyImplicit) = longValue == x
def ==(x: UInt) = longValue == x.longValue
- // def ==(x: ULong) = longValue == x.longValue
def ==(x: Float) = floatValue == x
def ==(x: Double) = doubleValue == x
def !=(x: Int)(implicit d: DummyImplicit) = intValue != x
def !=(x: Long)(implicit d: DummyImplicit) = longValue != x
def !=(x: UInt) = longValue != x.longValue
- // def !=(x: ULong) = longValue != x.longValue
def !=(x: Float) = floatValue != x
def !=(x: Double) = doubleValue != x
diff --git a/daffodil-lib/src/main/scala/passera/unsigned/package.scala
b/daffodil-lib/src/main/scala/passera/unsigned/package.scala
index 4cab997..35dfceb 100644
--- a/daffodil-lib/src/main/scala/passera/unsigned/package.scala
+++ b/daffodil-lib/src/main/scala/passera/unsigned/package.scala
@@ -29,9 +29,6 @@ package passera
import scala.language.implicitConversions
package object unsigned {
- // implicit def s2u(x: Int) = UInt(x)
- // implicit def u2s(x: UInt) = x.rep
-
implicit def ubyte2uint(x: UByte) = UInt(x.toInt)
implicit def ushort2uint(x: UShort) = UInt(x.toInt)
implicit def ubyte2ulong(x: UByte) = ULong(x.toLong)
@@ -123,8 +120,6 @@ package object unsigned {
class SignedRichIntOps(x: Int) {
def to(y: UInt): Range.Inclusive = x to y.toInt
def until(y: UInt): Range = x until y.toInt
- // def max(that: UInt) = if (x < that) that else x
- // def min(that: UInt) = if (x > that) that else x
}
trait UByteOrdering extends Ordering[UByte] {
diff --git
a/daffodil-macro-lib/src/main/scala/org/apache/daffodil/io/IOMacros.scala
b/daffodil-macro-lib/src/main/scala/org/apache/daffodil/io/IOMacros.scala
index f136bbf..3264327 100644
--- a/daffodil-macro-lib/src/main/scala/org/apache/daffodil/io/IOMacros.scala
+++ b/daffodil-macro-lib/src/main/scala/org/apache/daffodil/io/IOMacros.scala
@@ -59,45 +59,4 @@ object IOMacros {
}
}"""
}
-
- /**
- * For Data output streams
- *
- * Used to temporarily vary the bit length limit.
- *
- * Implementing as a macro eliminates the creation of a downward function
object every time this
- * is called.
- *
- */
- // def withBitLengthLimitMacroForOutput(c: Context)(lengthLimitInBits:
c.Tree)(body: c.Tree) = {
- //
- // import c.universe._
- //
- // val dStream = TermName(c.freshName)
- // val newLengthLimit = TermName(c.freshName)
- // val savedLengthLimit = TermName(c.freshName)
- // // c.prefix is the expression this macro was expanded on. Not quite
same thing as 'this' because we have to be
- // // careful not to use it more than once or it will evaluate more than
once.
- // val selfExp = c.prefix
- //
- // q"""{
- // import org.apache.daffodil.util.MaybeULong
- // import org.apache.daffodil.io.DataOutputStream
- //
- // val $dStream: DataOutputStream = $selfExp
- // val $newLengthLimit = $lengthLimitInBits
- // val $savedLengthLimit = $dStream.maybeRelBitLimit0b
- //
- // if (!$dStream.setMaybeRelBitLimit0b(MaybeULong($dStream.relBitPos0b +
$newLengthLimit))) false
- // else {
- // try {
- // $body
- // } finally {
- // $dStream.resetMaybeRelBitLimit0b($savedLengthLimit)
- // }
- // true
- // }
- // }"""
- // }
-
}
diff --git a/daffodil-propgen/src/main/scala/UpdateEclipseClasspaths.scala
b/daffodil-propgen/src/main/scala/UpdateEclipseClasspaths.scala
index 1dc7406..cd33651 100644
--- a/daffodil-propgen/src/main/scala/UpdateEclipseClasspaths.scala
+++ b/daffodil-propgen/src/main/scala/UpdateEclipseClasspaths.scala
@@ -120,7 +120,6 @@ lazy val pp = new scala.xml.PrettyPrinter(3000, 2)
val doc = docs.find(_.getName.startsWith(jar.getName.split(".jar")(0)))
(jar, src, doc)
}
- // triples.foreach { println(_) }
val xmlNodes = triples map {
case (jar, optSrc, optDoc) =>
diff --git
a/daffodil-propgen/src/main/scala/org/apache/daffodil/propGen/PropertyGenerator.scala
b/daffodil-propgen/src/main/scala/org/apache/daffodil/propGen/PropertyGenerator.scala
index a577406..dfda1f3 100644
---
a/daffodil-propgen/src/main/scala/org/apache/daffodil/propGen/PropertyGenerator.scala
+++
b/daffodil-propgen/src/main/scala/org/apache/daffodil/propGen/PropertyGenerator.scala
@@ -77,20 +77,8 @@ class PropertyGenerator(arg: Node) {
res
}
- // def getDFDLSchemaCollection() :XmlSchemaCollection = {
- // val is = SchemaCompiler.getInternalXSDStream()
- // val saxSrc = new InputSource(is)
- // val dfdlsc = new XmlSchemaCollection()
- // dfdlsc.read(saxSrc)
- // dfdlsc
- // }
-
def genAll(): Seq[String] = {
val allTopLevel = dfdlSchema.child
- // val allNamed = allTopLevel.filter(st => {
- // val name = attr(st, "name")
- // name != None
- // })
val thunks = allTopLevel.map(node => {
node.label match {
case "element" => genElement(node)
@@ -259,8 +247,6 @@ class PropertyGenerator(arg: Node) {
"textStandardExponentRep", "textStandardExponentCharacter",
"textOutputMinLength")
val exclusions = notFormatProperties ++ notScopedFormatProperties ++
excludedBecauseDoneByHand
- if (rawName == "binaryFloatRep") {
- }
if (exclusions.contains(rawName)) {
Nil
} else {
@@ -547,9 +533,6 @@ object Currency {
def generatePropertyGroup(pgName: String, pgList: Seq[(String, String)],
agList: Seq[String], enumList: Seq[String]) = {
val traitName = initialUpperCase(pgName)
- // if (traitName == "TextNumberFormatAG") {
- // println("stop here in breakpoint")
- // }
val traitNames = (enumList ++ agList).map(initialUpperCase(_) + "Mixin")
val extendsClause = "extends PropertyMixin" + traitNames.foldLeft("")(_ +
"\n with " + _)
val mixinName = traitName + "Mixin"
@@ -559,13 +542,6 @@ object Currency {
isEnumQName(attrName)
}
}
- // val enumAttribsList = enumAttrList.map {
- // case (attrName, attrTypeName) =>
- // val propName = initialLowerCase(attrName)
- // val res =
- // generateEnumInstantiation(propName, attrTypeName)
- // res
- // }
val (primAttrList, nonPrimAttrList) = nonEnumAttrList.partition { case
(attrName, attrTypeName) => isXSDTypeName(attrTypeName) }
val primAttribsList = primAttrList.map {
case (attrName, attrTypeName) => {
diff --git
a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SequenceChildUnparsers.scala
b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SequenceChildUnparsers.scala
index 4c9fa4d..0cbb032 100644
---
a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SequenceChildUnparsers.scala
+++
b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SequenceChildUnparsers.scala
@@ -232,7 +232,6 @@ abstract class RepeatingChildUnparser(
// (Per DFDL Spec 16.1)
//
val ock = erd.maybeOccursCountKind.get
- // System.err.println("Checking for events consistent with Array index:\n
==> Array Index Stack is:" + state.arrayIndexStack)
// check against maxReps + 1 since we incremented to the next array
position
// before calling this check.
diff --git
a/daffodil-runtime1/src/main/scala-2.11/org/apache/daffodil/infoset/DataValue.scala
b/daffodil-runtime1/src/main/scala-2.11/org/apache/daffodil/infoset/DataValue.scala
index a311aef..5ba0be5 100644
---
a/daffodil-runtime1/src/main/scala-2.11/org/apache/daffodil/infoset/DataValue.scala
+++
b/daffodil-runtime1/src/main/scala-2.11/org/apache/daffodil/infoset/DataValue.scala
@@ -237,16 +237,17 @@ object DataValue {
* As such, is issues a warning on the naive typecheck since it can "never"
fail. We silence this warning,
* by first casting to Any.
*
- * Ideally, we could compare against our DataValueAny type alias. However,
Scala (correctly) points out,
- * that type erasure means that DataValueAny contains information that Scala
cannot actually verify at runtime.
- * To silence this warning, we explictly check against the underlying
DataValue type.
*
- * The commented out assertion below shows what we are trying to accomplish.
- *
- * The actual assertion below is equivalent, but does not result in warnings.
*
*/
Assert.invariant(!v.asInstanceOf[Any].isInstanceOf[DataValue[AnyRef,
AnyRef]])
+
+ // Ideally, we could compare against our DataValueAny type alias. However,
Scala (correctly) points out,
+ // that type erasure means that DataValueAny contains information that
Scala cannot actually verify at runtime.
+ // To silence this warning, we explictly check against the underlying
DataValue type.
+ //
+ // The commented out assertion below shows what we are trying to
accomplish.
+ // The actual assertion above is equivalent, but does not result in
warnings.
// Assert.invariant(!v.isInstanceOf[DataValueAny])
}
}
diff --git
a/daffodil-runtime1/src/main/scala-2.12/org/apache/daffodil/infoset/DataValue.scala
b/daffodil-runtime1/src/main/scala-2.12/org/apache/daffodil/infoset/DataValue.scala
index ef83ced..3c5cea5 100644
---
a/daffodil-runtime1/src/main/scala-2.12/org/apache/daffodil/infoset/DataValue.scala
+++
b/daffodil-runtime1/src/main/scala-2.12/org/apache/daffodil/infoset/DataValue.scala
@@ -230,16 +230,15 @@ object DataValue {
* As such, is issues a warning on the naive typecheck since it can "never"
fail. We silence this warning,
* by first casting to Any.
*
- * Ideally, we could compare against our DataValueAny type alias. However,
Scala (correctly) points out,
- * that type erasure means that DataValueAny contains information that Scala
cannot actually verify at runtime.
- * To silence this warning, we explictly check against the underlying
DataValue type.
- *
- * The commented out assertion below shows what we are trying to accomplish.
- *
- * The actual assertion below is equivalent, but does not result in warnings.
- *
*/
Assert.invariant(!v.asInstanceOf[Any].isInstanceOf[DataValue[AnyRef,
AnyRef]])
+
+ // Ideally, we could compare against our DataValueAny type alias. However,
Scala (correctly) points out,
+ // that type erasure means that DataValueAny contains information that
Scala cannot actually verify at runtime.
+ // To silence this warning, we explictly check against the underlying
DataValue type.
+ //
+ // The commented out assertion below shows what we are trying to
accomplish.
+ // The actual assertion above is equivalent, but does not result in
warnings.
// Assert.invariant(!v.isInstanceOf[DataValueAny])
}
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/debugger/InteractiveDebugger.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/debugger/InteractiveDebugger.scala
index 0d9cba0..5aaddf3 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/debugger/InteractiveDebugger.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/debugger/InteractiveDebugger.scala
@@ -225,7 +225,6 @@ class InteractiveDebugger(runner:
InteractiveDebuggerRunner, eCompilers: Express
if (isInteresting(parser)) {
parseStack.push((before.copyStateForDebugger, parser))
}
- // debugStep(before, before, parser, false)
}
override def after(after: PState, parser: Parser) {
if (isInteresting(parser)) {
@@ -237,13 +236,11 @@ class InteractiveDebugger(runner:
InteractiveDebuggerRunner, eCompilers: Express
override def beforeRepetition(before: PState, processor: Parser) {
parseStack.push((before.copyStateForDebugger, processor))
- // debugStep(before, before, processor, false)
}
override def afterRepetition(after: PState, processor: Parser) {
val (_, beforeParser) = parseStack.pop
Assert.invariant(beforeParser eq processor)
- // debugStep(before.get, after, processor, false)
}
private def isInteresting(unparser: Unparser): Boolean = {
@@ -348,8 +345,7 @@ class InteractiveDebugger(runner:
InteractiveDebuggerRunner, eCompilers: Express
// Most errors are coming back here as RSDE because that's what they
get upconverted into.
// Most expression problems are considered SDE.
//
- case rsde: RuntimeSchemaDefinitionError => {
- // println(rsde.getMessage())
+ case _: RuntimeSchemaDefinitionError => {
state.setSuccess()
false
}
@@ -1320,7 +1316,6 @@ class InteractiveDebugger(runner:
InteractiveDebuggerRunner, eCompilers: Express
val longDesc = desc
def printData(rep: Option[Representation], l: Int, prestate:
StateForDebugger, state: ParseOrUnparseState, processor: Processor) {
- // val length = if (l <= 0) Int.MaxValue - 1 else l
val dataLoc = prestate.currentLocation.asInstanceOf[DataLoc]
val lines = dataLoc.dump(rep, prestate.currentLocation, state)
debugPrintln(lines, " ")
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/ArrayRelated.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/ArrayRelated.scala
index 0bb7cd3..58a88d8 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/ArrayRelated.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/ArrayRelated.scala
@@ -51,30 +51,29 @@ case class FNCount(recipe: CompiledDPath, argType:
NodeInfo.Kind)
case object FNExactlyOne extends RecipeOp {
override def run(dstate: DState) {
- // // Original implementation with boolean return-type
- //// val bool = dstate.arrayLength == 1
- //// dstate.setCurrentValue(bool)
+ // This was commented out in 6c9612e9f711beb1d8e4239ef9a473eb9c64a32f,
which as the commit message:
//
- // // New implementation as stated in tickets DFDL-1085/1087
- // val hasExactlyOne = dstate.arrayLength == 1
- // if (hasExactlyOne) {
- // val array = dstate.currentArray
- // val item = array.getOccurrence(1).asInstanceOf[DINode]
+ // Implements fn:exactly-one function, but comments out the functionality
as the function
+ // is useless until query-style path expressions are allowed/implemented.
Yields a subsetError
+ // until such time.
//
- // dstate.setCurrentNode(item)
- // }
- // else { throw new Exception("fn:exactly-one called with a sequence
containing zero or more than one item.") }
-
+ // // Original implementation with boolean return-type
+ // // val bool = dstate.arrayLength == 1
+ // // dstate.setCurrentValue(bool)
//
- //This was commented out in 6c9612e9f711beb1d8e4239ef9a473eb9c64a32f,
which as the commit message:
+ // // New implementation as stated in tickets DFDL-1085/1087
+ // val hasExactlyOne = dstate.arrayLength == 1
+ // if (hasExactlyOne) {
+ // val array = dstate.currentArray
+ // val item = array.getOccurrence(1).asInstanceOf[DINode]
//
- // Implements fn:exactly-one function, but comments out the
functionality as the function
- // is useless until query-style path expressions are
allowed/implemented. Yields a subsetError
- // until such time.
+ // dstate.setCurrentNode(item)
+ // }
+ // else { throw new Exception("fn:exactly-one called with a sequence
containing zero or more than one item.") }
+
// The reason queries are needed is that without them, well, the answer to
this has to be true, as
// there are no functions which return zero nor more than one node.
- //
dstate.SDE("Subset - fn:exactly-one is not implemented by Daffodil.")
}
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DFDLCheckConstraintsFunction.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DFDLCheckConstraintsFunction.scala
index 2d2e1ac..313aa19 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DFDLCheckConstraintsFunction.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DFDLCheckConstraintsFunction.scala
@@ -55,12 +55,4 @@ object DFDLCheckConstraintsFunction {
res
}
}
-
- // def checkOccurrence(minOccurs: Int, maxOccurs: Int, position: Long):
Boolean = {
- // // A maxOccurs of -1 signifies unbounded
- // if ( // position > minOccurs && // DON"T CHECK MIN OCCURS.
- // // That can't work. If minOccurs is 5 the first element at position 1
will fail this check.
- // ((position <= maxOccurs) || (maxOccurs == -1))) { return true }
- // return false
- // }
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/FNBases.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/FNBases.scala
index 595ae49..4ada327 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/FNBases.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/FNBases.scala
@@ -81,7 +81,7 @@ case class BooleanOp(op: String, left: CompiledDPath, right:
CompiledDPath)
override def run(dstate: DState) {
val savedNode = dstate.currentNode
left.run(dstate)
- val leftValue = dstate.currentValue.getBoolean //
convertToBoolean(dstate.currentValue, dstate.pstate)
+ val leftValue = dstate.currentValue.getBoolean
val result =
if ((op == "and" && leftValue == false) ||
@@ -90,7 +90,7 @@ case class BooleanOp(op: String, left: CompiledDPath, right:
CompiledDPath)
} else {
dstate.setCurrentNode(savedNode)
right.run(dstate)
- val rightValue = dstate.currentValue.getBoolean //
convertToBoolean(dstate.currentValue, dstate.pstate)
+ val rightValue = dstate.currentValue.getBoolean
rightValue
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetImpl.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetImpl.scala
index c7d670b..e5d0c33 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetImpl.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetImpl.scala
@@ -411,7 +411,6 @@ sealed abstract class LengthState(ie: DIElement)
val res = maybeStartDataOutputStream.isDefined
if (res) {
Assert.invariant(maybeStartPos0bInBits.isDefined)
- //
Assert.invariant(maybeStartDataOutputStream.get.maybeAbsBitPos0b.isEmpty)
}
res
}
@@ -420,7 +419,6 @@ sealed abstract class LengthState(ie: DIElement)
val res = maybeEndDataOutputStream.isDefined
if (res) {
Assert.invariant(maybeEndPos0bInBits.isDefined)
- //
Assert.invariant(maybeEndDataOutputStream.get.maybeAbsBitPos0b.isEmpty)
}
res
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLInfosetOutputter.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLInfosetOutputter.scala
index 2960620..8d6d209 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLInfosetOutputter.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLInfosetOutputter.scala
@@ -32,11 +32,9 @@ trait XMLInfosetOutputter {
* The text is a pseudo-XML string.
*/
protected final def fmtInfo(diTerm: DITerm): Maybe[String] = {
- // val mgXML = modelGroupsPseudoXML
val pecXML = diTerm.parserEvalCache.toPseudoXML()
val uecXML = diTerm.unparserEvalCache.toPseudoXML()
val puxml = {
- // mgXML +
(if (pecXML =:= "") "" else "\n" + pecXML) +
(if (uecXML =:= "") "" else "\n" + uecXML)
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LayerTransformer.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LayerTransformer.scala
index 950b85c..27c7d5f 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LayerTransformer.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LayerTransformer.scala
@@ -138,9 +138,6 @@ abstract class LayerTransformer()
val jis = wrapJavaInputStream(s, state)
val limitedJIS = wrapLimitingStream(jis, state)
val decodedInputStream = wrapLayerDecoder(limitedJIS)
- // val str = Iterator.continually { decodedInputStream.read()
}.takeWhile { _ != -1 }.toStream.mkString
- // println(str)
- // val bais = new ByteArrayInputStream(str.getBytes("ascii"))
val newDIS = InputSourceDataInputStream(decodedInputStream)
newDIS.cst.setPriorBitOrder(BitOrder.MostSignificantBitFirst) // must
initialize priorBitOrder
@@ -177,13 +174,12 @@ abstract class LayerTransformer()
//
}
- /**
- * These were very useful for debugging. Note that they stop with a ???
- * error. That's because dumping streams changes their state.
- *
- * Keeping these around commented out, for now. While this feature is still
- * new and may need further debugging.
- */
+ // These were very useful for debugging. Note that they stop with a ???
+ // error. That's because dumping streams changes their state.
+ //
+ // Keeping these around commented out, for now. While this feature is still
+ // new and may need further debugging.
+ //
// def dumpLayer(is: InputStream) {
// val str = Stream.continually(is.read).takeWhile(_ !=
-1).map(_.toChar).mkString
// println("dump length " + str.length + " = " + str)
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DFDLRegularExpressions.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DFDLRegularExpressions.scala
index 5510948..8bb4571 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DFDLRegularExpressions.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DFDLRegularExpressions.scala
@@ -85,7 +85,6 @@ object DFDLRegularExpressions {
""")""" +
"""(.*)""" // trailing stuff [after]
val contentPattern = str.format(escape, delim, padChar).r
- //System.err.println(contentPattern)
contentPattern
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataLoc.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataLoc.scala
index fad63b0..6260473 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataLoc.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataLoc.scala
@@ -85,22 +85,6 @@ class DataLoc(val bitPos1b: Long, bitLimit1b: MaybeULong,
val isAtEnd: Boolean,
}
}.getOrElse(Dump.MixedHexLTR(optEncodingName))
- // def text: Dump.Kind = optERD.map { erd =>
- // val rootERD = erd.parent
- // if (erd.rootERD.encodingInfo.isScannable)
Dump.TextOnly(optEncodingName)
- // else binary
- // }.getOrElse(binary)
-
- // val dumpKind: Dump.Kind = (rep, optERD.toScalaOption) match {
- // case (None, None) => binary
- // case (Some(Representation.Binary), _) => binary
- // case (Some(Representation.Text), _) => text
- // case (None, Some(erd)) => erd.impliedRepresentation match {
- // case Representation.Text => text
- // case Representation.Binary => binary
- // }
- // }
- // dumpStream(dumpKind, prestate, state)
dumpStream(binary, prestate, state) // for now. Let's require the hex+text
dumps always.
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Evaluatable.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Evaluatable.scala
index daf96a1..a88c420 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Evaluatable.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Evaluatable.scala
@@ -349,38 +349,6 @@ abstract class Evaluatable[+T <: AnyRef](protected val ci:
DPathCompileInfo, qNa
}
}
-/**
- * Rv is a "runtime value" as in, it is *always* evaluated, never cached, never
- * even considered as a possibility for a constant.
- */
-
-//abstract class Rv[+T <: AnyRef](rd: RuntimeData) extends Evaluatable[T](rd) {
-//
-// final override def isConstant = false // this is always to be computed
-//
-// final override def compile(state: CompileState) = {
-// //
-// // Just because this can't be constant ever, doesn't mean it doesn't
-// // call other things that might be folded into constants. So we have to
call super.compile().
-// //
-// val y = super.compile(state)
-// if (y.isDefined) {
-// // println("Compiling Done for %s.".format(qName))
-// } else {
-// // interesting that we got a value back from compiling, but since this
is a Rv we're going to
-// // disregard it anyway.
-// }
-// None // we never get a value back from compile().
-// }
-//
-// final override def apply(state: State): T = {
-// if (!isCompiled) {
-// compileIt(state)
-// }
-// compute(state)
-// }
-//}
-
final class EvalCache {
private val ht = new java.util.LinkedHashMap[Evaluatable[AnyRef], AnyRef] //
linked so we can depend on order in unit tests.
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/ProcessorBases.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/ProcessorBases.scala
index 42537bb..8a67dd6 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/ProcessorBases.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/ProcessorBases.scala
@@ -32,9 +32,6 @@ object Processor {
private def ensureCompiled(proc: Processor) {
if (!proc.isInitialized) {
proc.isInitialized = true
- // proc.childProcessors.foreach { cp =>
- // Assert.invariant(!cp.isEmpty)
- // }
proc.runtimeDependencies.foreach { ensureCompiled }
proc.childProcessors.foreach { ensureCompiled }
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Suspension.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Suspension.scala
index 7d4fadb..a698c63 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Suspension.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/Suspension.scala
@@ -178,18 +178,6 @@ trait Suspension
val cloneUState =
ustate.asInstanceOf[UStateMain].cloneForSuspension(original)
if (isReadOnly && didSplit) {
Assert.invariantFailed("Shouldn't have split. read-only case")
- // try {
- // // We did a DOS split, but we know we'll not be writing to it
- // //
- // // So we set finished immediately
- // //
- // // TODO: Begs the question of why we needed the split to begin
with in that
- // // case. Figure out why and document it!
- // //
- // original.setFinished(cloneUState)
- // } catch {
- // case boc: BitOrderChangeException => ustate.SDE(boc)
- // }
}
savedUstate_ = cloneUState
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/TypeCalculator.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/TypeCalculator.scala
index b611113..dcb719e 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/TypeCalculator.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/TypeCalculator.scala
@@ -98,7 +98,6 @@ abstract class TypeCalculator(val srcType: NodeInfo.Kind, val
dstType: NodeInfo.
if (err.isDefined) {
val diag = new ParseError(Maybe(context.schemaFileLocation),
dstate.contextLocation, err.get)
throw diag
- // throw
FNErrorFunctionException(Maybe(context.schemaFileLocation),
dstate.contextLocation, err.get)
}
dstate.setCurrentValue(ans)
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
index 86aecc6..3cdfce3 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
@@ -73,8 +73,6 @@ object VariableUtils {
def convert(v: String, rd: VariableRuntimeData): DataValuePrimitive =
rd.primType.fromXMLString(v)
-
- // Infoset.convertToInfosetRepType(rd.primType, v, rd)
}
abstract class VariableException(val qname: NamedQName, val context:
VariableRuntimeData, msg: String)
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/dfa/Registers.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/dfa/Registers.scala
index 3abd4c6..5b2db40 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/dfa/Registers.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/dfa/Registers.scala
@@ -85,19 +85,6 @@ class Registers() extends Poolable with Serializable {
}
/**
- * Use to set reader position to resume from.
- */
- // def setResume(resumeReader: DFDLCharReader) {
- // Registers.this.reader = resumeReader
- // }
- //
- // def resumeForUnparse(resumeReader: DFDLCharReader) {
- // Registers.this.reader = resumeReader
- // data0 = nextChar()
- // data1 = nextChar()
- // }
-
- /**
* Copy an existing Registers' reader position information
* to this Registers.
*
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ExpressionEvaluatingParsers.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ExpressionEvaluatingParsers.scala
index c217db0..6e1c5b7 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ExpressionEvaluatingParsers.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ExpressionEvaluatingParsers.scala
@@ -34,8 +34,6 @@ import org.apache.daffodil.processors.TypeCalculator
import org.apache.daffodil.processors.VariableRuntimeData
import org.apache.daffodil.util.LogLevel
-// import java.lang.{ Boolean => JBoolean }
-
/**
* Common parser base class for any parser that evaluates an expression.
*/
@@ -61,15 +59,13 @@ class IVCParser(expr: CompiledExpression[AnyRef], e:
ElementRuntimeData)
extends ExpressionEvaluationParser(expr, e) {
Assert.invariant(e.isSimpleType)
- def parse(start: PState): Unit =
- // withLoggingLevel(LogLevel.Info)
- {
- log(LogLevel.Debug, "This is %s", toString)
- val currentElement: InfosetSimpleElement = start.simpleElement
- val res = eval(start)
- currentElement.setDataValue(res)
- if (start.processorStatus ne Success) return
- }
+ def parse(start: PState): Unit = {
+ log(LogLevel.Debug, "This is %s", toString)
+ val currentElement: InfosetSimpleElement = start.simpleElement
+ val res = eval(start)
+ currentElement.setDataValue(res)
+ if (start.processorStatus ne Success) return
+ }
}
/*
@@ -153,7 +149,6 @@ class SetVariableParser(expr: CompiledExpression[AnyRef],
decl: VariableRuntimeD
log(LogLevel.Debug, "This is %s", toString) // important. Don't toString
unless we have to log.
val res = eval(start)
if (start.processorStatus.isInstanceOf[Failure]) return
- // val vmap = start.variableMap
start.setVariable(decl, res, decl, start)
}
}
@@ -188,39 +183,38 @@ class AssertExpressionEvaluationParser(
extends ExpressionEvaluationParser(expr, decl)
with AssertMessageEvaluationMixin {
- def parse(start: PState): Unit =
- // withLoggingLevel(LogLevel.Info)
- {
- log(LogLevel.Debug, "This is %s", toString)
- //
- // This now informs us of the success/failure of the expression
- // evaluation via side-effect on the start state passed here.
- //
- val res =
- try {
- if (discrim)
- start.dState.setMode(ParserDiscriminatorNonBlocking)
- eval(start)
- } finally {
- start.dState.setMode(ParserNonBlocking)
- }
- //
- // a PE during evaluation of an assertion is a PE
- //
- // Removed this assert check because eval now side-effects start to
- // contain the result status.
- // Assert.invariant(!start.processorStatus.isInstanceOf[Failure])
- //
- // Assert.invariant(res != null)
- if (start.processorStatus ne Success) return
-
- val testResult = res.getBoolean
- if (testResult) {
- start.setDiscriminator(discrim)
- } else {
- val message = getAssertFailureMessage(start)
- val diag = new AssertionFailed(decl.schemaFileLocation, start, message)
- start.setFailed(diag)
+ def parse(start: PState): Unit = {
+ log(LogLevel.Debug, "This is %s", toString)
+ //
+ // This now informs us of the success/failure of the expression
+ // evaluation via side-effect on the start state passed here.
+ //
+ val res =
+ try {
+ if (discrim) {
+ start.dState.setMode(ParserDiscriminatorNonBlocking)
}
+ eval(start)
+ } finally {
+ start.dState.setMode(ParserNonBlocking)
}
+ //
+ // a PE during evaluation of an assertion is a PE
+ //
+ // Removed this assert check because eval now side-effects start to
+ // contain the result status.
+ // Assert.invariant(!start.processorStatus.isInstanceOf[Failure])
+ //
+ // Assert.invariant(res != null)
+ if (start.processorStatus ne Success) return
+
+ val testResult = res.getBoolean
+ if (testResult) {
+ start.setDiscriminator(discrim)
+ } else {
+ val message = getAssertFailureMessage(start)
+ val diag = new AssertionFailed(decl.schemaFileLocation, start, message)
+ start.setFailed(diag)
+ }
+ }
}
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/SeparatedSequenceChildParseResultHelper.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/SeparatedSequenceChildParseResultHelper.scala
index b1fc8ff..97161cf 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/SeparatedSequenceChildParseResultHelper.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/SeparatedSequenceChildParseResultHelper.scala
@@ -94,7 +94,6 @@ trait SeparatedSequenceChildParseResultHelper
pstate: PState,
isZL: Boolean,
requiredOptional: RequiredOptionalStatus): ParseAttemptStatus = {
- // computeFailedParseAttemptStatus(parser, prevBitPosBeforeChild, pstate,
isZL, requiredOptional)
ParseAttemptStatus.MissingSeparator
}
diff --git
a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
index e34169e..6605afe 100644
---
a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
+++
b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
@@ -154,10 +154,6 @@ class Runner private (elem: scala.xml.Elem, dir: String,
file: String,
*/
def reset {
try {
- // if (file ne null)
- // System.err.println("Reset runner for " + resource)
- // else
- // System.err.println("Resetting runner")
tl_ts.set(null)
} catch {
case io: java.io.FileNotFoundException => //ok
diff --git
a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
index e86c35e..1be3250 100644
--- a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
+++ b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
@@ -381,7 +381,7 @@ class DFDLTestSuite private[tdml] (
Thread.sleep(1) // needed to give tools like jvisualvm ability to "grab
on" quickly
}
if (isTDMLFileValid) {
- val testCase = testCases.find(_.tcName == testName) // Map.get(testName)
+ val testCase = testCases.find(_.tcName == testName)
testCase match {
case None => throw TDMLException("test " + testName + " was not
found.", None)
case Some(tc) => {
@@ -1893,7 +1893,6 @@ case class Document(d: NodeSeq, parent: TestCase) {
val transitions = docPartBitOrders zip docPartBitOrders.tail zip
cumulativeDocumentPartLengthsInBits.tail zip dps
transitions.foreach {
case (((bitOrderPrior, bitOrderHere), cumulativeLength), docPart) => {
- // println("transition " + bitOrderPrior + " " + bitOrderHere + " " +
cumulativeLength)
Assert.usage(
(bitOrderPrior == bitOrderHere) || ((cumulativeLength % 8) == 0),
"bitOrder can only change on a byte boundary.")
@@ -1966,7 +1965,6 @@ case class Document(d: NodeSeq, parent: TestCase) {
// assemble the input from the various pieces, having lowered
// everything to bits.
val bytes = documentBytes
- // println("data size is " + bytes.length)
new java.io.ByteArrayInputStream(bytes)
}
}
@@ -2040,7 +2038,6 @@ class TextDocumentPart(part: Node, parent: Document)
extends DataDocumentPart(pa
}
def encodeWithNonByteSizeEncoder(s: String, byteSize: Int): Seq[String] = {
- //System.out.println("encodeWith3BitEncoder")
val bb = ByteBuffer.allocate(4 * s.length)
val cb = CharBuffer.wrap(s)
val coderResult = encoder.encode(cb, bb, true)
@@ -2049,7 +2046,6 @@ class TextDocumentPart(part: Node, parent: Document)
extends DataDocumentPart(pa
val res = (0 to bb.limit() - 1).map {
bb.get(_)
}
- // val bitsAsString = bytes2Bits(res.toArray)
val enc = encoder.asInstanceOf[BitsCharsetNonByteSizeEncoder]
val nBits = s.length * enc.bitsCharset.bitWidthOfACodeUnit
val bitStrings = res.map { b => (b & 0xFF).toBinaryString.reverse.padTo(8,
'0').reverse }.toList
@@ -2061,7 +2057,6 @@ class TextDocumentPart(part: Node, parent: Document)
extends DataDocumentPart(pa
}
def encodeWith8BitEncoder(s: String): Seq[String] = {
- //System.out.println("encodeWith8BitEncoder")
val bb = ByteBuffer.allocate(4 * s.length)
val cb = CharBuffer.wrap(s)
val coderResult = encoder.encode(cb, bb, true)
@@ -2070,8 +2065,6 @@ class TextDocumentPart(part: Node, parent: Document)
extends DataDocumentPart(pa
val res = (0 to bb.limit() - 1).map {
bb.get(_)
}
- // val bitsAsString = bytes2Bits(res.toArray)
- // val nBits = bb.limit() * 8
val bitStrings = res.map { b => (b & 0xFF).toBinaryString.reverse.padTo(8,
'0').reverse }.toList
bitStrings
}
@@ -2120,10 +2113,6 @@ class ByteDocumentPart(part: Node, parent: Document)
extends DataDocumentPart(pa
}
class BitsDocumentPart(part: Node, parent: Document) extends
DataDocumentPart(part, parent) {
- // val validBinaryDigits = "01"
-
- // lazy val bitContentToBytes = bits2Bytes(bitDigits).toList
-
lazy val bitDigits = {
val res = partRawContent.split("[^01]").mkString
res
@@ -2235,15 +2224,6 @@ sealed abstract class DocumentPart(part: Node, parent:
Document) {
childNode match {
case scala.xml.PCData(s) => Some(childNode)
case scala.xml.Text(s) => Some(childNode)
- // {
- // // can't just use s.trim here as that would remove explicit
- // // carriage returns like 
 if they have already been
- // // replaced by the corresponding character.
- // val trimmedEnd = s.replaceFirst("\\ +$", "") // spaces only
- // val trimmed = trimmedEnd.replaceFirst("^\\ +", "") // spaces
only
- // if (trimmed.length == 0) None
- // else Some(scala.xml.Text(trimmed))
- // }
case scala.xml.Comment(_) => None
case scala.xml.EntityRef(_) => Some(childNode)
case _: scala.xml.Atom[_] => Some(childNode) // Things like < come
through as this. Should be EntityRef
@@ -2352,7 +2332,6 @@ object UTF8Encoder {
// or next codepoint.
//
val bytes = XMLUtils.walkUnicodeString(s)(utf8LikeEncoding).flatten
- // val bytes = tuples.flatMap { case ((prevcp, cp), nextcp) =>
utf8LikeEncoding(prevcp, cp, nextcp) }
bytes
}
@@ -2397,7 +2376,6 @@ object UTF8Encoder {
val h = leadingSurrogate.toInt // aka 'h for high surrogate'
val l = trailingSurrogate.toInt // aka 'l for low surrogate'
val cp = 0x10000 + ((h - 0xD800) * 0x400) + (l - 0xDC00)
- // val byte1 = (cp >> 24) & 0xFF
val byte2 = (cp >> 16) & 0xFF
val byte3 = (cp >> 8) & 0xFF
val byte4 = cp & 0xFF
diff --git
a/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
b/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
index a77544d..e8d50fb 100644
---
a/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
+++
b/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala
@@ -133,7 +133,7 @@ final class TDMLDFDLProcessorFactory private (
val pf = compiler.compileSource(schemaSource, optRootName,
optRootNamespace)
val diags = pf.getDiagnostics
if (pf.isError) {
- Left(diags) // throw new TDMLException(diags)
+ Left(diags)
} else {
val res = this.generateProcessor(pf, useSerializedProcessor)
res