@@ -210,6 +210,7 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
210
210
case REB_FILE :
211
211
case REB_URL :
212
212
case REB_EMAIL :
213
+ case REB_REF :
213
214
index = Find_Str_Str (series , 0 , index , SERIES_TAIL (series ), 1 , VAL_SERIES (item ), VAL_INDEX (item ), VAL_LEN (item ), flags );
214
215
break ;
215
216
@@ -228,11 +229,7 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
228
229
break;
229
230
*/
230
231
case REB_TAG :
231
- case REB_REF :
232
- // case REB_ISSUE:
233
- // !! Can be optimized (w/o COPY)
234
- ser = Copy_Form_Value (item , 0 );
235
- index = Find_Str_Str (series , 0 , index , SERIES_TAIL (series ), 1 , ser , 0 , ser -> tail , flags );
232
+ index = Find_Str_Tag (series , 0 , index , SERIES_TAIL (series ), 1 , VAL_SERIES (item ), VAL_INDEX (item ), VAL_LEN (item ), flags );
236
233
break ;
237
234
238
235
case REB_NONE :
@@ -426,14 +423,10 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
426
423
if (ch1 == ch2 ) goto found1 ;
427
424
}
428
425
else if (IS_TAG (item )) {
429
- ch2 = '<' ;
430
- if (ch1 == ch2 ) {
431
- // adapted from function Parse_To :-)
432
- REBSER * ser ;
433
- ser = Copy_Form_Value (item , 0 );
434
- i = Find_Str_Str (series , 0 , index , series -> tail , 1 , ser , 0 , ser -> tail , AM_FIND_MATCH | parse -> flags );
426
+ if (ch1 == '<' ) {
427
+ i = Find_Str_Tag (series , 0 , index , series -> tail , 1 , VAL_SERIES (item ), VAL_INDEX (item ), VAL_LEN (item ), AM_FIND_MATCH | parse -> flags );
435
428
if (i != NOT_FOUND ) {
436
- if (is_thru ) i += ser -> tail ;
429
+ if (is_thru ) i += VAL_LEN ( item ) + 2 ;
437
430
index = i ;
438
431
goto found ;
439
432
}
@@ -533,18 +526,10 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
533
526
}
534
527
else {
535
528
// "str"
536
- if (ANY_BINSTR (item )) {
537
- if (!IS_STRING (item ) && !IS_BINARY (item )) {
538
- // !!! Can this be optimized not to use COPY?
539
- // O: It would require Find_Str_Tag, Find_Str_Ref
540
- ser = Copy_Form_Value (item , 0 );
541
- i = Find_Str_Str (series , 0 , index , series -> tail , 1 , ser , 0 , ser -> tail , HAS_CASE (parse ));
542
- if (i != NOT_FOUND && is_thru ) i += ser -> tail ;
543
- }
544
- else {
545
- i = Find_Str_Str (series , 0 , index , series -> tail , 1 , VAL_SERIES (item ), VAL_INDEX (item ), VAL_LEN (item ), HAS_CASE (parse ));
546
- if (i != NOT_FOUND && is_thru ) i += VAL_LEN (item );
547
- }
529
+ //O: not using ANY_BINSTR as TAG is now handled separately
530
+ if (VAL_TYPE (item ) >= REB_BINARY && VAL_TYPE (item ) < REB_TAG ) {
531
+ i = Find_Str_Str (series , 0 , index , series -> tail , 1 , VAL_SERIES (item ), VAL_INDEX (item ), VAL_LEN (item ), HAS_CASE (parse ));
532
+ if (i != NOT_FOUND && is_thru ) i += VAL_LEN (item );
548
533
}
549
534
// #"A"
550
535
else if (IS_CHAR (item )) {
@@ -556,6 +541,10 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
556
541
i = Find_Str_Bitset (series , 0 , index , series -> tail , 1 , VAL_BITSET (item ), HAS_CASE (parse ));
557
542
if (i != NOT_FOUND && is_thru ) i ++ ;
558
543
}
544
+ else if (IS_TAG (item )) {
545
+ i = Find_Str_Tag (series , 0 , index , series -> tail , 1 , VAL_SERIES (item ), VAL_INDEX (item ), VAL_LEN (item ), HAS_CASE (parse ));
546
+ if (i != NOT_FOUND && is_thru ) i += VAL_LEN (item ) + 2 ;
547
+ }
559
548
else
560
549
Trap1 (RE_PARSE_RULE , item - 1 );
561
550
}
0 commit comments