forked from alex-eg/sex
refuse an integer with a leading 0
017 is 17 to Scheme and 15 to C, so whoever reads the Sex and whoever reads the C would each take it for something else.
This commit is contained in:
@@ -195,6 +195,12 @@
|
||||
|
||||
(define (finish-atom s)
|
||||
(let ((digits (if (substring-index "_" s) (or (ungrouped s (or (c-radix s) 10)) s) s)))
|
||||
;; 017 is 17 to Scheme and 15 to C: whoever reads the Sex and whoever
|
||||
;; reads the C would each take it for something else
|
||||
(when (irregex-match "-?0[0-9]+[uUlL]*" digits)
|
||||
(error
|
||||
"a leading 0 is octal to C; write the number without it, or #o for octal"
|
||||
s))
|
||||
(cond
|
||||
((string=? s ".") dot-token)
|
||||
((or (string->number digits) (radix-number digits))
|
||||
|
||||
Reference in New Issue
Block a user