@@ -46,7 +46,7 @@ typedef struct reb_parse {
46
46
} REBPARSE ;
47
47
48
48
enum parse_flags {
49
- PF_SET ,
49
+ PF_SET_OR_COPY , // test PF_COPY first; if false, this means PF_SET
50
50
PF_COPY ,
51
51
PF_NOT ,
52
52
PF_NOT2 ,
@@ -707,9 +707,9 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
707
707
case SYM_COPY :
708
708
SET_FLAG (flags , PF_COPY );
709
709
case SYM_SET :
710
- SET_FLAG (flags , PF_SET );
710
+ SET_FLAG (flags , PF_SET_OR_COPY );
711
711
item = rules ++ ;
712
- if (!IS_WORD (item )) Trap1 (RE_PARSE_VARIABLE , item );
712
+ if (!( IS_WORD (item ) || IS_SET_WORD ( item ) )) Trap1 (RE_PARSE_VARIABLE , item );
713
713
if (VAL_CMD (item )) Trap1 (RE_PARSE_COMMAND , item );
714
714
word = item ;
715
715
continue ;
@@ -788,9 +788,12 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
788
788
// Any other cmd must be a match command, so proceed...
789
789
790
790
} else { // It's not a PARSE command, get or set it:
791
-
792
- // word: - set a variable to the series at current index
793
- if (IS_SET_WORD (item )) {
791
+
792
+ // word: - if not the target of a COPY or SET operation, this will
793
+ // default to setting a variable to the series at current index
794
+ if (IS_SET_WORD (item ) &&
795
+ !GET_FLAG (flags , PF_SET_OR_COPY ) || GET_FLAG (flags , PF_COPY ))
796
+ {
794
797
Set_Var_Series (item , parse -> type , series , index );
795
798
continue ;
796
799
}
@@ -991,7 +994,7 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
991
994
: Copy_String (series , begin , count ); // condenses
992
995
Set_Var_Series (word , parse -> type , ser , 0 );
993
996
}
994
- else if (GET_FLAG (flags , PF_SET )) {
997
+ else if (GET_FLAG (flags , PF_SET_OR_COPY )) {
995
998
if (IS_BLOCK_INPUT (parse )) {
996
999
item = Get_Var_Safe (word );
997
1000
if (count == 0 ) SET_NONE (item );
0 commit comments