Skip to content

Commit

Permalink
FIX: Parse's reject working incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 21, 2022
1 parent 1a46e32 commit 8549cab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/u-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,8 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
return index;

case SYM_REJECT:
parse->result = -1;
return index;
parse->result = 0;
return NOT_FOUND;

case SYM_FAIL:
index = NOT_FOUND;
Expand Down
12 changes: 12 additions & 0 deletions src/tests/units/parse-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ Rebol [
===end-group===


===start-group=== "REJECT"
--test-- "reject"
;@@ https://github.com/Oldes/Rebol-issues/issues/2394
--assert not parse "aa" [some [#"a"] reject]
--assert parse "aabb" [opt [#"a" reject] to end]
--assert not parse "aabb" [some [#"a" reject] to end]
--assert not parse "aabb" [some #"a" reject to end]
--assert not parse "aabb" [[#"a" reject | "aabb"]]
--assert parse "aabb" [[#"a" reject] | "aabb"]
===end-group===


===start-group=== "CASE / NO-CASE"
;@@ https://github.com/Oldes/Rebol-issues/issues/1898
--test-- "case/no-case 1"
Expand Down

0 comments on commit 8549cab

Please sign in to comment.