[REBOL] Re: Strange parse "bug"/behavior?
From: rebol-list2::seznam::cz at: 17-Mar-2007 15:26
rule: [any [copy char skip 2 (prin char)]]
parse/all "this is a test string" rule
;==
tthhiiss iiss aa tteesstt ssttrriinngg== true
so it looks that the number means to repeat the action 2 times
it's feature, not a bug
d.
PK> Hi,
PK> in my recent tries with REBOL parser, I mistakenly thought, that if I
PK> want to skip one char, I need to do "skip 1", instead of "1 skip" or
PK> "skip". But follow following code:
PK> 1)
PK> rule: [any [copy char skip 1 (prin char)]]
PK> parse/all "this is a test string" rule
PK> result:
PK> this is a test string== true
PK> 2)
PK> rule: [any [copy char skip 1]]
PK> parse/all "this is a test string" rule
PK> result:
PK> ** Script Error: Invalid argument:
PK> ** Near: parse/all "this is a test string" rule
PK> And my question is - what is going on here? Should not case 1) fail too?
PK> How is that string is properly parsed, just because there is "(prin
PK> char)" added, if integer 1 contained in rule is not correct?
PK> Thanks,
PK> -pekr-