home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / rexx / 757 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  2.2 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!uakari.primate.wisc.edu!doug.cae.wisc.edu!umn.edu!noc.msc.net!uc.msc.edu!apctrc!wsc!mozart!zjlc12
  2. From: zjlc12@hou.amoco.com (Jerry Campbell)
  3. Newsgroups: comp.lang.rexx
  4. Subject: PARSE wishlist/brainstorming
  5. Message-ID: <1992Aug20.154822.8057@hou.amoco.com>
  6. Date: 20 Aug 92 15:48:22 GMT
  7. Sender: news@hou.amoco.com
  8. Reply-To: zjlc12@hou.amoco.com
  9. Organization: Amoco
  10. Lines: 47
  11.  
  12. Why not add the STEM keyword to the Parse instruction?  
  13.  
  14.     Parse Var data STEM (stem style template)
  15.  
  16. where template could be composed of the usual string pattern matching and  
  17. numeric positional specifiers.  String patterns would work in the usual way.
  18. The numeric positional (column) specifiers would indicate a stem variable 
  19. range to assign to.  The numerics would imply a starting location (stem index)
  20. and a repetition factor.  I sure I'm not making myself clear.  Let me try an
  21. example:
  22.  
  23.    data = "Hello world, hello solar sytem, hello galaxy"
  24.    Parse Var data STEM  "hello" 1 stem. +3
  25.  
  26. and Parse would assign to stem. like so:
  27.  
  28.    stem.1 = "world,"
  29.    stem.2 = "solar system,"
  30.    stem.3 = "galaxy"
  31.  
  32. Another possible new feature that could make use of the STEM idea would be a
  33. new source keyword, such as QUEUE.  QUEUE would imply "Parse Pull" and keep
  34. on pulling till the repetition implied in the stem template is
  35. satisfied or end of stack is reached.  Example:
  36.  
  37.    Address "uni-shell" "ls -l" "TO QUEUE"
  38.    Parse QUEUE STEM 1 permissions. .  user. size. . . . filename.   
  39.  
  40. and have the lines output from the ls command parsed into the stem variables
  41. permission. , user. , size. , and filename.  
  42.  
  43. Or better yet, how about adding the concept of data streams/files to Rexx so you 
  44. could read an input stream/file in the following way:
  45.  
  46.    Address "uni-shell" "ls" "TO STDIN"
  47.    Parse STREAM STDIN STEM 1 records. +999 (CR_LF)    
  48.  
  49. and have records.(1-eof) loaded with the data waiting on STDIN (the CR_LF variable
  50. would contain line separator characters to break the stream into record/line chunks).    
  51.  
  52. Anyone care to comment?  Feel free to flame away.  This wasn't meant to be a
  53. really serious proposal, just a thought stimulator.   
  54.  
  55. ---
  56. Jerry Campbell   reply to: zjlc12@hou.amoco.com 
  57. Amoco Corp. ISD  SSS/Graphics
  58. Houston, Tx.     713/556-7036
  59.