adjust numbers

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

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

Loading…
Cancel
Save