On 2017-12-07 19:52, Richard Gaskin via use-livecode wrote:
Would it be possible/practical to extend the merge function to at
least allow things like control structures with non-LC stuff in
between them?
E.g., from my earlier post:
EXAMPLE B
The implicit merge LC Server uses is more complete than the
explicitly-called merge function. For example, the merge function
doesn't handle conditionals cross non-code parts, e.g.:
<?lc if a = b then ?>
<p>Some data that happens to be HTML</p>
<?lc else ?>
<p>Some other data that happens to be HTML</p>
<?lc end if ?>
That'll work in LC Server, but AFAIK is incompatible with LC Script on
the desktop.
Possible - yes. Worthwhile implementing in C++ in the engine - probably
not...
The reason I say that is because it would be relatively straight-forward
(assuming appropriate knowledge) to write an LCS script which transforms
a server script into an LC stack which 'does the same thing' and then
you have something far more adaptable.
A LC Server script is an alternating sequence of code and text blocks.
Once you have that alternating sequence, you could replace the text
blocks with a call to a handler with a parameter which is a custom prop
of the stack containing the text content. Then the code would need to be
transformed so that all inline commands where in a single handler, all
variable decls at top-level were script locals, and all handler
definitions in the code blocks next to the main handler.
The only slight tricky bit is the creation of root-scope variables if
not using explicitVars. I'd need to give that some thought but doing it
with a transformation written in script would mean you could (for the
most part) emulate the LC server environment in the IDE - even replacing
server specific commands (e.g. put output) with calls to handlers which
emulate them.
Warmest Regards,
Mark.
--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode