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

[REBOL] Re: Simple parse question

From: lmecir:mbox:vol:cz at: 14-Apr-2003 12:24

Hi Tom, you wrote:
> >> words: [some [any { } copy w [to { }](append result w )] copy w to end > (append result w )] > >> result: copy [] parse {Don't "Mess up"} words > == true > >> result > == ["Don't" {"Mess} {up"}]
this looks OK, but there is a bug: result: copy [] parse "a" words ; == false to accept even one-word texts I suggest: ws: charset [#"^-" #"^/" #"^M" #"^(page)" " "] nonws: complement ws fail: [end skip] words: [ (result: copy [] br: none) any [ br any ws [ end (br: fail) | copy w any nonws (insert tail result w) ] ] ] A more complicated question: how would you rewrite the rule using the new parse dialect keyword BREAK? Regards -Ladislav