Skip to content

Commit 91f574b

Browse files
committed
FIX: parse/case parsing words and paths
resolves: Oldes/Rebol-issues#2552
1 parent b6aedca commit 91f574b

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/core/u-parse.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,12 @@ void Print_Parse_Index(REBCNT type, REBVAL *rules, REBSER *series, REBCNT index)
312312
// 'word
313313
case REB_LIT_WORD:
314314
index++;
315-
if (IS_WORD(blk) && (VAL_WORD_CANON(blk) == VAL_WORD_CANON(item))) break;
315+
if (IS_WORD(blk) && !Compare_Word(blk, item, HAS_CASE(parse))) break;
316316
goto no_result;
317317

318318
case REB_LIT_PATH:
319319
index++;
320-
if (IS_PATH(blk) && !Cmp_Block(blk, item, 0)) break;
320+
if (IS_PATH(blk) && !Cmp_Block(blk, item, HAS_CASE(parse))) break;
321321
goto no_result;
322322

323323
case REB_NONE:

src/tests/units/parse-test.r3

+27
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,29 @@ Rebol [
448448
--assert parse to binary! "aaaAB" [thru #"A" #"B"]
449449
--assert parse to binary! "aaaAB" [thru #"A" no-case #"b"]
450450
--assert not parse to binary! "aaaAB" [thru #"A" #"b"]
451+
452+
;@@ https://github.com/Oldes/Rebol-issues/issues/2552
453+
--test-- "parse/case word"
454+
--assert parse [a]['a]
455+
--assert parse [a]['A]
456+
--assert parse/case [a]['a]
457+
--assert not parse/case [a]['A]
458+
--test-- "parse/case quoted word"
459+
--assert parse [a][quote a]
460+
--assert parse [a][quote A]
461+
--assert parse/case [a][quote a]
462+
--assert not parse/case [a][quote A]
463+
--test-- "parse/case path"
464+
--assert parse [p/a]['p/a]
465+
--assert parse [p/a]['p/A]
466+
--assert parse/case [p/a]['p/a]
467+
--assert not parse/case [p/a]['p/A]
468+
--test-- "parse/case quoted word"
469+
--assert parse [p/a][quote p/a]
470+
--assert parse [p/a][quote p/A]
471+
--assert parse/case [p/a][quote p/a]
472+
--assert not parse/case [p/a][quote p/A]
473+
451474
===end-group===
452475

453476

@@ -920,6 +943,10 @@ if not error? try [str: to string! #{A032}][
920943
e/arg1 = quote :pos
921944
]
922945

946+
--test-- "empty string rule"
947+
;@@ https://github.com/Oldes/Rebol-issues/issues/1880
948+
--assert not parse "ab" ["" to end] ;-- not like in Red!
949+
923950
===end-group===
924951

925952
~~~end-file~~~

0 commit comments

Comments
 (0)