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

[REBOL] Re: Parsing

From: lmecir::mbox::vol::cz at: 31-Oct-2002 15:18

Hi Arnaud,
> I try to parse a string > > text: " -a bb" > note-rules: [ some ["-a" (print "a") |"b" (print"b")]] > > It works like that but if I change the rule by adding a space before -a it > does not work : > note-rules: [ some [" -a" (print "a") |"b" (print"b")]] > > Could you tell me why ? > > Thx > Arno:)
You have got two choices: 1) let PARSE handle whitespace automatically. Then you cannot use whitespace in your rule, because PARSE filters whitespace out. 2) don't let PARSE to handle whitespace automatically. You have to call PARSE as follows: parse/all text note-rules In this case your rule doesn't look correct, because it cannot handle the whitespace before "bb".