Opened 4 years ago

Closed 4 years ago

#1711 closed defect (fixed)

##sys#read with -keyword-style prefix transforms bare colon into empty symbol

Reported by: alicemaz Owned by:
Priority: minor Milestone: someday
Component: core libraries Version: 5.2.0
Keywords: Cc:
Estimated difficulty: easy

Description

##sys#read recognizes prefix keywords by ignoring the leading colon and suffix keywords by consuming the trailing colon and then dropping it upon confirming it's the last token in an identifier. I added another case that adds the colon back in the prefix case if no tokens follow

the main purpose of this is to allow : from chicken.type to be used in prefix mode. presently it is a syntax error

also I fix a silly case where multiple colons would be dropped for prefix keywords, matching the suffix behavior where one is semantically meaningful and the rest go on the identifier

tested on PLATFORM=linux. code block below shows 5.2.0 behavior with prefix, patched behavior with prefix, and suffix behavior for comparison (which is unchanged between versions)

alice@bellona:~/work/misc/typetest % cat src/typetest.scm
(define prefix :pre)
(define suffix suf:)
(define canonical #:can)
(define blank :)

(define qpre :|qpre|)
(define qsuf |qsuf|:)
(define qpreblank :||)
(define qsufblank ||:)

(define triplepre :::tp)
(define triplesuf ts:::)

(: typesig fixnum)
(define typesig 1)
alice@bellona:~/work/misc/typetest % ( chicken src/typetest.scm -keyword-style prefix -check-syntax -debug 1 | grep -v '^$' > /dev/tty ) > & /dev/null
[source]
(define prefix #:pre)
(define suffix |suf:|)
(define canonical #:can)
(define blank ||)
(define qpre #:qpre)
(define qsuf |qsuf:|)
(define qpreblank #:||)
(define qsufblank :)
(define triplepre #:tp)
(define triplesuf |ts:::|)
(|| typesig fixnum)
(define typesig 1)
alice@bellona:~/work/misc/typetest % ( dev-chicken src/typetest.scm -keyword-style prefix -check-syntax -debug 1 | grep -v '^$' > /dev/tty ) > & /dev/null
[source]
(define prefix #:pre)
(define suffix |suf:|)
(define canonical #:can)
(define blank :)
(define qpre #:qpre)
(define qsuf |qsuf:|)
(define qpreblank #:||)
(define qsufblank :)
(define triplepre #:|::tp|)
(define triplesuf |ts:::|)
(: typesig fixnum)
(define typesig 1)
alice@bellona:~/work/misc/typetest % ( dev-chicken src/typetest.scm -keyword-style suffix -check-syntax -debug 1 | grep -v '^$' > /dev/tty ) > & /dev/null
[source]
(define prefix |:pre|)
(define suffix #:suf)
(define canonical #:can)
(define blank :)
(define qpre |:qpre|)
(define qsuf #:qsuf)
(define qpreblank :)
(define qsufblank #:||)
(define triplepre |:::tp|)
(define triplesuf #:|ts::|)
(: typesig fixnum)
(define typesig 1)

Attachments (1)

prefix-colon.patch (3.1 KB) - added by alicemaz 4 years ago.

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by alicemaz

Attachment: prefix-colon.patch added

comment:1 Changed 4 years ago by evhan

Resolution: fixed
Status: newclosed

Fixed by a83213c4.

Note: See TracTickets for help on using tickets.