Parse with indexed string

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Parse with indexed string

P.G. van der Schot
Q: What's wrong with the form 'Parse a x[i] b'

      line = 'something ; something_else'
      item  = ''
      Loop n = 1 By 1  While line <> ''
        Parse line item[n] ';' line           -- indexed string
      End

      Loop i=1 to n-1
       Say item[i]
      End

NetRexx portable processor, version 1.120
Copyright (c) IBM Corporation, 1997.  All rights reserved.
Program TSTPARSE.NRX
 21 +++         Parse line item[n] ';' line
    +++                        ^
    +++ Error: Unexpected token in parsing template
Compilation of 'TSTPARSE.NRX' failed [one error]

-- ===============================

Following works:

      line =  'something ; something_else'
      item =  ''
      Loop n = 1 By 1  While line <> ''
         Parse line head ';' line             -- no indexed string
         item[n] =  head
      End

      Loop i=1 to n-1
       Say item[i]
      End

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>