in daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala [265:308]
def generateCode(gram: Gram, cgState: CodeGeneratorState): Unit = {
gram match {
// Skip empty grams
case g: Gram if g.isEmpty => noop(g)
// Handle non-empty grams
case g: AlignmentFill => alignmentFillGenerateCode(g, cgState)
case g: AssertBooleanPrim =>
assertStatementGenerateCode(
g.name,
g.exprText,
g.stmt.failureType == FailureType.RecoverableError,
cgState
)
case g: BinaryBoolean => binaryBooleanGenerateCode(g.e, cgState)
case g: BinaryDouble => binaryFloatGenerateCode(g.e, lengthInBits = 64, cgState)
case g: BinaryFloat => binaryFloatGenerateCode(g.e, lengthInBits = 32, cgState)
case g: BinaryIntegerKnownLength =>
binaryIntegerKnownLengthGenerateCode(g.e, g.lengthInBits, cgState)
case g: CaptureContentLengthEnd => noop(g)
case g: CaptureContentLengthStart => noop(g)
case g: CaptureValueLengthEnd => noop(g)
case g: CaptureValueLengthStart => noop(g)
case g: ChoiceCombinator => choiceCombinator(g, cgState)
case g: ElementCombinator => elementCombinator(g, cgState)
case g: ElementParseAndUnspecifiedLength =>
elementParseAndUnspecifiedLengthGenerateCode(g, cgState)
case g: ElementUnused => noop(g)
case g: HexBinaryLengthPrefixed => hexBinaryLengthPrefixedGenerateCode(g.e, cgState)
case g: HexBinarySpecifiedLength => hexBinarySpecifiedLengthGenerateCode(g.e, cgState)
case g: OrderedSequence => orderedSequenceGenerateCode(g, cgState)
case g: Prod => prod(g, cgState)
case g: RepOrderedExactlyNSequenceChild => repOrderedExactlyNSequenceChild(g, cgState)
case g: RepOrderedExpressionOccursCountSequenceChild =>
repOrderedExpressionOccursCountSequenceChild(g, cgState)
case g: RepOrderedWithMinMaxSequenceChild => repOrderedWithMinMaxSequenceChild(g, cgState)
case g: RightFill => noop(g)
case g: ScalarOrderedSequenceChild => scalarOrderedSequenceChild(g, cgState)
case g: SeqComp => seqCompGenerateCode(g, cgState)
case g: SpecifiedLengthExplicit => specifiedLengthExplicit(g, cgState)
case g: SpecifiedLengthImplicit => specifiedLengthImplicit(g, cgState)
case g: SpecifiedLengthPrefixed => specifiedLengthPrefixed(g, cgState)
case _ => gram.SDE("Code generation not supported for: %s", Misc.getNameFromClass(gram))
}
}