PPWIZARD Manual
[Bottom][Contents][Search][Prev]: Rexx Looping[Next]: Standard Rexx Routines

Rexx Parsing

You can get a (slighty out of date) regina rexx manual from http://sites.netscape.net/ssatguru, this has HTML and compiled Windows Help formats for download.

Parsing is another of rexx's complex areas, a subset of its syntax is summarised here:

    PARSE [UPPER] LINEIN [template]
    PARSE [UPPER] NUMERIC template
    PARSE [UPPER] VAR symbol template
    PARSE [UPPER] VALUE expression WITH template
    
        template        -> [firstPosition] assignments [assignments]
        assignments     -> [nextPosition] varlist [stopPosition]
        varlist         -> varname ' ' [varlist]
        varname         ->   "non-constant symbol"
                           | '.'
        firstPosition   -> position
        nextPosition    -> position [nextPosition]
        stopPosition    -> position
        position        ->   searchPosition
                           | absPosition
                           | relPosition
                           | '(' "expression" ')'
        searchPosition  -> "string constant"
        absPosition     ->   "integer"
                           | '=' numexpr
        relPosition     ->   '+' numexpr
                           | '-' numexpr
        numexpr         ->   "integer"
                           | '(' "integer expression" ')'
    
    

This is an example of extracting each directory (one at a time) from the path (located in DOS or OS/2 environment):

    ;--- Get "PATH" from environment
    #evaluate ^^  ^_Path = GetEnv('PATH')^
    
    ;--- Start list -----------------
    <P>The path is:
    <OL>
    
    ;--- List Components ------------
    #{
       ;--- Get next directory name -
       #evaluate ^^ ^parse var _Path _ThisBit ';' _Path^
    
       ;--- Exit if at end of path --
       #if  _ThisBit = '' & _Path=''
            #break
       #endif
    
       ;--- Output directory name ---
       <LI><??_ThisBit>
    #}
    
    ;--- End list -------------------
    </OL>
    


[Top][Contents][Search][Prev]: Rexx Looping[Next]: Standard Rexx Routines

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Tuesday January 02 2001 at 7:37am