Comments on: PARSE: the new INTO rule
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.
|