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

[REBOL] Strange parsing behavior

From: robert:muench:robertmuench at: 2-Aug-2002 19:27

Hi, please have a look at this code and try it out: ---START rebol [] rule1: [start: copy string1 [to " - " (?? string1) | to newline] copy string2 to end] rule2: [start: copy string1 [to " - " (?? string1) 3 skip | to newline] copy string2 to end] text: "this is a - parsing test" parse/all text rule1 ?? string1 ?? string2 print "-----" parse/all text rule2 ?? string1 ?? String2 ---END
>> do %parsing-error.r
string1: "this is a - " string1: "this is a" string2: " - parsing test" ----- string1: "this is a" string1: "this is a - " string2: "parsing test" == "parsing test" I find some things very strange here: Rule1: - Why does string1 contain " - " when printed from inside the rule? The rule states 'to and not 'thru? IMO string1 should be "this is a" - After the parsing string1 holds what I did expect in the first place too. This indicates that the varaibles input gets copied to will be changed after the parsing. But when and how? Rule2: - This time the string1 is as expected inside the rule but changes to include the to " - " sequence after the parsing Any idea what's up here? Is this a bug? Robert