adjust numbers

pull/21/head
Matthew Butterick 5 years ago
parent 7ea139ac4f
commit 4f3db25a0b

@ -16,11 +16,9 @@
[(:or (from/stop-before "#" "\n") [(:or (from/stop-before "#" "\n")
(from/to "/*" "*/")) (token 'COMMENT #:skip? #t)] (from/to "/*" "*/")) (token 'COMMENT #:skip? #t)]
[reserved-toks lexeme] [reserved-toks lexeme]
[(:seq (:? "-") (:+ (:or alphabetic) digits)) [(:seq (:? "-") (:+ digits)) (token 'INT (string->number lexeme))]
(let ([maybe-num (string->number lexeme)]) [(:+ (:- (:or alphabetic digits) reserved-toks))
(if maybe-num (token 'ID (string->symbol lexeme))]))
(token 'INT maybe-num)
(token 'ID (string->symbol lexeme))))]))
(define-macro top #'#%module-begin) (define-macro top #'#%module-begin)

Loading…
Cancel
Save