Skip to content

Commit

Permalink
FIX: Remove the DO keyword from PARSE
Browse files Browse the repository at this point in the history
fixes: Oldes/Rebol-issues#2083
related: Oldes/Rebol-issues#2085

DO rule was not working properly and as a confusing, I agree with Ladislav and disable it for now. (The current `Do_Eval_Rule` code can be enabled using the `USE_DO_PARSE_RULE` define)
  • Loading branch information
Oldes committed Feb 15, 2020
1 parent b2e59dd commit 3b413fa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/u-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
return i;
}


#ifdef USE_DO_PARSE_RULE
//@@ https://github.com/Oldes/Rebol-issues/issues/2083
/***********************************************************************
**
*/ static REBCNT Do_Eval_Rule(REBPARSE *parse, REBCNT index, REBVAL **rule)
Expand Down Expand Up @@ -653,7 +654,7 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
UNSAVE_SERIES(newparse.series);
return n;
}

#endif // USE_DO_PARSE_RULE

/***********************************************************************
**
Expand Down Expand Up @@ -931,13 +932,13 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
&& (Parse_Series(val, VAL_BLK_DATA(item), parse->flags, depth+1) == VAL_TAIL(val))
) ? index+1 : NOT_FOUND;
break;

#ifdef USE_DO_PARSE_RULE
case SYM_DO:
if (!IS_BLOCK_INPUT(parse)) goto bad_rule;
i = Do_Eval_Rule(parse, index, &rules);
rulen = 1;
break;

#endif
default:
goto bad_rule;
}
Expand Down
10 changes: 10 additions & 0 deletions src/tests/units/parse-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,15 @@ Rebol [

===end-group===

===start-group=== "DO"

--test-- "issue-2083"
;@@ https://github.com/Oldes/Rebol-issues/issues/2083
;@@ https://github.com/Oldes/Rebol-issues/issues/2085
--assert error? err: try [parse [1 + 1] [set result do integer!]]
--assert err/id = 'parse-rule

===end-group===


~~~end-file~~~

0 comments on commit 3b413fa

Please sign in to comment.