Out of Order text generation [message #727433] |
Wed, 21 September 2011 05:38  |
Eclipse User |
|
|
|
Hi
Is there any mechanism for non-linear text emission?
For instance when generating Java code, the need for imports may be
detected and accumulated by an ImportManager, but, in a one pass
algorithm, the resulting imports must be emitted before detection.
The Mof2Text spec in 7.3 suggests that the FileBlock can be used as a
stack to change context. Perhaps a similar StringBlock could emulate a
'Program Section' accumulating contributions which are finally pasted
together.
[string body][emitBody()/][/string]
[string prefix][emitPrefix()/][/string]
[file ('useful')][prefix/][body/][/file]
Perhaps some query such as [emitImports(theImports)/] could be marked as
'late' or 'lazy' so that the invocation marks the insert point for the
late evaluation once theImports has been populated.
Regards
Ed Willink
|
|
|
|
|
Re: Out of Order text generation [message #730087 is a reply to message #727433] |
Tue, 27 September 2011 11:28  |
Eclipse User |
|
|
|
Hi
I found that there is a really handy PreviewStrategy that exposes the
internal implementation of fileblocks as stringbuffers so that
generate() returns a map of 'filename' to 'filecontent'; just what's
needed for program sections.
Regards
Ed Willink
On 21/09/2011 10:38, Ed Willink wrote:
> Hi
>
> Is there any mechanism for non-linear text emission?
>
> For instance when generating Java code, the need for imports may be
> detected and accumulated by an ImportManager, but, in a one pass
> algorithm, the resulting imports must be emitted before detection.
>
> The Mof2Text spec in 7.3 suggests that the FileBlock can be used as a
> stack to change context. Perhaps a similar StringBlock could emulate a
> 'Program Section' accumulating contributions which are finally pasted
> together.
>
> [string body][emitBody()/][/string]
> [string prefix][emitPrefix()/][/string]
> [file ('useful')][prefix/][body/][/file]
>
> Perhaps some query such as [emitImports(theImports)/] could be marked
> as 'late' or 'lazy' so that the invocation marks the insert point for
> the late evaluation once theImports has been populated.
>
> Regards
>
> Ed Willink
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.25481 seconds