On 11/30/2021 2:37 PM, Jeremy Nicoll wrote:
> Obviously, to keep ooREXX happy, these macros have to be perfectly
> valid ooREXX programs.  But they contain occasional lines like
> 
>   if interpreter == "ooREXX" then do
>        /* offer a choice */
>        oodlog = .ListChoice~new(ootext,ootitl,oomn.,oosizx,oosizy,ooinit)
>   end
>   else do
>       /* code to offer a choice using a kedit popup menu */
>   end
> 
> and the KEXX interpreter never examines the line inside the do/end
> because the condition is never true when it is executing.

It has to examine them at least for balanced quotes and comment
delimiters, in order to find that END.  That's the syntax scan we're
talking about here, done in Classic Rexx to find the start of an
internal routine or the end of the program, and in Object Rexx to find
any directives before it can start running the program.

> The code inside the Kedit side of the statement is syntactically valid 
> ooREXX (though wouldn't actually make sense to ooREXX as it's full
> of Kedit commands - but ooREXX just sees literal strings, like any 
> other commands being passed to a host environment - and calls of
> Kedit functions.  The latter would certainly cause problems if ooREXX
> tried to execute that code, but it passes a syntax check ok.
> 
> There /would/ be a problem if ooREXX were ever to get to the stage
> of attempting to ensure that external functions were findable before
> the code executes. 

That initial syntax scan doesn't care whether external routines are
findable.  They don't have to be, at the start of the program.  They
could be created by the program itself.

ooRexx does do a little more syntax validation in the initial scan than
I expected, though.  CMS REXX, for example, strictly checks for valid
characters and completed literals and comments, leaving anything else
for runtime.  But ooRexx actually requires valid REXX statements.  It
fails for things like unexpected commas and even invalid expressions.

¬R




_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to