rebol/r3 — pull request #60 by earl (2013-01-06 00:18:26+00:00)
Title: Fix a regression in PARSE for the THRU keyword

Commit 44012cc1e7313f2fd3772e543f2f8b9096d90f9c introduced a regression to PARSE that may lead a failing THRU to incorrectly reset the parse position. This, in turn, leads to endless loops in PARSE. A testcase showing this regression is:

parse "123.123." [any [thru "123"]]

This same regression also caused an endless loop in the `make prep` step of the R3 build.

Technically, the earlier commit always incremented the match position with the number of characters for skipping a successful THRU, without checking if the THRU match itself was successful. For unsuccesful matches, `NOT_FOUND` is returned, which is defined as -1. Adding the THRU offset to this may result in a position that is again within bounds of the data to be parsed, thereby potentially initiating an endless loop.

This commit fixes the regression by adding an explicit check against NOT_FOUND to the increment condition.