Summary
##sys#read with -keyword-style prefix transforms bare colon into empty symbol
Metadata
- Id: 280e290f604b4c395c5fc538a77ebc6f18db364d
- Trac id: 1711
- Type: defect
- Reporter: alicemaz
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty: easy
- Resolution: fixed
- Priority: minor
- Milestone: someday
- Version: 5.2.0
- Changetime: 2020-09-09 12:23:38 UTC
- Created: 2020-08-05 07:50:10 UTC
- Keywords:
Attachments
- 280e290f604b4c395c5fc538a77ebc6f18db364d/attachments/prefix-colon.patch
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)
Changes and comments
[2020-08-05 07:50:48 UTC] alicemaz attached prefix-colon.patch (description=#f)
[2020-09-09 12:23:38 UTC] evhan changed status from new to closed
[2020-09-09 12:23:38 UTC] evhan set resolution to fixed
[2020-09-09 12:23:38 UTC] evhan wrote:
Fixed by a83213c4.