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

[REBOL] Parse, spaces and ()s

From: davidv:angliaed at: 31-Aug-2000 11:27

Newby question... Can anyone tell me what is going on here? The following output is produced by the script below one ( two three ) four ( five ( six seven ) eight ) Why do "two" and "three" appear as one string (same with "six" and "seven") and not split up at the space between them like everything else is - obviously the () have something to do with this - but I can't find an explanation anywhere. Also, what mods would I need to make to force it to split these particular strings at the whitespace? REBOL [] blk: [] brkt-chars: charset ["()"] brkt: [some brkt-chars] word-chars: charset [#"a" - #"z" #"A" - #"Z" #"0" - #"9"] word: [some word-chars] word-def: [word] brkt-def: [brkt] get-word: [copy value word-def (insert tail blk trim value)] get-brkt: [copy value brkt-def (insert tail blk trim value)] rule-block: [get-word | get-brkt | skip] str: "one (two three) four (five (six seven) eight)" parse str [some rule-block] foreach item blk [print item] Thanks in anticipation (I've only been playing with REBOL for about a week so forgive my ignorance if this should really be obvious). David