REBOL 3.0

PARSE: the new INTO rule

Carl Sassenrath, CTO
REBOL Technologies
5-Oct-2009 18:36 GMT

Article #0259
Main page || Index || Prior Article [0258] || Next Article [0260] || 2 Comments || Send feedback

The focus of A86 was to rework the code to make it possible to finish more of the needed changes to the PARSE function. This release should also fix a few bugs, but the focus of this release was not on bug fixing (that will happen soon.)

One change of interest in A86 is that INTO can enter into a sub-parse of a string. For example, this line parses both a block and the string within it:

>> parse [a "test"] ['a into ["te" "st"]]
== true

Of course, most of the time you will want to confirm the datatype before such a match. This can be done with the AND word:

>> parse [a "test"] ['a and string! into ["te" "st"]]
== true

Here AND checks that the input is a string before the sub-parse. (Because AND does not advance the input.)

2 Comments

REBOL 3.0
Updated 27-Mar-2024 - Edit - Copyright REBOL Technologies - REBOL.net