REBOL 3.0

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.)

2 Comments

Comments:

Kaj
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.
Chris
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.

Name:

Blog id:

R3-0259


Comment:


 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.

REBOL 3.0
Updated 24-Apr-2024 - Edit - Copyright REBOL Technologies - REBOL.net