Comments on: 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.)



6-Oct-2009 8:29:57
That is a great feature. The past lack of it has been preventing me to use PARSE in many situations.
23-Oct-2009 1:17:07
The only problem here would be with current scripts that actually try to match a block ["te" "st"] and encounter a string, particularly if the 'into rule contains block-only directives ["te" set var string!]

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 15-Jun-2024 - Edit - Copyright REBOL Technologies -