PARSE: do you want BREAK?
The break word is not yet defined in parse, but it can be added if desired. So, say something if you want it.
Note that we have fail now, which fails a specific rule, and moves to the next alternate:
>> parse "abc" ["abc" fail | "bcd"]
== false
>> parse "abc" ["ab" fail | "abc"]
== true
>> parse "bcd" ["ab" fail | "bcd"]
== true
But, fail does not let you fail the entire rule block, so perhaps that's a choice for break:
>> parse "bcd" ["b" break | "bcd"]
== false
Some developers have suggested a return value for break, but I'm not sure why that is useful.
Also, note that return is now implemented for returning from parse via an internal throw action.
>> parse "bcd" ["abc" | "bcd" return ('ok) | "cab"]
== ok
(Note: there's another form for return, but it's not working in A87.)
19 Comments
|