From 3b413fad1c8654fa1cae0f4ee0925f4a80d57b30 Mon Sep 17 00:00:00 2001 From: Oldes Date: Sat, 15 Feb 2020 23:11:38 +0100 Subject: [PATCH] FIX: Remove the DO keyword from PARSE fixes: https://github.com/Oldes/Rebol-issues/issues/2083 related: https://github.com/Oldes/Rebol-issues/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) --- src/core/u-parse.c | 9 +++++---- src/tests/units/parse-test.r3 | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/core/u-parse.c b/src/core/u-parse.c index c734a43bb5..f9012bdb72 100644 --- a/src/core/u-parse.c +++ b/src/core/u-parse.c @@ -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) @@ -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 /*********************************************************************** ** @@ -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; } diff --git a/src/tests/units/parse-test.r3 b/src/tests/units/parse-test.r3 index b7f34313d4..016ee166ca 100644 --- a/src/tests/units/parse-test.r3 +++ b/src/tests/units/parse-test.r3 @@ -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~~~