According to JackHerrington in the book CodeGenerationInAction, Mixed Code Generation is described as a type of ActiveCodeGeneration in which the generator "reads a source code file and then modifies and replaces the file in place."
For this to work, each generation target must be identified with a tag stored within a comment in the source code, and after generation, each generated section is wrapped in begin/end tags also in comments. Since each target block can now be precisely identified, the code generator can be run again with updated definitions on the same file to properly update all affected targets.
As an example, the as yet unnamed tool being developed by the VbeXtremeTeam uses an XML-based syntax for tags stored in VisualBasic comments, something like this...
Original code:
'/<'Macro''''''Def name="macro1">
'/ Debug.Print "Test1"
'/ Debug.Print "Test2"
'/'Macro''''''Def>
Public Sub Foo()
'/
End Sub
Code after running the generator:
'/
'/ Debug.Print "Test1"
'/ Debug.Print "Test2"
'/
Public Sub Foo()
'/
Debug.Print "Test1"
Debug.Print "Test2"
'/
End Sub
-- SteveJorgensen
----
XmlForOnceAndOnlyOnce