Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] How to Parse a Nested Block

From: tim::johnsons-web::com at: 17-Sep-2001 14:50

I swear I'm as dumb as stump when it comes to parsing: but I've got "problem" whose "solution" should enlighten me immensely. Here 'tis: I want to parse rebol code so that I "extract" the interface block from a function. The following script "isolates" the code in a block, but not if there are inner blocks: rule: [thru "[" copy block-contents to "]" (print block-contents)] parse/all {["This is a block"]} rule ; returns: This is a block ; okay, that's what I want. Cool! parse/all {[text[string!] size[integer!]]} rule ; returns only [text[string! ; bummer, not what I wanted ; I wanted to see: text[string!] size[integer!] ; in other words parsed to the matching closing bracket ; What else to I need to do? TIA Tim