metaeducation / rebol-issues

6 stars 1 forks source link

parse behaves erratic and crashes #591

Open rebolbot opened 15 years ago

rebolbot commented 15 years ago

Submitted by: sqlab

bc.. parse behaves erratic and crashes the interpreter

p.

bc.. >> parse " " [0] * Script error: self word is not bound to a context * Where: parse \ Near: parse " " [0]

p.

bc.. \ Note: use WHY? for more about this error

p.

bc.. >> parse " " [] == false

p.

bc.. >> parse " " "0" == []

p.

bc.. >> parse " " ["0"] == false

p.

bc.. >> parse " " [] == false

p.

bc.. >> parse " " [0] == false

p.

bc.. >> parse " " [0] ==> crash

p.

bc.. parse " " [0] parse " " [] parse " " "0" parse " " ["0"] parse " " [] parse " " [0] parse " " [0]

p.

CC - Data [ Version: alpha 32 Type: Bug Platform: Windows Category: n/a Reproduce: Always Fixed-in:alpha 50 ]

rebolbot commented 15 years ago

Submitted by: BrianH

The statement parse " " [0] is invalid parse syntax: The 0 is a modifier that means that the next rule should be matched 0 times, and there is no next rule. Apparently PARSE is not checking its operations for errors in the rules before trying to execute them, or is not executing them in a error-resistant way (depending on the strategy used in PARSE).

We will have to decide whether we should fix this now or when we rewrite PARSE based on the proposals. In the meanwhile it would be a good idea to use only valid parse rules (currently the same as R2, but charsets don't work too well because of Unicode).

rebolbot commented 15 years ago

Submitted by: Carl

You will now see:

>> parse "" [0]
** Script error: invalid parse rule: 0